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:
parent
8c2dd05d0b
commit
928d6f0111
3 changed files with 8 additions and 2 deletions
|
|
@ -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')&&
|
||||
|
|
|
|||
|
|
@ -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, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue