Routing reference skips exits behind a full path too; #210 test checks the answer; CHANGELOG for players

The reference loop now states the rule #225 adds to compute(): without Auto-TE an exit whose shortest path is already full fits nothing, like a full exit. With the same rule both match bit for bit; before, only float rounding differed (at most 3.6e-14 relative), because the ECMP split no longer counts a dead exit's room.
This commit is contained in:
Frederic Jung 2026-10-31 07:10:27 +01:00
parent 8c2dd05d0b
commit 928d6f0111
No known key found for this signature in database
3 changed files with 8 additions and 2 deletions

View file

@ -6,7 +6,7 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
- Saturated shortest paths are skipped during the candidate exit scan and usable exit filtering, preventing routing freezes on congested networks (#210).
- Big networks freeze for less on every game day and every click: working out where traffic goes skips exits whose route is already full, so a game day takes about 40% less time (#210). Traffic goes exactly where it went before.
- Premium submarine terminals and Optical engineering can no longer be bought on a cable where they would change nothing (#198). The button now says so, and an upgrade that only helps together with the other one stays available.
- A wave size that is sold out on a route can no longer be reached by upgrading a smaller wave on it (#201). The upgrade button says how long it is sold out, just like when buying.
- Choosing Both for a PNI with one member now really splits it: the second member arrives in the other building when the augment lands, instead of joining the first (#219).

View file

@ -1,12 +1,14 @@
// Deliberately scan all exits for every flow, without byRank, local-city
// shortcuts or first-group selection. Stable sorting preserves E order on ties.
// Without Auto-TE, an exit whose shortest path from this POP is already full fits nothing, so it counts as
// unusable, like a full exit (#210).
module.exports = `
for(const pass of PASSES||[null])for(const rank of RANKS){
for(f of flows){
if(f.rem<=1e-6||(rank===0&&!f.cache)||(pass&&!pass(f)))continue;
Dv=SDi[f.ci];Pv=SPi[f.ci];PP=walked[f.ci]||(walked[f.ci]=[]);vis++;
const candidates=E.filter(e=>e.used<e.cap&&e.ok(f.n)&&
(TR?eff(e,f.n):base(e,f.n))===rank&&Dv[CIDX[e.city]]<Infinity)
(TR?eff(e,f.n):base(e,f.n))===rank&&Dv[CIDX[e.city]]<Infinity&&!gone(e))
.sort((a,b)=>(a.pref==='high'?0:1)-(b.pref==='high'?0:1)||Dv[CIDX[a.city]]-Dv[CIDX[b.city]]);
for(let i=0;i<candidates.length&&f.rem>1e-6;){
let j=i+1;while(j<candidates.length&&(candidates[j].pref==='high')===(candidates[i].pref==='high')&&

View file

@ -1390,6 +1390,10 @@ test('#210 candidate exits on saturated shortest paths are skipped to avoid fall
ev("S.links.push({id:'x1',a:'fra',b:'par',kind:'wave',tier:0,km:450,mult:1,mo:1000,ready:0,cut:0});");
ev("compute();");
assert.ok(ev("R.load['x1'] >= 10 - 1e-6"), 'intercity wave is saturated');
assert.ok(ev("R.load['x1'] <= 10 + 1e-6"), 'and carries no more than it can');
// Skipping exits behind the full wave changes nothing: routing again gives the same answer.
const first = ev('JSON.stringify([R.served,R.citySrv,R.load])');
ev("compute();");
assert.equal(ev('JSON.stringify([R.served,R.citySrv,R.load])'), first);
assert.deepEqual(errors, []);
});