code wiki / (root) / nx_caplab_supply.nx

nx_caplab_supply.nx

buildroot/runtime/nx_caplab_supply.nx

2221 B56 linesdepth 2pulls 2 transitivereach 3 importersview sourcekind librarytopic caplab
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_tier.nx nx_caplab_supply.nx nx_caplab_supply_test.nx nx_cost_decompose.nx nx_econsim_page.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_caplab_supply_test.nxnx_cost_decompose.nxnx_econsim_page.nx

structs

none

consts

none

functions

29func nx_clab_unit_cost(n_inputs: nx_int, qty_per: *i64, price: *i64,
called by 3: mainmainmain
43func nx_clab_throughput(n_inputs: nx_int, qty_per: *i64, stock: *i64) -> nx_int
called by 2: mainmain