Skip to content

Travel cost functions

Jip Claassens edited this page Sep 15, 2026 · 1 revision

Travel cost functions

In one sentence: c(t) is the price the optimiser puts on a resident's road time to a pharmacy; every sweep runs twice, with LINEAR (a minute is a minute) and with LOGISTIC (indifferent to short trips, saturating beyond ~45 minutes), because that choice is the model's equity dial.

Where this sits: GeoDMS exports the OD matrix (GeoDMS OD matrix and choice set) → settings.jl prices every OD row (one client cell, one candidate, one travel time) with c(t) → the LP is built from those prices (The facility location model explained) → sweep, rounding and scenarios score with the same c(t) and BIG → every deck chart has a LINEAR and a LOGISTIC twin (Deck and charts pipeline).

What c(t) is for

The model must compare two things with no common unit: how far people travel and how many pharmacies there are. It prices every resident's trip, c(t), with t the road time in minutes to their assigned pharmacy, and every open location at λ (Glossary), and minimises:

minimise   Σ_i  pop_i · c(t_i)          (travel, over all client cells i)
         + λ · (number of open locations)

In words: the travel bill is each 1 km² client cell's population times the price of its trip, summed; the facility bill is λ per open location. A location opens when the travel it saves exceeds λ, so only differences in c(t) matter.

λ is in the travel bill's unit: person-minutes under LINEAR, dimensionless logistic units under LOGISTIC. The sweep sets λ = w × 100 000 with w the knob it turns and €100 000 a placeholder, so "w = 0.13", "€13 000" and "13 000 person-minutes" are the same number (The lambda sweep and the Pareto frontier).

The LP may leave a cell unserved — soft coverage — at BIG per resident (Glossary): the longest trip the OD can hold (it is cut at 120 minutes) and a little more. How the objective encodes that, (c(t) − BIG) · pop per OD row with the constant dropping out, is on The facility location model explained; what matters here is that λ multiplies only the openness variables, so each new price rewrites only those coefficients (Code walkthrough lp_run).

Soft coverage: c(t) up to the 120-minute cut-off, then the flat BIG price for an unserved resident

The two functions in production

Every production run sets TRAVEL_FUNC to LINEAR or LOGISTIC (the orchestrators loop over exactly these two); both live in settings.jl → c(t) (around line 73), and Lambda sweep method has the formal table.

c(t), t in minutes c(0) c(15) c(25) c(45) c(60) c(120) BIG
LINEAR t 0 15 25 45 60 120 120
LOGISTIC 1 / (1 + e^(−(t − 25) / 10)) 0.076 0.269 0.500 0.881 0.971 0.9999 1.0

LINEAR and LOGISTIC c(t) on 0–120 min, BIG marked, the superseded 30/15 logistic dotted

LINEAR says a minute is a minute for everyone: the objective is total person-minutes, a unit that can be read out loud. It is unbounded — a resident at 100 minutes weighs twenty times one at 5 — and stranding is expensive (BIG = 120). No source records a decision to keep LINEAR; the closest is Chris's note in doc/topics.md that λ should be "communicable (person-minutes / value-per-user)", which only a linear c(t) allows.

