Skip to content

Resource-limited optimization

See the Japan report dictionary for every output column, annualization rule, and failure value.

This example combines state-region resource potential, arable land, banned non-economic building groups, and an era-5 technology cap. It uses selected Japanese states to demonstrate a reusable GDP optimization under autarky for employment caps from one million to one hundred million.

employment_cap annual_gdp employment gdp_per_capita construction_cost arable_land_consumption
1000000 42703087.87793275 999999.9999999998 42.70308787793276 170660.96630680584 0.0
2000000 73526769.38362674 1999999.9999999998 36.76338469181338 547375.6423712291 0.0
3000000 103472467.60647747 2999999.9999999995 34.4908225354925 1005828.0850718003 0.0
4000000 133361640.9064289 4000000.0 33.340410226607226 1392806.377528916 0.0
5000000 163196505.01788625 4999999.999999999 32.63930100357726 1817967.0034367465 0.0

Download artifacts/analyses/optimization/japan/employment_sweep.csv ยท View examples/optimize_jap.py

uv run python -m examples.optimize_jap

How the constraints compose

flowchart LR
    regions[Selected Japanese states] --> resources[Resource building limits]
    regions --> land[Arable land cap]
    resources --> scenario[Scenario]
    land --> scenario
    employment[Employment cap sweep] --> scenario
    scenario --> solver[NominalOptimizer]
    solver --> results[GDP and building levels]

The important implementation pattern is that state-region helpers return ordinary limits consumed by Scenario; the optimizer does not need a country-specific code path. See the optimization guide and optimization API.