feat: collapse regional producers into one PDL-derived archetype (#33) - #39
Open
Hackatro wants to merge 7 commits into
Open
Conversation
One producer recipe, sidecar roster, output names follow brazil_farms / ArgentinaFarms / UsFarms. Values unchanged vs the byte-for-byte gate.
Sponn
reviewed
Aug 26, 2026
| "Result_Simulator_FeedManufacturers": ("feed_manufacturers", ["quantity_available", "unit_price"]), | ||
| "Result_Simulator_FeedTraders": ("feed_traders", ["quantity_available", "unit_price"]), | ||
| "Result_Simulator_EuFarmers": ("eu_farmers", ["feed_received", "livestock_output", "active"]), | ||
| "Result_Simulator_BraFarmers": ("brazil_farms", list(_PROPS_BY_ROLE[ROLE_PRODUCER])), |
Contributor
There was a problem hiding this comment.
Why are there still the explicit mentions for brazil_farms etc. in the code here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #33.
What this does
Three producer types were hardwired by country name, and a single pooled wholesaler
could buy from any of them. That wholesaler — not the European port — was where
"buy Brazilian or buy American" got decided.
This PR:
farms, derived from the PDL rather than named in Python
throughput instead of summing whatever arrives
graph and the exported map all derive from the scenario file
The behaviour to look at
Rotterdam handles 500 t/step; the three lanes deliver ~1,800 t. It has to turn volume
away, and price now decides which.
Under the drought cascade the cheapest lane changes twice, and the admitted mix
follows: 100% Brazil → 100% Argentina (day 0) → 100% US (day 45).
Guarded by
tests/test_transport_routing.py, which asserts US > 0 and Brazil ==Argentina == 0 at day 45.
Brazil does not vanish from Europe — Paranaguá still runs to Hamburg (300 t → 180 t),
and the Brazil originator's storage utilisation drops 35% → 21%.
Removed
SYNTHETIC,SYNTHETIC_NAMES, the synthetic-hub overlay, theFLOW_ADJACENCYliteral,
SYNTHETIC_PLACEMENTS, and the bespoke per-origin sea-lane methods.A node reaching the exporter with no resolvable metadata now raises instead of being
silently skipped — that failure previously looked identical to "the wholesalers
disappeared."
Verify
Exports 14 nodes / 14 edges, all derived.
Suggested review order
agents/trader.py— the regional originatoragents/transport.py— Rotterdam's demand target and cheapest-first admissiontopology.py— roster + flow derivation, and_pdl_stage_pairsorderingexport_bundle.py— roster-derived node metadataKnown gaps, deliberately not fixed here
lane alone exceeds 500 t, the top-up branch never fires and Rotterdam buys from one
lane at a time. This is a faithful consequence of the current pricing model, not a
coding defect. Whether it is the intended model behaviour is an open question —
happy to discuss on the PR.
+15% supply and +25% price; only the supply half binds. Pre-existing.
nothing to substitute from, it always takes exactly what its region produced.
Carried to Make transport roles and routing fully PDL-derived #38.
Scope note
Two visualisation helper scripts (
visualize_csv.py,visualize_sql.py) and theSQLite post-processing path in
main.pywere removed during the session. That wasnot in the issue scope and is mixed into this range. Nothing references them any
more — flagging it so the wider-than-expected diff isn't a surprise.
Follow-up
#38 (
38-make-transport-roles-and-routing-fully-pdl-derived) takes the identity half:the eight place-named transport roles, the remaining hardcoded model-list lookups, and
the full routing test. Steps 14–15 already landed there.