nhra_gt.rules¶
Modular Rules Engine for NHRA simulation.
This module defines the policy rules (caps, audits, eligibility, reconciliation) as JAX-compatible PyTrees. This allows rules to be swapped dynamically and for gradients to flow through rule logic during optimization.
Classes¶
CapRule
¶
Handles growth cap logic for Commonwealth funding.
Supports both 'Hard' (strict limit) and 'Soft' (marginal reduction) caps.
Source code in src/nhra_gt/rules.py
Functions¶
apply(nwau_growth)
¶
Calculate the cap effect on funding share.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nwau_growth
|
float
|
The realized growth in NWAU relative to baseline. |
required |
Returns:
| Type | Description |
|---|---|
float
|
A multiplier (0.0 to 1.0) to be applied to the marginal funding. |
Source code in src/nhra_gt/rules.py
AuditRule
¶
Handles integrity and audit pressure logic.
Defines how coding intensity translates into detection risk or financial penalties.
Source code in src/nhra_gt/rules.py
Functions¶
evaluate(coding_intensity, active_pressure)
¶
Calculate the probability of detection or audit penalty.
Source code in src/nhra_gt/rules.py
EligibilityRule
¶
Determines NWAU eligibility and activity stream partitioning.
Defines the boundary between Activity Based Funding (ABF) and Block funding.
Source code in src/nhra_gt/rules.py
Functions¶
get_abf_share(venue_shift_strat)
¶
Determines the share of activity that remains in ABF.
Source code in src/nhra_gt/rules.py
ReconciliationRule
¶
Handles annual financial true-ups and emergency transfers.
Simulates the "Safety Net" or bailout mechanisms triggered by system pressure.
Source code in src/nhra_gt/rules.py
Functions¶
calculate_bailout(current_pressure, month_growth_factor)
¶
Calculates the bailout amount based on system pressure.
Source code in src/nhra_gt/rules.py
Functions¶
initialize_rules(p)
¶
Ensures all rule objects are initialized in a Params object.