LineCommitment struct
#include <gtopt/line_commitment.hpp>
Marks a Line as an OTS switching candidate (issue #509).
Links to a Line and exposes the binary status variable u_l ∈ {0, 1} that the LP can flip to open or close the circuit. The LP rows emitted by LineCommitmentLP (see line_commitment_lp.hpp) are:
Capacity gating (always emitted, both Kirchhoff and transport):
−F^max_ba · u_l ≤ f_l ≤ F^max_ab · u_l
so
u_l = 0⇒f_l = 0(open circuit, no flow).KVL big-M disjunction (Kirchhoff mode only):
f_l ≥ b_eff · Δθ_l − M_l · (1 − u_l) f_l ≤ b_eff · Δθ_l + M_l · (1 − u_l)
where
M_l = |b_eff| · (θ_max − θ_min)(Fisher 2008 baseline; iterative tightening per Pineda 2024 [3] is a v1 follow-up that writes back tokvl_big_m).
Roadmap status (see issue #509):
- v0 — capacity gating.
- v0.5 — node_angle KVL big-M disjunction.
- v1 — cycle_basis KVL big-M disjunction (both Kirchhoff modes now supported); per-line
kvl_big_moverride. - v1.1 — u/v/w three-binary decomposition with
startup_cost/shutdown_cost. - v1.2 —
min_up_time/min_down_timeanti-flicker rows,max_starts/min_starts/starts_scoperolling-window cap (mirroringCommitment).
Deferred for v1.3+: PowerModels.jl IND+ indicator-constraint alternative, iterative big-M tightening (Pineda 2024 [3] pre-solve that writes back to kvl_big_m), startup tiers.
References
[3] Pineda, Morales, Porras, Domínguez (2024). Tight big-Ms for Optimal Transmission Switching. Electric Power Systems Research 234:110620. doi:10.1016/j.epsr.2024.110620 (arXiv:2306.02784).
Public static variables
- static LPClassName class_name
Public functions
- auto has_startup_tiers() const -> bool noexcept
- auto is_cyclic() const -> bool noexcept
- True when
cycle = "stage". - auto starts_window_hours() const -> double noexcept
Public variables
- OptActive active
- Activation status (default: active).
- OptName cycle
- OptName description
- Optional free-text description.
- OptTBRealFieldSched fixed_status
- OptReal initial_hours
- OptReal initial_status
- OptReal kvl_big_m
- SingleId line
- FK to the Line being switched.
- OptInt max_starts
- OptReal min_down_time
- OptInt min_starts
- OptReal min_up_time
- OptBool must_run
- Name name
- Human-readable name.
- OptBool relax
- OptReal shutdown_cost
- OptStartsScope starts_scope
- OptReal startup_cost
- OptName type
- Optional element type/category tag.
- Uid uid
- Unique identifier.
Startup-cost tiers (hot/warm/cold) — v1.3.
Mirrors Commitment's hot/warm/cold tier scheme. Activates when ALL FIVE fields are set and u/v/w is on (startup_cost or shutdown_cost present). When active, the flat startup_cost is REPLACED by a tier-dependent cost based on how long the breaker was open before the close event:
offline_hours ∈ [0, hot_start_time) → hot_start_cost offline_hours ∈ [hot_start_time, cold_start_time) → warm_start_cost offline_hours ≥ cold_start_time → cold_start_cost
LP form (mirrors CommitmentLP C8/C9/C10): one tier indicator per block y^hot_l[t], y^warm_l[t], y^cold_l[t] ∈ [0, 1] plus C8: v_l[t] = y^hot_l[t] + y^warm_l[t] + y^cold_l[t] C9: y^hot_l[t] ≤ Σ_{q ∈ hot window} w_l[q] C10: y^warm_l[t] ≤ Σ_{q ∈ warm window} w_l[q] (cold is the residual via C8 — no explicit row needed). Pre-event window membership uses block durations: a block q is in t's hot window if Σ duration[q..t-1] < hot_start_time (the line is open from the start of the shutdown block q).
Requires cold_start_time >= hot_start_time; validate_planning rejects otherwise (and LineCommitmentLP logs + skips tiers as a defensive fallback).
- OptReal hot_start_cost
- $/start when offline < hot_start_time
- OptReal warm_start_cost
- $/start when offline in [hot, cold)
- OptReal cold_start_cost
- $/start when offline ≥ cold_start_time
- OptReal hot_start_time
- Hot/warm boundary [hours].
- OptReal cold_start_time
- Warm/cold boundary [hours].
Function documentation
bool gtopt:: LineCommitment:: has_startup_tiers() const noexcept
True iff all five tier fields are set (LP build then activates the tier rows and zeroes the flat startup_cost contribution).
double gtopt:: LineCommitment:: starts_window_hours() const noexcept
Resolve starts_scope to a window length in hours. Mirrors Commitment::starts_window_hours(): integer values pass through verbatim; named values map hour → 1, day → 24, week → 168, horizon → 0 (sentinel "never flush until
stage end"). Unrecognised names / unset both return 0.
Variable documentation
static LPClassName gtopt:: LineCommitment:: class_name
Canonical class-name constant used in LP row labels and config fields. Single source of truth — LineCommitmentLP exposes no separate ClassName member; callers reach the constant via LineCommitment::class_name directly.
OptName gtopt:: LineCommitment:: cycle
Cyclic line commitment: "none" (default, chronological from initial_status) or "stage" — the stage is a typical day / week repeated in a cycle (mirrors Commitment.cycle): the C1 transition at the first block wraps to the last block, min up / down windows and the start-up tier walk wrap around the period on real time steps, and start / shut-down (and tier) costs per cycle are scaled by the stage weight duration / period_hours. initial_status / initial_hours are ignored.
OptTBRealFieldSched gtopt:: LineCommitment:: fixed_status
Per-(stage, block) forced commitment status — pins u_l to a specific value at every (stage, block) where it is set. 1.0 ⇒ pinned closed, 0.0 ⇒ pinned open; blocks where the schedule has no entry, or a value outside [0, 1] (e.g. the -1 un-pinned marker), leave u_l free. Mirrors Commitment.fixed_status semantics for line topology scheduling. Overrides must_run per block when both are set. When the underlying Line.in_service schedule resolves to 0 for a block (exogenous outage), the LP pins u_l[t,b] = 0 REGARDLESS of fixed_status — the physical outage trumps the operator pin.
OptReal gtopt:: LineCommitment:: initial_hours
Hours offline before the stage starts (pre-stage state). A line open since before the horizon has been open initial_hours + the in-horizon hours before block t; that sizes the C9/C10 hot/warm windows at every block until the first in-horizon close. Defaults to a large sentinel (1e6) so an unset value means "the breaker has been open forever" (⇒ every first close is cold).
OptReal gtopt:: LineCommitment:: initial_status
Initial closed/open state at t = 0. 1.0 = closed (in-service), 0.0 = open. When unset, the LP leaves u_l free at t = 0. Used by the v0 LP build as a one- time bound on the first-block u_l; the v1 u/v/w transition logic will additionally constrain v_l[0] − w_l[0] = u_l[0] − initial_status.
OptReal gtopt:: LineCommitment:: kvl_big_m
Per-line override of the KVL disjunction big-M parameter. When unset, LineCommitmentLP defaults to M_l = |b_eff| · (θ_max − θ_min) (Fisher 2008 baseline, known loose). Set explicitly when an iterative-tightening pre-solve (Pineda 2024 [3]) has computed a tighter bound for this line — providing the write-back target from day 1 means the v1 tightening pass doesn't require a schema migration.
REQUIRED to be positive when set. A non-positive kvl_big_m makes the KVL disjunction unbounded and the LP-relaxation trivially feasible (every flow value allowed regardless of θ-difference); validate_planning rejects such inputs.
Inert in transport mode (use_kirchhoff = false) — the LP build emits no KVL row in that mode and the big-M is never consumed.
OptInt gtopt:: LineCommitment:: max_starts
Upper bound on the number of CLOSE events (v_l = 1) over a rolling time window. Mirrors Commitment::max_starts (PLEXOS "Max Starts {Hour|Day|Week|Month|Year}"). Emitted as one row per window: Σ_{t ∈ window} v_l[t] ≤ max_starts Window length is resolved by the SHARED starts_scope — see LineCommitment::starts_window_hours.
OptReal gtopt:: LineCommitment:: min_down_time
Minimum down time [hours]. Mirrors Commitment::min_down_time. Symmetric to min_up_time: once the breaker opens (w_l[t] = 1), the LP must keep u_l = 0 for at least min_down_time hours. Emitted as Σ_{q=t}^{t + DT_blocks − 1} u_l[q] + DT_blocks · w_l[t] ≤ DT_blocks where DT_blocks covers min_down_time hours starting at block t. Same activation gate as min_up_time.
OptInt gtopt:: LineCommitment:: min_starts
Lower bound on the number of CLOSE events (v_l = 1) over a rolling time window. Mirrors Commitment::min_starts. Both bounds share the same window LHS: min_starts ≤ Σ_{t ∈ window} v_l[t] ≤ max_starts Unset ⇒ no lower row emitted (effectively 0).
OptReal gtopt:: LineCommitment:: min_up_time
Minimum up time [hours]. Mirrors Commitment::min_up_time. Once the breaker closes (v_l[t] = 1), the LP must keep u_l = 1 for at least min_up_time hours starting at block t. Emitted as the row family Σ_{q=t}^{t + UT_blocks − 1} u_l[q] ≥ UT_blocks · v_l[t] where UT_blocks is the smallest number of forward blocks whose cumulative duration covers min_up_time. Trivially satisfied (and skipped) when the window collapses to 1 block. Requires u/v/w (startup_cost or shutdown_cost set); silently inert when u/v/w is off.
OptBool gtopt:: LineCommitment:: must_run
Force the binary status to u_l = 1 for every block (commitment-equivalent "must run" — line pinned closed). When true the LP folds the bound u_l = 1 into the binary column directly so the MIP solver has no branching choice on this line; the LP build degenerates to the pre-OTS pure-LP path (capacity rows reduce to ±F^max ≥ ±f_l, KVL big-M rows collapse to the exact equality). Default false.
OptReal gtopt:: LineCommitment:: shutdown_cost
Per-event line-OPENING (shutdown) cost ($). Symmetric to startup_cost; setting either field activates the u/v/w decomposition. Both default to zero (no event cost ⇒ the simple u_l-only form remains in use).
OptStartsScope gtopt:: LineCommitment:: starts_scope
Window-scope for max_starts / min_starts. Mirrors Commitment::starts_scope — accepts either the named enum ("hour" | "day" | "week" | "horizon"; aliases "month" and "year" collapse to horizon) or an integer hour count (e.g. 48 for 2 days). Resolved at LP-build time by starts_window_hours(). Unset / unknown ⇒ horizon (one row per stage).
OptReal gtopt:: LineCommitment:: startup_cost
Per-event line-CLOSING (startup) cost ($). When set together with shutdown_cost (or alone), LineCommitmentLP switches from the simple u_l ∈ {0,1} form to the Knueven–Ostrowski– Watson 2020 / Morales-España et al. 2013 three-binary decomposition: u_l (status) is the only declared integer, v_l ∈ [0,1] (closing event) and w_l ∈ [0,1] (opening event) are continuous-but-implied-binary auxiliaries, joined by C1: u_l[t] − u_l[t−1] − v_l[t] + w_l[t] = 0 C3: v_l[t] + w_l[t] ≤ 1 The objective gains startup_cost · Σ v_l and shutdown_cost · Σ w_l. Inert on non-chronological stages (the v/w decomposition is meaningless without block ordering; mirrors CommitmentLP).