LOGISTIC is an S-curve between 0 and 1 — the deck's "adapted logit", a plain logistic with the project's own midpoint and scale, not a log-logistic and not a choice model. The midpoint (25 min) is where c = 0.5; one scale (10 min) below it c = 0.27, one above 0.73, so the curve climbs mostly in the twenty minutes around 25. Below about 10 minutes it is flat relative to the band (the first ten minutes add 0.11, the next thirty 0.70), so moving a pharmacy a few minutes within a town changes almost nothing; by 45 it is saturated, a 90-minute trip (0.998) costing barely more than a 60-minute one (0.971). Lewis's "~5 min" and the code comment's "~10 min" name the same flat stretch loosely; a logistic has no exact kink. c(0) is not zero — every resident costs at least 0.076 however close the pharmacy, a floor no relocation can touch and one reason LOGISTIC percentages look smaller (writer's reading); the REGIO reviewers asked, and the deck now says so (doc/deck_changes_from_review.md §6).

Why BIG differs between them

"No pharmacy reachable" should cost as much as the worst trip the OD could contain, and a little more. The OD is cut at 120 minutes (cfg/main/ModelParameters.dms; Jip, 1 April 2026, 535f796, issue #15; the reason for 120 is not recorded — a plausible day-trip ceiling, inference), so for LINEAR big_cost() returns c(120) = 120 (env BIG_TRAVELTIME_MIN). LOGISTIC saturates, so BIG is 1.0 — Maarten's choice when the baseline (today's network, Glossary) was first priced coverage-consistently on 6 July 2026 (206923c). Until 16 July (4ec47a9) the LINEAR BIG was each region's observed maximum, 42 minutes (Paris) to 120 (Norway), which priced the same stranded resident three times differently and broke the cross-region aggregate (the 41 areas summed at common λ, Metrics aggregation and ranking).

What each function rewards and ignores

Price the same improvement for one resident under both functions:

Move (one resident) LINEAR saves LOGISTIC saves
City shave: 5 → 2 min 3 0.028
Suburb: 15 → 10 min 5 0.087
The band: 45 → 15 min 30 0.612
Far out: 120 → 60 min 60 0.029
Strand → serve at 60 min 60 (BIG − 60) 0.029 (1.0 − 0.971)

Under LINEAR the far-out move is worth twice the band move and twenty times the city shave: any minute saved anywhere counts, so a handful of very remote residents can pull a location towards them (the effect the group feared even more from the quadratic: "a pharmacy next to one island household", doc/topics.md). Under LOGISTIC the band move is worth twenty times the far-out move and twenty-two times the city shave: the function concentrates on getting people from 45 minutes to 15, is nearly indifferent to minor relocations inside towns, and — the flip side of "caps remote weight" — is nearly indifferent to whether a remote resident is served at 60 minutes or not at all.

That last line makes stranding cheap under LOGISTIC wherever BIG is used: in the soft LP at high λ (inference from the prices; no log was tallied) and in the coverage-honest rounding (From LP fractions to real pharmacies) — at S1 (today's number of pharmacies, relocated for least travel; Scenarios S1 S2 S3) rounding strands 130 clients in SE3 under LOGISTIC against 56 in SE2 under LINEAR (Pharmacy results September 2026 §5).

Multiplied by population, the same asymmetry decides which locations open. Take three client cells that all reach a hub candidate B: 100 town residents at 5 min from B, 10 village residents at 45 min, 5 remote residents at 120 min. Three more candidates each help one cell: A would bring the town to 2 min, C the village to 15 min, D the remote cell to 60 min. With only B open the bill is 100·5 + 10·45 + 5·120 = 1 550 person-minutes under LINEAR and 100·0.119 + 10·0.881 + 5·1.000 = 25.7 units under LOGISTIC. Each extra location, priced by what it saves:

Open also LINEAR saves LOGISTIC saves
A (town, 100 × 3 min) 300 100 × 0.028 = 2.8
C (village, 10 × 30 min) 300 10 × 0.612 = 6.1
D (remote, 5 × 60 min) 300 5 × 0.029 = 0.15

Under LINEAR the three are worth exactly the same: at any λ below 300 person-minutes all three open, above it none does, and the optimiser has no preference between shaving three minutes off a town and halving a remote cell's trip. Under LOGISTIC the village location is worth twice the town one and forty times the remote one: as λ rises, D closes first, then A, and C last. That ordering — the band first, the town second, the far-out last — is what "equity weighting" means in practice.

Why two functions are run, and what changes between the results

LINEAR is the communicable, efficiency-minded reading; LOGISTIC the equity weighting the JRC side asked for ("logistic (preferred, kinks ~5 & ~45 min)", doc/topics.md). Running both shows which conclusions survive; as of the results page of 10 September 2026 (41 areas):

  • The direction survives. Aggregate S1 cuts travel by 26 % under LINEAR and 13 % under LOGISTIC; S2 (today's travel, with as few pharmacies as possible) needs 34 % and 38 % fewer locations (Pharmacy results September 2026 §2).
  • The ranking by improvement potential kept the same two on top (ITF, ITG) — until issue #53 (commit 216ac77, 11–12 September, not yet on GitHub) replaced Italy's ESPON pharmacy list (12 991) with the OECD one (20 635 on the list, 20 621 in the study area): the Italian regions then drop to the bottom ten under LOGISTIC and the aggregate becomes 43 areas at S1 −23 % / S2 −30 %. The ITF/ITG lead was missing data, not geography (Branches data and environment).
  • The λ at which things happen differs by two orders of magnitude: aggregate S1 at w = 0.130 under LINEAR, 0.00130 under LOGISTIC — €13 000 against €130 per location. That is the compression problem below.

The retune: midpoint 30 / scale 15 → 25 / 10

The logistic was added on 24 May 2026 (46f23e6) with midpoint 30 and scale 15; who chose those values and why is not recorded. Lewis asked (doc/topics.md, deck travel-cost slide) for "kinks" at roughly 5 and 45 minutes; a comparison slide (6702d6f, 10 June) put 30/15 next to a "Lewis-tuned" 25/10, and doc/todo.md item C8 recorded the decision: 25/10 adopted on 2 July (7c6768f), env-overridable "so the previous variant stays reproducible", every LOGISTIC area re-swept. The settings.jl comment (around line 66) is the rationale: "lower below ~10 min (indifferent to minor relocations), saturating by ~45 min (caps remote weight)". Item C8 also flagged that Chris's methodology draft said log-logistic; the code is a plain logistic, and draft and deck were aligned on 10 July under item D12.

The λ-compression problem and the open rescaling decision

Both functions are swept over the same w grid (The lambda sweep and the Pareto frontier) but SWEEP_WMAX defaults to 5.0 for LINEAR and 0.5 for LOGISTIC (lambda_sweep_simplex.jl around line 304). The comment there gives the reason — "logistic c(t) ∈ [0, 1] makes the travel objective tiny, so facilities dominate at far lower λ" — and the criterion: high enough that every area's S1 and S2 are bracketed (ITG under LINEAR only passes today's travel at w = 5), affordable because high-λ solves are cheap. The travel objective is some 30× lower in level (aggregate baseline 1 030 M person-minutes against 30.3 M units) and its differences smaller still, so a location pays for itself at a λ about a hundred times lower.

The range is not merely shifted, it is squeezed. In the Netherlands (doc/deck_data.json; 1 615 pharmacy cells today) LINEAR slides gradually: the open count crosses today's between w = 0.2 and 0.3, today's travel between 0.34 and 0.39. Under LOGISTIC the whole S1–S2 stretch lies inside the single grid step 0.002 → 0.005: today's count is crossed between w = 0.002 (1 788 open) and the bisection point w ≈ 0.0032 (1 204), today's travel between w ≈ 0.0035 and 0.0038 (bisection: Scenarios S1 S2 S3). The aggregate's common range stops at w = 0.02 against 0.5 for LINEAR — capped by the slowest area's sweep, in practice also where the frontier stops moving (doc/deck_changes_from_review.md §6). So the fixed grid samples the interesting part of the frontier with two points, and the bisected S1/S2 matter more than the nearest grid rows. Reviewer Martijn Brons called this the degeneracy of the logistic variant; the deck answers "many λ values map to one solution" (doc/build_deck.mjs) — the reviewer's word, not the simplex sense on Background theory.

Bernhard Nöbauer's proposal (email of 23 July 2026) is to rescale the logistic so that c(0) and c(60) match the linear curve's 0 and 60. The deck records the trade-off — "it also changes the equity weighting the group chose the logistic for" — and tables it as a group decision (doc/deck_changes_from_review.md §6, DECIDE); as of September 2026 (commit e25416b) it is undecided (Decision log). Worth knowing (writer's derivation, not a recorded analysis): the match is a stretch-and-shift, c′(t) = α·(c(t) − 0.076) with α ≈ 67, equivalent to dividing λ by α; the frontier is unchanged if BIG is stretched too (to about 62; not specified). It moves every λ up ~67× and removes the c(0) floor, but on a log grid a multiplicative shift does not by itself sample the S1–S2 stretch more finely, so the deck's hope that rescaling "reduces degeneracy" needs the frontier to change (BIG kept at 1.0, making stranding almost free) or a re-chosen grid.

The unused variants, and the default that bites

settings.jl → c(t) still carries two more travel functions and constants for two facility-cost variants (Alternatives not pursued has the history):

  • QUADRATIC (code 2): 0.05·t² + 0.5·t, BIG = 780. The school-era default from issue #27 (Chris, translated from Dutch: "let's keep the function at this abstraction for now"; Lola's commit 26e39c7, 30 March 2026). Convex and unbounded, it chases the remote: "a pharmacy next to one island household" (doc/topics.md).
  • PIECEWISE (code 3): t to 15 min, 2t to 30, 4t beyond. Chris's first proposal in #27; Maarten asked for a continuous function "without jumps". A 15.1-minute trip costs twice a 15-minute one — cliffs. Never used.
  • FLOOR, CONCAVE (codes 5, 6): not travel functions — c(t) returns nothing. They select branches of facility_cost(q), a location's cost by the residents q it serves (a floor and a school-era power law, issue #38). Nothing calls it — the facility_cost in greedy-merge.jl and archive/ is a local variable; the sweep prices a location as λ only.

The pitfall: TRAVEL_FUNC still defaults to QUADRATIC (settings.jl around line 44; reason not recorded, presumably school-era inertia), so julia lambda_sweep_simplex.jl without the variable runs a QUADRATIC sweep into a …\lambda_sweep\QUADRATIC\ folder nothing parses — and cfg/main/Analyses.dms → SweepResults/baseline still reads that folder (around line 381, untouched since June 2026, fe8256a). Always set TRAVEL_FUNC; the batch scripts do (Running a sweep end to end).

Adding or changing a function

  1. settings.jl: add FUNC_NEW, an entry in FUNC_NAMES, a branch in c(t). Keep c non-decreasing in t: baseline_metrics picks each cell's nearest existing pharmacy by time (lambda_sweep_simplex.jl around line 172), client_nearest in lp_run.jl by cost; they agree only if cheaper always means nearer.
  2. Decide BIG: big_cost() returns c(120) unless the function is LOGISTIC; a saturating function needs its own price.
  3. Decide the grid top: set SWEEP_WMAX (5.0 LINEAR, 0.5 LOGISTIC today) so that S1 and S2 bracket in every area.
  4. The two names are hard-coded downstream (orchestrators, run_resweep_batch.ps1, five doc/ scripts, Analyses.dms); grep for LOGISTIC (Running a sweep end to end).

To change the logistic parameters nothing needs recoding beyond LOGISTIC_MIDPOINT / LOGISTIC_SCALE; the rescaling above would need a new branch (or an affine scale and offset) in c(t) and a matching rule in big_cost(). Either way every area must be re-swept (baseline and sweep are computed in the same run) and the deck rebuilt (Deck and charts pipeline). Folder and log are named by travel_func_name alone, so a 30/15 run and a 25/10 run overwrite each other: move the old results first.

In the code

What Where Permalink
Codes, TRAVEL_FUNC default, logistic parameters, c(t), big_cost(), facility_cost(q) settings.jl around lines 26–107 https://github.com/ObjectVision/NetworkModel_EU/blob/e25416b/settings.jl#L26
The (c(t) − BIG)·pop objective lp_run.jl → build_lp_warmstart, around line 419 https://github.com/ObjectVision/NetworkModel_EU/blob/e25416b/lp_run.jl#L419
Per-function w_max lambda_sweep_simplex.jl around lines 293–305 https://github.com/ObjectVision/NetworkModel_EU/blob/e25416b/lambda_sweep_simplex.jl#L304

Code walkthrough settings covers every other constant.

Knobs

Name Default What it changes Why you would change it Interactions
TRAVEL_FUNC QUADRATIC c(t), big_cost(), output folder, default w_max Every run: LINEAR or LOGISTIC The default silently runs the wrong function
LOGISTIC_MIDPOINT 25 (min) where c = 0.5 30 reproduces the pre-July curve LOGISTIC only; BIG stays 1.0
LOGISTIC_SCALE 10 (min) c = 0.27 one scale below the midpoint, 0.73 one above 15 with midpoint 30 reproduces the pre-July curve Very small: a step at the midpoint
BIG_TRAVELTIME_MIN 120 BIG = c(this) for non-saturating functions Experiments only Must match the GeoDMS cut-off

Pitfalls and open questions

  • Never compare travel costs or λ across functions. The −26 % / −13 % pair is two answers to two questions.
  • Stranding is cheap under LOGISTIC (BIG − c(60) = 0.029): read the stranded column of the log before quoting a LOGISTIC S2 (Log lines and output files).
  • TRAVEL_FUNC defaults to QUADRATIC, and folder and log names carry no parameters (no issue filed; Decision log).
  • Open: BN's rescaling (DECIDE on the deck); logistic-parameter sensitivity sweeps (never run); the origin of 30/15 (not recorded); whether BIG_TRAVELTIME_MIN should be read from the GeoDMS parameter rather than duplicated.

See also

Clone this wiki locally