nx_caplab_supply.nx
buildroot/runtime/nx_caplab_supply.nx
about
nx_caplab_supply.nx -- Capitalism Lab R2: production / supply chains.
Firms don't conjure finished goods at a magic unit cost -- they convert raw
materials through factories into finished products, and the input costs ROLL
UP into the unit cost that R0/R1 price against (CLAUDE.md "no magic numbers").
This rung adds: (1) unit-cost rollup across a recipe (inputs + processing),
composable stage-by-stage into a chain (raw -> intermediate -> finished), and
(2) throughput limited by the SCARCEST input (the bottleneck). Integer, pure.
MODEL:
unit_cost = processing_cost + sum_i (qty_per[i] * input_price[i])
throughput = min_i ( stock[i] / qty_per[i] ) over inputs with qty_per>0
chain = feed a stage's unit_cost in as the next stage's input price
nx_safety_envelope:
intended_use: capitalism-lab production core (pure functions, no I/O)
sil_target: SIL1
verdict: NOT_YET_EVALUATED
genealogy_id: capitalism_lab_supplychain_canon
lineage_id: nx_caplab_supply_v1
dependencies 2 imports · 3 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_caplab_supply_test.nxnx_cost_decompose.nxnx_econsim_page.nx
structs
| none |
consts
| none |
functions
| 29 | func nx_clab_unit_cost(n_inputs: nx_int, qty_per: *i64, price: *i64, |
| 43 | func nx_clab_throughput(n_inputs: nx_int, qty_per: *i64, stock: *i64) -> nx_int |