Repository navigation
GeoDMS OD matrix and choice set
In one sentence: how the GeoDMS configuration decides who is a client, who is a candidate and which pairs get a road time (the choice set), and writes that into the three Arrow files Julia reads — every downstream number inherits this scope.
Where this sits: GeoDMS → Arrow → Julia LP → sweep → rounding → scenarios → deck. Arrow is Apache Arrow, a columnar binary table format that GeoDMS writes through its GDAL driver and Julia reads with
Arrow.jl. The scope consequences (landbodies, region exclusion, where the radius binds) are owned by Scope rules and data gaps; Maarten's compact table is on Pharmacy service access.
This describes cfg/ on ServiceAccess at commit e25416b (10 September 2026; documented 15 September); main carries later GeoDMS work by Chris that is not on this branch, and the per-landbody rule was hand-ported in 79cb58b — Branches data and environment.
For one study area at a time it produces three tables per side: clients (inhabited 1 km² cells), facilities, and a sparse origin–destination table with the road travel time from each client to each facility in its choice set. The Existing side (AllocateClientsToExistingPharmacies) has today's pharmacy cells as facilities and becomes the baseline ★ — today's network scored by the model, every client at its road-nearest pharmacy cell (Glossary). The New side (AllocateClientsToNewPharmacies) has the candidate cells and is what the LP — the linear programme that chooses which candidates to open (The facility location model explained) — optimises over; the sweep reads S1/S2 off its frontier (Scenarios S1 S2 S3). The configuration also computes descriptives of today's network and reads Julia's results back for mapping. One environment variable, STUDY_AREA, drives everything.
ModelParameters.dms (around line 22):
StudyArea_ext := Expand(., '%env:STUDY_AREA%');
StudyArea_default := 'ITG';
StudyArea := replace(StudyArea_ext, 'env:STUDY_AREA', StudyArea_default);
NUTS1_rel := rlookup(StudyArea, /SourceData/RegionalUnits/NUTS1/values);
Use_NUTS1_selection := IsDefined(NUTS1_rel);
Use_Country_selection := StudyArea != 'EU' && !Use_NUTS1_selection;
In words: take the string from the environment, or the default if it is unset. The string must be an English country name as in CNTR_RG_01M_2020_3035.shp's name_engl field (Netherlands), a NUTS-1 code as in Nuts3.shp's N1_code (ITG, SE3), or EU. There is no validation: a typo gives a silent empty run. Why an environment variable: until c93ebf6 (13 May 2026) the batch rewrote the file with a regex; the env-var lets areas run side by side. The default 'ITG' (Chris, 79cb58b) only bites in the GUI; why ITG is not recorded.
A country run keeps the grid cells whose centre falls inside the country polygon (IsCountry); a NUTS-1 run sets Country/Subset to all EU + EFTA countries, fills NUTS1/Subset with the NUTS-3 polygons of that N1_code, and keeps IsNuts1 cells (Geography.dms around line 125). One asymmetry: TomTom.dms (around line 53) clips the road extract to the country's bounding box in a country run but to the exact NUTS-1 polygon in a NUTS-1 run, so a NUTS-1 extract loses routes that leave and re-enter the region (effect unmeasured). Every output path contains StudyArea, so all areas coexist under %LocalDataProjDir%.
Analyses.dms lines 3–18:
Client := select_with_attr_by_cond(Base_grid_1km/points, population > 0)
covered_country (Country/subset) := pcount(Pharmacies/within_StudyArea/Country_rel) > 0
ModelClient := select_with_attr_by_cond(Base_grid_1km/points,
population > 0 && covered_country[Base_grid_1km/points/Country_rel])
The expressions are string-built from ModelParameters/Client: 'population' for pharmacies, because the whole population uses them; 'pop_primaryschool' for schools. Until 033dd32 (2 July 2026) the pharmacy runs still used 'pop_primaryschool', so cells without school-age children were not clients at all; the switch made Luxembourg's client population exactly its 634 435 residents.
Client is the demand universe: every inhabited cell. ModelClient is the modelled demand: the same cells restricted to countries for which the study area holds at least one pharmacy record. The filter states data availability, not accessibility (issue #49, Maarten, 1 September 2026): pricing residents of a country without pharmacy records at BIG — the penalty Julia charges a client that can reach no open facility, 120 min under LINEAR (Glossary, Travel cost functions) — would let a data gap masquerade as a policy finding (Scope rules and data gaps).
Why one unit for both sides: S1, S2 and the improvement rectangle are defined relative to the baseline point (Scenarios S1 S2 S3). Commit 79cb58b had put only the Existing side on the filtered unit, so the two sides carried different populations — the "baseline and LP scored on different client sets" defect that the coverage-consistent baseline of July 2026 had already fixed once (doc/todo.md item B3). Commit f0acbc9 (1 September 2026) renamed the unit ModelClient and applied it to both Allocate_T instantiations and the descriptives. Schools keep plain Client.
A subtlety for NUTS-1 and EU runs: there the grid is selected by IsNuts1 / IsEU, while Country_rel comes from the Country/subset polygons (Geography.dms around lines 115–127). A cell inside the NUTS-1 (or NUTS0) polygon but outside every country polygon has a null Country_rel, covered_country[null] is not true, and the cell drops out of ModelClient and the candidate set although it is in Client and in Descriptives/n_residents (which sums over Base_grid_1km/points). In a country run the grid is selected by IsCountry := IsDefined(Country_rel) itself, so the case cannot arise.
Locations.dms around line 478:
NewPharmacyLocations := select_with_org_rel(
( Base_grid_1km/points/population >= ModelParameters/MinPopSizeForPharmacyLocation // 50
|| IsDefined(rlookup(…/points/geometry[Base_grid], Pharmacies/within_StudyArea/uq_cells/values)) )
&& /Analyses/covered_country[Base_grid_1km/points/Country_rel] )
A cell is a candidate if it has at least MinPopSizeForPharmacyLocation = 50 residents or contains a pharmacy today, and lies in a covered country; within_StudyArea then applies the same polygon test the pharmacies get.
Why 50. Agreed in the 24 June 2026 mail thread: it keeps about 98 % of today's pharmacy locations while shrinking the search space from about 7.5 % to 2.9 % of EU cells (Chris's figures, quoted in the ModelParameters.dms comment). On the Luxembourg pilot the rule cut M — the candidate count Julia reports — from 1 599 to 945 while S1's travel saving went from −7.66 % to −7.98 % (7c6768f); the two runs also differ in the client definition (033dd32, same day), so read this as "the restriction costs essentially nothing", not as an improvement.
Why the union. About 2 % of pharmacies lie in cells under 50 residents and must stay selectable, or the frontier could not reproduce today's network.
Why the coverage filter (d80622d). With λ > 0 — λ is the per-facility price the sweep varies (The lambda sweep and the Pareto frontier, Glossary) — the LP never opens a facility that serves nobody, so the optimum is unchanged, but the reported M no longer counts unselectable cells.
One attribute on the candidate unit drives the choice-set rule: CountCurrentObjects := MakeDefined(rjoin(Base_grid_rel, uq_cells/Base_grid_rel, uq_cells/CountCurrentObjects), 0f) — the pharmacies in the candidate cell today, 0 if none (Count_Objects_Per_Cell := 1 feeds only school-era gravity items such as SchoolCount_j). The Existing side's facility unit is Pharmacies/within_StudyArea/uq_cells (around line 440): one row per 1 km cell holding at least one pharmacy — a "facility" there is a cell, not a pharmacy; the Netherlands has 1 992 raw pharmacies in 1 617 cells. Both units use the cell centre as geometry, so a pharmacy cell and its candidate twin share (x, y); Julia relies on that to recognise baseline locations among candidates.
Analyses.dms around line 125 instantiates Allocate_T(Org, Dest, NetwerkSpec, ProjName) with Org = ModelClient on both sides and Dest = uq_cells (ProjName ExistingPharmacies) or NewPharmacyLocations/within_StudyArea (NewPharmacies); ProjName is the output folder and what Julia's ANALYSIS env var selects.
Dest enters the network build: CreateNetwork_T (Templates.dms lines 3–48) unions Org and Dest into UniqueLocations and gives each a connector link to the nearest connectable road (LinkSet_Calc, around line 120). A different Dest therefore means a different link set and .mmd, which is why each side's batch runs network1 and network2 before alloc, and why changing the client definition forced the Existing side to be rebuilt too. GeoDMS does not reliably rewrite an existing .mmd after a configuration change (doc/todo.md A1 records silent skips; 7c6768f saw a rewrite on Luxembourg), so the rebuild scripts purge FinalSet_*/Linkset_* on both sides first (Running a sweep end to end).
Analyses.dms around line 278 (https://github.com/ObjectVision/NetworkModel_EU/blob/e25416b/cfg/main/Analyses.dms#L278):
unit<uint64> Allocation :=
impedance_matrix_od64(
'bidirectional(link_flag);startPoint(Node_rel);endPoint(Node_rel);cut(OrgZone_max_imp);limit(OrgZone_max_mass,DstZone_mass);alternative(link_imp):alt_imp;od:OrgZone_rel,DstZone_rel,impedance'
, FinalLinkSet/Impedance // seconds per link
, FinalLinkSet/F1, FinalLinkSet/F2 // link end nodes
, !FinalLinkSet/IsOneDirection // link_flag
, FinalNodeSet/OrgNode_rel // startPoint per Org
, FinalNodeSet/DestNode_rel // endPoint per Dest
, ModelParameters/max_traveltime_to_facility[s_f] // cut: 120 min = 7 200 s
, ModelParameters/max_nr_facilities_per_client // OrgZone_max_mass = 5
, float64(Facility/CountCurrentObjects > 0f) // DstZone_mass: 1 if the cell holds a pharmacy today
, FinalLinkSet/Lengthkm // alternative impedance
)
-
bidirectional(link_flag)— per link, may it be traversed against its F1→F2 direction?!IsOneDirectionkeeps one-way roads one-way. -
startPoint(Node_rel),endPoint(Node_rel)— one shortest-path tree per origin zone (each client) rooted atOrgNode_rel; the destination zones are theDestrows atDestNode_rel. Several destinations may share a node: a client cell and a candidate at the same centre are oneUniqueLocation. -
cut(OrgZone_max_imp)— each tree stops at 7 200 s of accumulated impedance; nothing beyond 120 min enters the OD. (ModelParameters/MaxTravelTime, also 120 min, only feeds export metadata.) -
limit(OrgZone_max_mass, DstZone_mass)— each tree also stops once the destinations it has reached carry a summed mass of at least 5. With mass 1 on cells that contain a pharmacy today and 0 on every other candidate, the search runs until the 5th existing-pharmacy cell is reached, and every destination settled before that moment — including all mass-0 candidates — is in the row. -
alternative(link_imp):alt_imp— accumulateLengthKmalong the impedance-shortest path;d_ijis thus the length of the fastest route. Commit0737dfe(fix #34) swapped these roles (before, length was the impedance and time the alternative); the reason is not recorded beyond the issue number, the evident motivation being that the LP's cost functions take minutes (inference). -
od:OrgZone_rel,DstZone_rel,impedance— one row per reached (origin, destination) pair with these three attributes plusalt_imp.
The link impedance (Templates.dms around line 223) is LengthKm / KPH in seconds plus 0–6 s per link end depending on the node's degree (CorrectImpedanceForCrossroads). Derived attributes on Allocation (around lines 293–315): client_rel := OrgZone_rel, facility_rel := DstZone_rel, t_ij := max(impedance, 1 s) in seconds, d_ij := max(alt_imp, 0.001 km) — floored (MinTime, MinDist) because a client cell that is itself a candidate shares its OD node and would otherwise get a zero self-pair — travelcost_ij := d_ij · 0.19 €/km, plus Deterrence_ij and the school-era gravity model. Julia consumes only client_rel, facility_rel and t_ij.
A client's choice set is the set of facilities in its OD rows: Julia creates one assignment variable x_ij — the share of client i's demand sent to facility j — per OD row, so the rows are exactly the facilities the LP may ever assign it to (The facility location model explained, Glossary).
-
Existing side (every
Destrow has mass 1): each client gets its 5 nearest pharmacy cells by road — fewer if fewer lie within 120 min, none if none does. Julia's baseline takes the minimum-t_ijrow per client (baseline_metrics). -
New side (mass 1 only on candidates that hold a pharmacy today): each client gets every candidate whose road time is at most the road time to its 5th-nearest existing pharmacy cell, capped at 120 min — 71 (SE2) to 86 (ITF) candidates per client on average (
4267fe0, the deck's choice-set slide). An old Netherlands run (≈ 22 900 clients, 29 793 candidates predating the ≥ 50 rule;oldlogs/lambda_sweep_netherlands_simplex.log) had 114 540 Existing rows — 5.0 per client, so the mass limit is inclusive — and 1 001 117 New rows, ≈ 44 per client.
Take one client with, by road time, candidates C1 2 min, C2 4, C3 7, C4 11, C5 15, C6 22 and existing-pharmacy cells E1 3, E2 5, E3 8, E4 12, E5 20, E6 35 (cut = 120 min, limit = 5). Existing side: the tree settles E1 (mass 1), E2 (2), E3 (3), E4 (4), E5 (5) → stop; row {E1 … E5}, E6 absent although within 120 min. New side: C1, E1, C2, E2, C3, E3, C4, E4, C5, E5 → stop at mass 5; ten facilities, radius 20 min; C6 and E6 absent. If only three existing cells were within 120 min, the mass never reaches 5 and the cut alone bounds the row: every candidate within 120 min is in it.
The radius is fixed by today's five and does not grow when facilities close, so a client whose E1 … E5 all close and whose C1 … C5 stay shut is priced at BIG although E6 exists 35 minutes away. Where this binds (SE2, Norway/ITF at S2), the measured shares and the 5 → 10 widening on the roadmap: Scope rules and data gaps, Decision log.
Why 5: a compute-bound choice from the school era (eaf133c, 23 February 2026, issue #22) — searching outward from each client and stopping at its k-th facility is a bounded search, whereas listing, per facility, every client that might consider it has no natural stopping point. Why 120: not recorded; the time cut replaced a 1 000 km distance cut in 0737dfe (31 March 2026, 300 min) and became 120 in 535f796 the next day. It must match Julia's BIG_TRAVELTIME_MIN (120), or stranding is priced inconsistently (Code walkthrough settings).
A landbody is one part of a country's multipolygon — mainland, Sicilia, each Wadden island — produced by Country_Split (RegionalUnits.dms around line 117, geos_split_union_polygon over all countries) (Glossary). Templates.dms line 93 selects the road network with Roads_isConnected := …/Connectiveness_seldomain/Strong_connectivity/IsConnected_seldomain, from Check_Connectiveness_T_seldomain(…, Country_split) (line 87; template around lines 705–801):
-
seldomain_rel (NodeSet)=point_in_polygon(node geometry, Country_Split/geometry_lea)— every road node gets a landbody. -
LinkSet_digraphdoubles every two-way link;strongly_connected_componentsnumbers the components — groups of nodes that can all reach each other respecting one-way links (Glossary). -
Networks_per_seldomain := unique(point_xy(PartNr, seldomain_rel))— the (component, landbody) pairs. -
Main_in_seldomain (seldomain)(line 775) = among the components with at least one node in the landbody, the one with the most nodes overall (Nr_nodes_in_network, notNr_nodes_in_both) — so a ferry-joined island keeps the mainland's component rather than a small local one, the intended outcome (inference). -
IsConnected_seldomain (NodeSet)(line 779) = the node's component is the main component of some landbody; a link is kept if both ends are.
In words: instead of "keep the one largest strongly connected road system in the extract" (the old IsConnected := PartNr == Main, line 778), the rule is "for each landbody, keep the largest one that touches it". Why the rule exists, what it changed (ITG 983 169 → 591 unreachable) and the #50 follow-up: Scope rules and data gaps.
Sel_crit (Nr_nodes_in_both > 1000 || Main_touching_seldomain), SelCrit, the Undirected_connectivity container and the non-seldomain Connectiveness instantiations (lines 86, 117) are defined but never referenced by Roads_isConnected/Nodes_isConnected (lines 93–94): their only consumer, IsVerbonden, is commented out (lines 749, 797), so GeoDMS never evaluates them. Do not document a 1 000-node rule as live.
All are gdalwrite.vect with GDAL_DRIVER := 'Arrow' under %localDataProjDir%/<ProjName>/<StudyArea>_{od,i,j}.arrow (Analyses.dms around lines 344, 415, 436); the batch step alloc requests exactly these three.
| Export | Domain | Columns as written | Units and meaning |
|---|---|---|---|
DistanceTableExport → <area>_od.arrow
|
OD |
client_rel, facility_rel (uint32), t_ij, d_ij, travelcost_ij, Deterrence_ij (float32) |
0-based row indices into _i and _j; seconds (floor 1 s); km along the fastest route (floor 0.001); €; dimensionless |
ClientExport → <area>_i.arrow
|
Org = ModelClient
|
id (0-based), pop (the ModelParameters/Client column), total_pop (Org/population), x, y (float64, EPSG:3035 m, cell centre), NUTS (string) |
pop == total_pop in pharmacy runs; Julia weights by CLIENT_WEIGHT = total_pop; NUTS is the NUTS-3 code or ''
|
FacilityExport → <area>_j.arrow
|
Facility = Dest
|
id (0-based, per-file local), x, y, NUTS
|
existing and candidate facilities match only by (x, y)
|
Two naming gotchas: the export declares Client_rel but the column on disk is client_rel (the earlier declaration at line 293), and it declares nuts but writes NUTS (872b388) — GeoDMS's token registry is case-insensitive and keeps the first spelling it saw. Julia reads od[:client_rel] and loc[:NUTS].
Both loaders divide t_ij by 60 on load (load_from, lambda_sweep_simplex.jl line 117, where mask keeps only rows whose facility survived subsampling or region exclusion; load_country, settings.jl line 257), so everything from the LP objective onward is in minutes; ids stay 0-based in Julia and get +1 only when indexing a Julia vector (population[clients_col[k]+1]). d_ij, travelcost_ij and Deterrence_ij are ignored by the sweep. The full units-and-identifiers table is on Log lines and output files; who reads each column: Code walkthrough settings, Code walkthrough lambda_sweep_simplex.
_i.arrow (New side, order = id(ModelClient)): clients 0, 1, 2 with pop = total_pop = 120, 800, 60 and NUTS = NL324, NL324, '' (client 2's centre lies outside every NUTS-3 polygon). _j.arrow: facility 0 shares client 0's cell centre and holds a pharmacy today (CountCurrentObjects = 2); facilities 1 and 2 are candidates without one, facility 1 in client 1's cell.
_od.arrow, t_ij in seconds:
| client_rel | facility_rel | t_ij | d_ij |
|---|---|---|---|
| 0 | 0 | 1 | 0.001 |
| 0 | 1 | 95 | 1.1 |
| 1 | 0 | 90 | 1.0 |
| 1 | 1 | 1 | 0.001 |
| 1 | 2 | 180 | 2.3 |
| 2 | 1 | 150 | 1.6 |
The two 1 s rows are self-pairs (the MinTime floor). Julia's view after load_from: t_ij_col = [1, 95, 90, 1, 180, 150] ./ 60 = [0.017, 1.583, 1.5, 0.017, 3.0, 2.5] minutes; wpop = population[client_rel + 1] = [120, 120, 800, 800, 800, 60]; N = 6 rows, M = 3 facilities. Open only facility 1: travel = 120 × 1.583 + 800 × 0.017 + 60 × 2.5 = 190.0 + 13.3 + 150.0 = 353.3 person-minutes. Open only facility 0: client 2 has no row to it and is stranded — 120 × 0.017 + 800 × 1.5 + 60 × BIG(120) = 2.0 + 1 200 + 7 200 = 8 402 person-minutes. "Stranded" in file terms is simply "no OD row to any open facility".
The NUTS column. Both exports compute MakeDefined(NUTS3/NUTS_CODE[point_in_polygon(geometry, NUTS3/geometry)], '') — the NUTS-3 code of the polygon containing the cell centre, empty where there is none. One string carries all three levels by prefix (5 characters = NUTS-3, 4 = NUTS-2, 3 = NUTS-1). Julia uses it to drop whole NUTS regions whose clients mostly reach no pharmacy (excluded_nuts_regions in settings.jl); the rule, its threshold and why it is judged on the Existing OD: Scope rules and data gaps.
Julia writes per sweep point <ProjName>/<area>/lambda_sweep/<FUNC>/<label>/assignment.arrow (id = facility index as in _j.arrow, open 0/1) and traveltime.arrow (id = client index as in _i.arrow, t_ij in minutes) — the writers in lambda_sweep_simplex.jl lines 23–69. Labels are w=<w>, S1 and S2 (stable names, so the .dms need not know the area's w) and baseline (under ExistingPharmacies). A stranded client has no entry in traveltime.arrow, so rjoin gives it a null.
ReadSweepResults_T(proj, func, w_label) (Analyses.dms around line 219) reads exactly those two files: ResultingClientAssignment/t_ij is declared min_f, consistent with Julia's minutes; ClientTravelTime (Org) joins it on id and ClientTravelTime_Classified bins it (0-2-4-6-8-10-20-30-60 min). ResultingFacilityClosure/open is read as OpenEnum (0 Closed, 1 Open, 2 Underfilled — school-era, never written by the sweep) into FacilityRemainsOpen (Facility), OpenFacilities (with geometry) and Openness (Base_grid_1km): a smoothed map in which every facility within 10 km contributes 1/d² to a cell's potential (Distmatrices/Impl/pot10000m), and the ratio of the open facilities' potential to all facilities' potential is the share of nearby pharmacy "mass" still open — 0 = all closed nearby, 1 = nothing changed.
SweepResults inside Allocate_T (around line 377) instantiates it for baseline (on the Existing counterpart via replace(ProjName, 'New', 'Existing')) and for lin_S1, lin_S2, quad_S1, quad_S2, log_S1, log_S2, and computes dT_<func>_<S> (Org) := <S>/ClientTravelTime − baseline/ClientTravelTime (negative = faster than today). Only baseline/ClientTravelTime is valid inside the New instantiation — its facility items would join existing-pharmacy ids onto the candidate set.
Analyses/Pharmacies/Descriptives/Table (around lines 28–123) writes one Arrow row per area to %localDataProjDir%/Pharmacies_Descriptives/<StudyArea>.arrow; make_descriptive_table.bat loops the areas and collect_descriptives.jl gathers them into doc/pharmacy_descriptives.csv. The road-nearest pharmacy cell per client is best_od (ModelClient) := min_index(AllocateClientsToExistingPharmacies/Allocation/impedance, …/client_rel). cell_catchment (cells) sums the residents whose road-nearest pharmacy cell is this one (Lewis's indicator 6 from the 22 May request); pharm_catchment (pharm) divides that equally over the pharmacies in the cell (indicator 5). Zero catchments are counted as cell_n_empty/pharm_n_empty and excluded from the *_min_nz columns. Because best_od reads the Existing Allocation, the descriptives need the Existing network and OD; the batch header's "no network needed" is stale. The six indicators and their reading: Metrics aggregation and ranking.
Around line 500: Chris's reporting wiring from 79cb58b (issue #45, the S1/S2 location deliveries), outside the Julia pipeline. A 21-row unit of area names (Austria, …, ITG, Norway, PL2, …, SE1) reads <area>_s1_logistic_open.arrow / _s2_logistic_open.arrow from D:/sourcedata/NetworkModel_EU/Locations/service_access_202608/ through the readresultfiles template, unions them, takes the unique geometries and builds a within_StudyArea facility set that feeds AllocateClientsTos1Pharmacies/Tos2Pharmacies (Analyses.dms around line 156) with their own networks (NetworkSetup.dms). Its lower-case naming is why export_s1s2_locations.jl writes <area>_<s1|s2>_<linear|logistic>_open.arrow with columns x, y only (Maarten's Pharmacy service access table lists id, x, y; the exporter at e25416b writes (x = xs, y = ys) — the code wins). Its defects are in Pitfalls.
- Set
STUDY_AREAbefore starting the GUI (set STUDY_AREA=Netherlandsin the launching shell); without it you getITGand everyReadSweepResults_Tpath points at the wrong folder. - The sweep must have run for that area on that machine:
NewPharmacies/<area>/lambda_sweep/<FUNC>/S1,/S2andExistingPharmacies/<area>/lambda_sweep/<FUNC>/baselinemust exist — in September 2026 only on Maarten's machine (Branches data and environment). - Open
/Analyses/AllocateClientsToNewPharmacies/SweepResults/lin_S1/OpenFacilities(orlog_S1,lin_S2,log_S2) in a map view;…/FacilityRemainsOpenshows open and closed candidates together. -
…/lin_S1/ClientTravelTime_Classifiedgives binned minutes per client cell,…/SweepResults/dT_lin_S1the change against today,…/lin_S1/Opennessthe 10 km inverse-square potential ratio on the 1 km grid. - For the baseline's open map use the Existing instantiation,
/Analyses/AllocateClientsToExistingPharmacies/SweepResults/baseline/OpenFacilities.
The pitfall you will hit first: SweepResults/baseline is wired to ReadSweepResults_T(BaselineProj, 'QUADRATIC', 'baseline') (Analyses.dms line 381), but the sweep writes the baseline under the function it runs (sweep_dir uses travel_func_name). The runners set TRAVEL_FUNC to LINEAR and LOGISTIC (run_recalc_batch.ps1, run_resweep_batch.ps1, run_new_country_sweeps.ps1); only an unconfigured run falls back to settings.jl's default QUADRATIC, which is what line 381 still expects. A QUADRATIC folder exists only where such a sweep ran (the scenarios were wired in 439b22e, the same day); for any area swept since, the item errors and every dT_* attribute with it; quad_S1/quad_S2 (lines 385–386) point at the same unswept function. Line 381 dates from fe8256a (2 June 2026); the one-line fix is 'LINEAR' (or a parameter) there.
Open in this order (line numbers at e25416b):
-
cfg/main/ModelParameters.dms3–41 — every knob (https://github.com/ObjectVision/NetworkModel_EU/blob/e25416b/cfg/main/ModelParameters.dms#L14). -
cfg/main/Analyses.dms: 3–18Client/ModelClient· 28–123Descriptives· 125–139 instantiations · 219–262ReadSweepResults_T· 264–355Allocate_T(OD call 278, OD export 344) · 377–397SweepResults· 415–448 client/facility exports. -
cfg/main/SourceData/Locations.dms: 358–451Pharmacies(uq_cells440) · 478–498NewPharmacyLocations(https://github.com/ObjectVision/NetworkModel_EU/blob/e25416b/cfg/main/SourceData/Locations.dms#L478) · 500–562services_allocated. -
cfg/main/Templates.dms: 3–48CreateNetwork_T· 87–94 connectivity choice (https://github.com/ObjectVision/NetworkModel_EU/blob/e25416b/cfg/main/Templates.dms#L93) · 120–211LinkSet_Calc/connectors · 219–272 impedance · 705–801Check_Connectiveness_T_seldomain. AlsoRegionalUnits.dms117 (Country_Split);TomTom.dms53–55;Geography.dms107–151 (Base_grid_1km/points). - Consumers:
lambda_sweep_simplex.jlload_from(71),baseline_metrics(167), writers (23–69);settings.jlexcluded_nuts_regions(129),in_excluded_region(184),client_weight_col(191),load_country(222);export_s1s2_locations.jl;collect_descriptives.jl. Batches:run_pharmacy_pipeline.bat,run_new_pharmacy_pipeline.bat,make_descriptive_table.bat— Running a sweep end to end.
| Name | Where | Default | What it changes | Why you would change it | Interactions |
|---|---|---|---|---|---|
STUDY_AREA (env) |
ModelParameters.dms 22–26 |
'ITG' |
polygons, grid selection, road subset, every output path | one value per area; the batches set it |
name_engl, N1_code or EU; no validation |
Client |
35 | 'population' |
which column must be > 0 to be a client; pop in _i.arrow
|
'pop_primaryschool' for schools |
changes the client set and hence both networks |
MinPopSizeForPharmacyLocation |
41 | 50 | candidate threshold (∪ pharmacy cells regardless) | search-space size, agreed with JRC | LP size ∝ candidates × radius |
max_nr_facilities_per_client |
14 | 5 |
OrgZone_max_mass: search stops at the 5th existing-pharmacy cell |
widen the choice set (roadmap: 10 on the candidate side) | one value serves both sides; OD grows roughly linearly |
max_traveltime_to_facility |
16 | 120 min |
cut: absolute ceiling (MaxTravelTime, line 7, is metadata only) |
— | must equal Julia's BIG_TRAVELTIME_MIN (120) |
Julia-side knobs that pair with these — ANALYSIS (= ProjName), CLIENT_WEIGHT, BIG_TRAVELTIME_MIN, NUTS_EXCLUSION, NUTS_EXCLUDE_SHARE, LOCATION_SELECTION_FACTOR, PROTECT_BASELINE — are on Code walkthrough settings.
-
Stale
QUADRATICinSweepResults(Analyses.dms381, 385–386): see above; not fixed ate25416b. -
services_allocateddefects (Locations.dms500–562). ItsCountCurrentObjectsjoins against schools (lines 523, 543) — the defect7c6768ffixed forNewPharmacyLocations, which had been an alias ofNewSchoolLocationsso that the "5 nearest current facilities" limit counted school cells; here (unverified inference) thelimit(5, mass)stops at the 5th school cell, or never where the mass is null, so those ODs are not "5 nearest S1 pharmacies". Itsunique/IsStudyArea(lines 516, 536) tests onlyCountry/subset/geometry, not the NUTS-1 polygon likePharmacies/EU/IsStudyArea(428–430) andNewPharmacyLocations/IsStudyArea(487–489), so in a NUTS-1 run (whereCountry/subsetis all EU + EFTA) the S1/S2 facility set forITGholds every listed area's open locations, not ITG's. Also: only LOGISTIC is wired, the path is an absoluteD:/, and only 21 of 42 areas are listed. -
Column-name case:
Client_rel→client_rel,nuts→NUTSon disk; the first spelling wins. -
Null-
Country_relcells in NUTS-1 and EU runs leaveModelClientand the candidate set while staying inClientandn_residents; how many residents this concerns was never counted. Cannot occur in a country run. -
Dead references:
Country_Split/IsWithinStudyAreaand theBase_grid_100m/GetGrid_Tcriteria point at items that no longer exist (they fail only if evaluated);cfg/main/Analyses/*.dmsis not#included. -
Open: why 120; whether
limit(…)includes the destination that pushes the mass to 5 (no offline operator documentation says; inclusive is assumed everywhere and matches the row counts); whatExpandreturns for an unset variable (the idiom works); whether GeoDms 20.19 still writes theExportSettings/MetaInfoXML sidecars (19.0 did) and whether anyone reads them.
- Scope rules and data gaps · Pharmacy service access · Branches data and environment
- Code walkthrough settings · Code walkthrough lambda_sweep_simplex · Log lines and output files
- Running a sweep end to end · Scenarios S1 S2 S3 · Metrics aggregation and ranking
- The pipeline in plain words · The facility location model explained · Travel cost functions · The lambda sweep and the Pareto frontier · Decision log · Lambda sweep method · Glossary
NetworkModel EU documentation
Start here
Understanding the method
- The facility location model explained
- Travel cost functions
- The lambda sweep and the Pareto frontier
- From LP fractions to real pharmacies
- Scenarios S1 S2 S3
- Scope rules and data gaps
- Metrics aggregation and ranking
- Background theory
Working with the code
- GeoDMS OD matrix and choice set
- Code walkthrough settings
- Code walkthrough lp_run
- Code walkthrough lambda_sweep_simplex
- Running a sweep end to end
- Log lines and output files
- Deck and charts pipeline
- Installation of Julia
Reference
- Lambda sweep method
- Pharmacy service access
- Pharmacy results September 2026
- Decision log
- Alternatives not pursued
- FAQ
- Glossary
- Service allocation procedure
External