discopt.stochastic.extensive_form#
Extensive form (deterministic equivalent) of a two-stage stochastic program.
Builds the single monolithic model min c·x + risk_s[ Q_s(x) ] by calling a
scenario-creator callback once per scenario (the mpi-sppy / PySP pattern): the
callback constructs that scenario’s second-stage variables and constraints (given
the realized data) and returns its recourse cost expression. The risk measure
(risk) then assembles the objective.
This is correct by construction (an exact deterministic equivalent), so it is the
Phase 0 baseline and the oracle the decomposed methods (L-shaped, PH) are checked
against. See docs/dev/stochastic-module-plan.md §1, §3.
Classes#
Result of |
Functions#
|
Assemble the deterministic-equivalent objective onto |
Module Contents#
- class discopt.stochastic.extensive_form.ExtensiveForm#
Result of
build_extensive_form()(kept for inspection/testing).- scenario_costs: list[discopt.modeling.core.Expression]#
- objective: discopt.modeling.core.Expression#
- discopt.stochastic.extensive_form.build_extensive_form(model: discopt.modeling.core.Model, *, scenarios: discopt.stochastic.scenario.ScenarioSet, recourse_builder, first_stage_cost: discopt.modeling.core.Expression | None = None, risk: discopt.stochastic.risk.RiskMeasure | None = None, minimize: bool = True) ExtensiveForm#
Assemble the deterministic-equivalent objective onto
model(in place).- Parameters:
scenarios – The probability-weighted scenario set.
recourse_builder – Callable
(model, scenario_data, s) -> recourse_cost_expr. It must create scenarios’s second-stage variables (uniquely named, e.g. suffixed bys) and add its recourse constraints tomodel, returning the scenario’s recourse cost expression (to be minimized in expectation / risk).first_stage_cost – The here-and-now cost
c·x(default 0).risk – A
RiskMeasure(defaultExpectation).