Driver supply, end to end¶
Every layer of the library on one decision, so the pieces are forced to compose:
- fit — an incentive response estimated from logs whose behaviour policy chased a confounder, once naively and once with the backdoor adjustment;
- plan — constrained optimal control with a Grönwall error tube over its RK4 steps, a bound
under the per-step error it is given (
causal_plan); - certify — the plan priced against a partially identified effect (
certify_safety); - audit — each plan then executed on the true plant, so the numbers a caller would have trusted offline can be compared with what actually happened.
The plant is two zones of a mobile driver pool. Incentivising zone A pulls drivers out of zone B —
the [+b, -b] control column is driver conservation, the interference channel — zone B drains on
its own, and the barrier is a supply floor there. So the objective and the constraint pull against
each other through the only lever available, which is what makes the certificate load-bearing
rather than decorative.
uv run python scripts/spine_demo.py
What it printed when this site was built:
== two-zone driver supply, true incentive gain b = +1.000 ==
arm b_hat planned J true J certified Gamma*
------------------------------------------------------------
naive -0.200 13.591 39.022 7/25 1.788
causal +1.001 12.514 12.514 6/25 3.344
the naive arm plans a cost of 13.59 and pays 39.02 on the real plant; the causal arm's plan is worth what it says (12.51 planned, 12.51 paid).
Gamma* separates them offline, before either acts: along the causal plan's path an admissible action meets the supply floor's barrier condition up to the marginal sensitivity model's Gamma 3.34, along the naive one's only to 1.79 -- a warning that needs no ground truth.
Gamma* is the problem's ceiling along the path, not the plan's: the causal plan's own actions are certified for 6 steps, over which the true plant stays safe (min h = +0.300); past them it crosses the floor at step 16: the certificate audits the floor, and this solve does not hold it.
Read the Gamma* column: it is computed offline, before either arm acts on the plant, and needs no
ground truth. See certificates for what it does and does not
certify.
The plant is deliberately control-affine: certify_safety reads the channel off the Jacobian at
u = 0, which is exact for an affine plant and only a linearisation otherwise. Code:
chc.spine.