Roadmap¶
Ultimate goal (
AGENTS.md): parse Victoria 3 game data into structured formats, simulate the economy mechanics, and provide a tool for optimising production chains.
Project foundation & parsing layer¶
- Initial scaffolding:
-
uvtoolchain -
pyproject.toml - MkDocs Material docs
- GitHub Actions CI
-
examples/scripts -
tests/suite - Core parsers:
-
common/buildings -
common/building_groups -
common/goods -
common/production_methods -
common/production_method_groups -
common/technology -
common/buy_packages -
common/pop_needs -
map_data/state_regions. -
parse_mergeutility: UTF-8-SIG read,?=/!=neutralisation, multi-file merge into apyradox.Tree. -
get_vic3_directory()auto-detection across Steam library paths on Windows / Linux / macOS.
Production optimisation (LP-based)¶
-
ProductionUnit,production_table()for production-chain modelling. -
Economy,EconomyStatefor general-equilibrium economy modelling. -
NominalOptimizerforscipy.optimize.linprogoptimisation over building levels with named objectives, throughput bonuses, and fluent constraint builders. - Architecture refactor:
Scenariois immutable configuration data; public siblingNominalOptimizerandMarketOptimizerclasses inherit shared context and constraint compilation fromBaseOptimizer. Their inspectableLinearProblem/MarketProblemobjects keep formulation, solving, dual lookup, and optimizer-backed analysis consistent.
Documentation & agent infrastructure¶
- MkDocs Material site with auto-generated API reference (
mkdocstrings) andusage/parse.md,usage/analysis.mdguides. -
AGENTS.mdagent instructions with external file-loading protocol. -
docs/project_structure.mdper-folder map.
Vanilla sync cadence¶
- Adapted parsed CSV snapshots to vanilla versions (historical releases):
-
1.13.1 -
1.13.8 -
1.13.9 -
1.13.11
General-equilibrium economy model¶
- Implement the
Economyclass as a solver state for iterative equilibrium computation. - Implement the solver method for nominal price
- Implement the solver method with market price mechanics
- Implement
MarketOptimizerfor bounded endogenous-price GDP and GDP-per-capita scenarios - Implement
EquilibriumOptimizerfor bounded building-level searches maximizing GDP, GDP per capita, or average wealth, with endogenous household demand and verified equilibrium states - Implement
SupplyChainEquilibriumOptimizerfor fixed-recipe chain-level searches with transformed constraints and verified building equilibria - Implement the solver method with population composition and wealth levels
Supply chain analysis (nominal)¶
The nominal supply-chain toolkit is implemented as the
analysis/supply_chain/ package and deliberately analyzes one terminal good
per solve.
-
Scenariodataclass (now inoptimize/scenario.py): an optimisation recipe as data (goods-balance floor and fixed import/export orders, objective, banned PMs / buildings / building groups, per-building level caps, throughput multipliers, era / construction-cost / employment caps, minimum net infrastructure surplus, urban-center tie). -
SupplyChainAnalyzervalidates positive terminal exports and an enabled balance floor, then performs exactly one nominal solve. - Immutable
SupplyChainResultsnapshots matrices, state arrays, production metadata, graphs, and solver diagnostics. - Cyclic bipartite NetworkX graphs provide
realizedand scenario-staticallowedviews without treating cycle cutoffs as raw resources. - Stable DataFrame reports cover goods, processes, flows, workforce, constraints, bottlenecks, and alternative producers.
- Process-level coproduct attribution is exact; no implicit good-level allocation policy is applied.
- Mermaid and Matplotlib renderers return in-memory objects and prune large allowed views deterministically.
-
sweep_supply_chains()sets minimum base-price export targets for all producible goods, retains economy order, and records failures while continuing sequentially. - Synthetic tests cover cycles, coproducts, alternatives, imports, resources, throughput bonuses, infeasible/unbounded cases, stable schemas, visualization objects, and sweeps without requiring a game installation.
Pop consumption & wealth loop¶
- Integrate
buy_packages(per-wealth pop-need baskets),pop_needs(per-need goods baskets), andpop_types(per-profession wealth) into the economy model so demand reflects population composition and wealth levels rather than exogenous inputs.
State-region resource constraints¶
- Use
StateRegionsParsertotal-potentialresource_*columns to cap building levels for resource-limited buildings (gold, oil, iron, ...) inNominalOptimizer.