Skip to content

refactor: derive agent counts from the PDL, one entity one agent (#37) - #44

Open
Hackatro wants to merge 1 commit into
mainfrom
37-pdl-literal-agent-counts-n1-and-wholesaler-passthrough
Open

Hackatro wants to merge 1 commit into
mainfrom
37-pdl-literal-agent-counts-n1-and-wholesaler-passthrough

Conversation

@Hackatro

Copy link
Copy Markdown
Contributor

#37 — PDL-literal agent counts (n=1) and consumer split

One PDL entity is now one agent. The n_* count columns are gone from scenario.py and both scenario CSVs, count_attr is gone from topology.py and model.py, and the pooled eu_farmers list is split into poultry_farms, pig_farms and dairy_farms: three roster entries named after their entity ids, exactly like producers and wholesalers. Wholesaler economics are untouched.

Scenario 0, final period

Before After
Produced 2300 t 300 t
Delivered to processors 800 t 300 t
soy_price 523.41 673.20
feed_price 1263.00 2618.81
Transport utilisation 0.50 0.14
Producer unit prices (BRA/ARG/US) 396 / 462 / 528 unchanged

Findings

  • Bugfix: _step_consumer divided the traders' feed by the agents in its own list, which after the split would have delivered three times the feed produced.
  • Prices rise because fixed costs are per-agent and throughput fell tenfold.
  • No capacity binds any more. Reasoning, not measurement: Argentina and the US alone offered 1300 t into a Rotterdam lane capped at 500, so a Brazilian drought left delivered volume there unchanged and only the Hamburg branch responded. At n=1 there is no surplus, so a supply shock now passes through the chain proportionally.

Follow-ups being filed

  1. Chain constants — capacities, SEA_CAPACITY, base_yield and the fixed_costs_* are calibrated against agent counts that no longer exist.
  2. Consumer modelling: consumers ignore PDL impacts aimed at them (livestock_pressure declares supply −9% / price +20% on poultry_farms), and the feed share assumes all consumers share one upstream.

- Agent counts came from n_* scenario columns the PDL does not contain. setup_agents(1) now populates one agent per roster entry.
- The pooled eu_farmers list splits into poultry_farms, pig_farms and dairy_farms, named after their entity ids like producers and wholesalers
- _step_consumer divided trader feed by the agents in its own list, derived from the foster.
- shock_ramp_steps is deleted alongside the eight n_* columns
- wholesaler economics untouched
@Hackatro Hackatro linked an issue Sep 11, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PDL-literal agent counts (n=1) and wholesaler passthrough

1 participant