feat(forlop): start the time course in the backlog given in the file
forlop.py now puts the backlog from the input file straight into the model at the time the numbers apply, instead of letting the model build it up itself (which reached at most 15 months and left larger backlogs "ikke regnet"). It carries its own copy of the simulate_endo loop (simuler, policies koord and sched) and checks on every run that the copy matches sim.py bit for bit. sim.py and paper/data are untouched (22/22 data files identical after a fresh run). The example file gives the same numbers as before (+19 %, +12 %, 1,31; 8,3 / 0,74 / 1,10 / +31 % / 3,5; 68,7 / 0,65 / 1,26). A copy with backlog 3000 now gives a course starting at 3 000 (+119 %). The course is not computed when crime falls below 0,80 or police effort below 0,50 in the model while the backlog is cleared. Independent review before commit: 8 findings, 7 fixed (the eighth is an older column-width issue for seven-digit numbers). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
3b1fa8325c
commit
2badc25e51
4 changed files with 172 additions and 45 deletions
|
|
@ -18,7 +18,7 @@ Concept note (Norwegian, LaTeX) and its simulation code. The principle: enforcem
|
|||
- Setup: `python3 -m venv .venv && .venv/bin/pip install -r requirements.txt`
|
||||
- Run simulation (about 2 min, from `paper/`): `../.venv/bin/python sim.py`
|
||||
- Bottleneck diagnosis from own numbers (stdlib only, from `paper/`): `python3 diagnose.py eksempel_domstol.json`; must reproduce section 9.5 (utilization 1,28, +19 % capacity). `python3 diagnose.py norge_2025.json` must match the table in README (1,09 / 1,04 / 0,88 / 1,09).
|
||||
- Time course and stability check from own numbers (needs the venv, from `paper/`): `../.venv/bin/python forlop.py eksempel_domstol.json`; must reproduce section 9.5 and table 10 (critical delay 7,2; +19 % now, +12 % after 12 months, capacity 137,9 = 1,31; with measures 8,3 / 0,74 / 1,10 / +31 % / 3,5; without 68,7 / 0,65 / 1,26). `forlop.py` imports `sim.py` and must never require a change there.
|
||||
- Time course and stability check from own numbers (needs the venv, from `paper/`): `../.venv/bin/python forlop.py eksempel_domstol.json`; must reproduce section 9.5 and table 10 (critical delay 7,2; +19 % now, +12 % after 12 months, capacity 137,9 = 1,31; with measures 8,3 / 0,74 / 1,10 / +31 % / 3,5; without 68,7 / 0,65 / 1,26). A copy of the example with `restanse` 3000 for Domstol must give a course that starts at 3 000 (first decision +119 %, as `diagnose.py`). `forlop.py` imports `sim.py` and must never require a change there. It has its own copy of the `simulate_endo` loop (`simuler`, policies `koord` and `sched` only) so that the backlog in the file can be put in directly; every run checks that the copy matches `simulate_endo` bit for bit, so a change to `simulate_endo` must be mirrored in `simuler`.
|
||||
- Reproduction check after a run: `git status paper/data` shows no changes (verified 2026-11-10: 22/22 files identical with Python 3.14.0, numpy 2.5.4, scipy 1.18.1)
|
||||
- LaTeX build (from `paper/`, TeX Live 2026 in `/Library/TeX/texbin`): `pdflatex main.tex` and `pdflatex notat.tex` three times each, `xelatex karusell.tex` twice; copy to `pdf/` (verified 2026-11-10: main 58 pages, notat 2, karusell 16, no undefined references). Build in a scratch copy of `paper/` to keep aux files out of the repo, and give each run a time limit: one pdflatex run has been seen to hang.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue