Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Deterministic Regression Suite

The examples/deterministic/ directory contains hand-built regression cases that anchor the solver against analytically derived expected costs. Each case has minimal stochastic structure (typically a single scenario per stage) so the optimal cost is computable by hand and used as a fixed-point reference in the test suite. Cases are numbered sequentially, one per modeled feature.

These cases are not intended for production-style policy training. They are regression anchors: any change to the solver, LP builder, or stochastic pipeline that perturbs a deterministic case cost is flagged as a behavioural change. The test suite runs all cases under cargo nextest run --workspace and compares each result against its stored expected cost.

The suite covers a progression from the simplest thermal-only system through the modeled features; new features add cases at the end of the sequence.

Case Index

DirectoryFocusNotes
d01-thermal-dispatchThermal-only dispatchNo hydro plants; establishes the cheapest baseline cost.
d02-single-hydroSingle hydro plantMinimal hydro case with constant productivity.
d03-two-hydro-cascadeTwo-plant hydro cascadeVerifies cascade water-balance: outflow from upstream plant becomes inflow to downstream.
d04-transmissionTransmission constraintsAdds a transmission line with binding capacity to verify flow limits and marginal costs.
d05-fpha-constant-headFPHA with precomputed hyperplanes (constant head)Hydro generation modelled via precomputed FPHA hyperplanes; head is fixed so hyperplanes degenerate to a single plane.
d06-fpha-variable-headFPHA with precomputed hyperplanes (variable head)Head varies with reservoir level; verifies multi-plane FPHA selection and average-storage constraint.
d07-fpha-computedFPHA in computed modeFPHA hyperplanes generated from hydro geometry at solve time rather than precomputed.
d08-evaporationReservoir evaporationLinearised surface-area evaporation loss; verifies water-balance accounting of evaporated volume.
d09-multi-deficitMultiple deficit busesMore than one bus with potential supply shortfall; verifies independent deficit variables per bus.
d10-inflow-nonnegativityInflow non-negativityTests the inflow non-negativity enforcement methods when PAR(p) noise can produce negative samples.
d11-water-withdrawalWater withdrawalVerifies volumetric water withdrawal from a reservoir modelled as a non-generation outflow demand.
d12-par-annualPAR(p)-A annual order selectionRegression case for PACF-based annual order selection (pacf_annual) in the PAR(p) inflow fitting pipeline.
d13-generic-constraintGeneric linear constraintRegression case for user-defined generic linear constraints across system entities.
d14-block-factorsBlock load and generation factorsVerifies per-block scaling factors applied to load and generation limits across intraday blocks.
d15-non-controllable-sourceNon-controllable source (NCS)Regression case for stochastic non-controllable generation with availability factors.
d16-par1-lag-shiftPAR(1) lag-shiftVerifies correct lag indexing when fitting PAR(1) models with a non-zero season offset.
d17-evaporation-mixed-signMixed-sign evaporation coefficientsVerifies that monthly evaporation coefficients can be negative (net rainfall) or positive (evaporation loss) and that the signed evaporation-outflow variable absorbs both without triggering violation slacks.
d19-multi-hydro-parMulti-hydro PAR(p) inflowRegression case for PAR(p) fitting applied to multiple hydro plants simultaneously.
d20-operational-violationsOperational violation penaltiesVerifies penalty cost accounting when operational limits (e.g., min outflow) are relaxed with a penalty.
d21-min-outflow-regressionMinimum outflow constraintRegression case confirming minimum turbine outflow constraints are respected in dispatch.
d22-per-block-min-outflowPer-block minimum outflowMinimum outflow constraints applied individually to each intraday load block.
d23-bidirectional-withdrawalBidirectional water withdrawalWater withdrawal that can both remove from and return flow to a reservoir within the balance equation.
d24-productivity-overrideProductivity model overridePer-plant override of the default hydro productivity model via hydro_production_models.json.
d25-discount-rateNon-zero discount rateVerifies that a positive annual discount rate is applied correctly to inter-stage cost accumulation.
d26-estimated-par2Estimated PAR(2) modelRegression case for PAR(2) inflow fitting from historical scenario data.
d27-per-stage-thermal-costPer-stage thermal costThermal units with costs that vary by stage; verifies stage-indexed cost lookup in the LP.
d28-decomp-weekly-monthlyWeekly-to-monthly decompositionStage pattern with weekly substages grouped into monthly master stages.
d29-weekly-par-noise-sharingWeekly PAR(p) with noise-group sharingSame-month weekly stages share a single noise-group draw so PAR(p) noise is consistent within the month.
d30-multi-resolution-monthly-quarterlyMonthly-to-quarterly multi-resolutionMulti-resolution study mixing monthly and quarterly stages; exercises downstream-lag accumulation across resolutions.
d31-backwater-reference-volumeComputed FPHA with backwater tailrace familiesExercises the computed-FPHA + system/tailrace_curves.parquet + reference_volume pipeline end-to-end; validates that backwater families are selected by downstream stage reference level and that the fitted planes match the expected generation within tolerance.
d32-reversible-plantPumped-storage / reversible plantA pumping station moves water between two reservoirs as a per-block pumped flow and draws power from a bus; verifies pumped-flow water-balance coupling and pumping cost.
d33-per-stage-block-countsPer-stage block countsStages with differing intraday block counts; verifies per-stage LP geometry when the block count varies across the horizon.
d34-anticipated-varying-blocksAnticipated thermal with varying block countsAnticipated (pre-committed) thermal whose commitment matures at an interior stage whose block count differs from stage 0; backstops the relocation of the anticipated-state column out of the per-block region.
d35-pumping-commissioningPumping-station commissioning windowPumping station with an entry/exit commissioning window; verifies a dormant station emits zero pumped flow and an active one reaches the simulation output.
d36-thermal-line-commissioningThermal and line commissioning windowsThermal units and transmission lines with commissioning windows; a dormant entity pins its generation or flow bounds to zero while keeping the LP feasible.
d37-anticipated-commissioningAnticipated thermal with a commissioning windowCombines an anticipated thermal with a commissioning window; verifies decision and operation gating across the dormancy boundary and warm-start survival.
d38-dead-volume-fillingHydro dead-volume fillingReservoir filling phases (pre-filling, filling, operating) with per-stage soft storage floors; verifies the filling slacks and the pre-filling cascade short-circuit reach the simulation output.
d39-prefilling-upstream-of-fillingPre-filling upstream of a filling reservoirAn upstream reservoir still pre-filling above a downstream reservoir already in the filling phase; verifies the pre-filling water short-circuit routes onto a downstream that carries its own filling floor.
d40-filling-cascadeTwo reservoirs filling simultaneouslyA cascade with two reservoirs in the filling phase at the same stages; verifies each carries its own per-stage soft floor and the two couple only through normal cascade releases.

Running the Suite

The deterministic cases are included in the standard workspace test run:

cargo nextest run --workspace

Each case is driven by a test that loads the directory, runs training and simulation, and compares the result against the expected cost stored in the test source. Cases with longer runtimes are gated behind the slow-tests feature flag and are skipped in the default run.