Rolling recourse API

Rolling policy with annual operational recourse.

The first year comes from a fixed nominal plan. Later years are re-solved with the rolling persistence forecast. In the recourse case, each year’s first-year actions are deferred by lowest first-year risk reduction per hour when observed budget or capacity is exceeded.

class brushline.strategic.rolling_recourse.RollingCaseSummary(*, name: str, budget_violation_probability: Annotated[float, Ge(ge=0), Le(le=1)], capacity_violation_probability: Annotated[float, Ge(ge=0), Le(le=1)], cost_band: RecourseBand, hours_band: RecourseBand, risk_band: RecourseBand, completion_band: RecourseBand, mean_deferred_actions: Annotated[float, Ge(ge=0)], mean_deferred_hours: Annotated[float, Ge(ge=0)], mean_risk_loss: Annotated[float, Ge(ge=0)])[source]

Bases: BaseModel

Summary for one policy case.

model_config = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

exception brushline.strategic.rolling_recourse.RollingRecourseError[source]

Bases: ValueError

Raised when rolling-recourse inputs are inconsistent.

class brushline.strategic.rolling_recourse.RollingRecourseResult(*, schema_version: Literal['brushline.rolling-recourse.v1'] = 'brushline.rolling-recourse.v1', instance_id: str, episodes: Annotated[int, Ge(ge=1)], seed: int, years: list[int], solver: Literal['exact', 'heuristic'], lookahead_years: Annotated[int, Ge(ge=1)], cases: list[RollingCaseSummary], created_utc: datetime)[source]

Bases: BaseModel

Four-policy rolling-recourse comparison.

model_config = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

brushline.strategic.rolling_recourse.evaluate_rolling_recourse(*, instance_id: str, plan: StatefulPlan, segments: list[StatefulSegment], methods: list[StatefulMethod], periods: list[StatefulPeriod], config: StatefulConfig | None = None, episodes: int = 20, seed: int = 7, solver: Literal['exact', 'heuristic'] = 'exact', heuristic_iterations: int = 100, lookahead_years: int = 2, created_utc: datetime | None = None) → RollingRecourseResult[source]

Compare static, fixed-future recourse, rolling-only, and rolling recourse.