Expand description
Welfare economics primitives: social welfare functions, inequality and poverty metrics, cost-benefit analysis with distributional weights, and a needs/survival-floor allocation model.
§Allocation class
All kernels here are AllocationClass::HotZeroHeap. Sorting scratch uses
fixed-capacity stack arrays ([f64; MAX_POPULATION]) or caller-provided
output buffers — never Vec, String, or Box. No allocation occurs on
any path, hot or cold, within this module.
§Rights-affecting use
Poverty metrics, distributional weights, and the survival-floor allocation
model can inform decisions that affect entitlements, transfers, or access.
Those uses MUST be paired with SHACL/deontic checks (see deontic_logic.rs
opcodes OP_OBLIGATE/OP_FORBID/OP_PERMIT) and capacity-modalities
review before any UI exposure or downstream action. The repr(C) report
structs returned by rights-affecting functions carry diagnostics and
assumptions, not just a scalar, so callers can audit the basis of a
computed allocation. No function in this module performs or recommends an
external action on its own.
Structs§
- Welfare
Report - Report returned by rights-affecting welfare kernels.
Enums§
- Welfare
Error - Welfare kernel error vocabulary.
Constants§
- ASSUMPTION_
DEGENERATE - Assumption flag: result is degenerate (e.g. zero-mean population for Gini).
- ASSUMPTION_
FLOOR_ CLAMPED - Assumption flag: at least one observation was clamped to the survival floor.
- ASSUMPTION_
LINE_ ABOVE_ MAX - Assumption flag: poverty line is above the maximum observed income.
- ASSUMPTION_
WEIGHTED - Assumption flag: distributional weights were applied (CBA only).
- MAX_
POPULATION - Maximum population size supported by stack-array scratch buffers.
Functions§
- atkinson_
inequality - Atkinson inequality index with inequality-aversion parameter
epsilon > 0. - distributional_
npv - Distributional NPV: NPV with per-period distributional weights.
- gini_
coefficient - Gini coefficient in
[0, 1]via the mean-absolute-difference formula: - headcount_
poverty - Headcount poverty: returns
(count_poor, headcount_ratio)wherecount_pooris the number of observations strictly belowpoverty_lineandheadcount_ratio = count_poor / n. - lorenz_
curve_ into - Write the Lorenz curve as interleaved
(cumulative_population_share, cumulative_income_share)pairs intoout:[pop0, inc0, pop1, inc1, ...], sorted ascending by income. Returns the number of points written. - nash_
welfare - Nash social welfare: the product of utilities,
prod_i u_i. - net_
present_ value - Net present value:
NPV = sum_{t=0}^{n_periods-1} (B_t - C_t) / (1+r)^t. - poverty_
gap_ ratio - Poverty gap ratio:
sum(max(0, line - income)) / (n * line). - rawlsian_
welfare - Rawlsian (minimax / maximin) social welfare:
min_i u_i. - survival_
floor_ allocation_ into - Allocate a fixed budget
budgetacrossneedsso that each recipient first receives their survival floorfloors[i], then the residual is distributed proportionally to surplus needneeds[i] - floors[i]. - utilitarian_
welfare - Utilitarian (sum) social welfare:
sum_i u_i.