Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Using lambda / registered callback function to dynamically calculate cost for edges

オープン
#243 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
postgresql
領域
backend, databases

調査の方向性

The issue is about modifying pgr_drivingDistance to support dynamic edge costs via a callback. Look at the pgr_drivingDistance source code in the pgRouting library to understand the current cost handling. The callback would need to accept edge details and accumulated cost, returning a calculated cost. This requires changes to the function signature and internal logic, and likely extending the SQL interface to accept a function reference or array column.

索引モデルが issue の本文から書いたものです。

説明

Functionality Request

I am working on an interesting problem regarding the use of pgr_drivingDistance that I thought you might have some thoughts about.

It concerns calculating the correct cost over long distances with maps where the cost for each edge can differ depending on the time of day.

Example: I have a map where max. speed on the roads differs for every 15 minutes (like on the OSM) If I want to drive a long distance eg. 100 km, I can start at 09.00. Then after the first maybe 3 edges (eg. 15-20 km) the time is now 09.15 and the costs for the remaining edges could now differ substantially. After another few edges it's 09.30 and the same happens again and so on...

pgr_drivingDistance needs an sql that returns the entire graph with - at the time of querying - have a fixed cost on each edge. So from that point of view, the above example would not be possible to calculate correctly, since we will only be able to supply all edge-costs based on the time 09.00.

I have been bashing my mind to figure out a solution to this, and I've come up with something that also might not cost too much performance:

Instead of pgr_drivingDistance taking the edge cost directly from the sql result, it should run a callback function with the parameters

  • edge structure (id, source, target, cost, reverse_cost)
  • accumulated cost so far)
    The callback should then return a calculated cost for the edge in question

For this to work, the structure sent to pg_drivingDistance might also need to be more lenient (ie. accept a "cost" column that is an array of floats instead of just a single float etc.)

Let me hear what you think of this.

主要言語
C++
スター
1.4k
フォーク
397
平均マージ
2日 2時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pgRouting/pgrouting のほかの issue

pgRouting/pgrouting の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。