Commitment struct
#include <gtopt/commitment.hpp>
Unit commitment parameters for a generator.
Links to a Generator and defines the three-bin UC model parameters:
- u (status): binary, 1 = online
- v (startup): binary, 1 = started up this block
- w (shutdown): binary, 1 = shut down this block
Constraints:
- C1 (logic): u[t] - u[t-1] = v[t] - w[t]
- C2 (gen limits): Pmin*u <= p <= Pmax*u
- C3 (exclusion): v[t] + w[t] <= 1
Public static variables
- static LPClassName class_name
Public functions
- auto commitment_period_hours(double resolution) const -> double
- auto effective_commitment_breaks(std::span<const Real> stage_breaks, const std::optional<std::vector<Real>>& dflt) const -> std::span<const Real> noexcept
- auto is_cyclic() const -> bool noexcept
- True when
cycle = "stage". - auto is_power_based(bool global_power_based) const -> bool noexcept
- auto long_constraints(double cycle_hours) const -> std::vector<std::pair<std::string_view, double>>
- auto long_transition_at(std::size_t stage_pos, const OptName& dflt) const -> std::string_view noexcept
- auto ramp_allowance_at_boundary() const -> bool noexcept
- True for the default boundary-only ramp allowance.
- auto starts_scope_enum() const -> StartsScope noexcept
- auto starts_window_hours() const -> double noexcept
- auto uses_legacy_point_grid() const -> bool noexcept
- Point stages keep the previous grid (
"block"/"cells"). - auto uses_overlay_grid() const -> bool noexcept
- Resolved commitment grid: true for the overlay grid.
Public variables
- OptActive active
- Activation status (default: active).
- std::vector<Real> commitment_breaks
- OptName commitment_grid
- OptCommitmentPeriod commitment_period
- OptName cycle
- OptName description
- OptBool fast_start
- OptTBRealFieldSched fixed_status
- SingleId generator
- FK to the Generator.
- OptReal ini_hours_down
- OptReal ini_hours_up
- OptReal initial_hours
- Hours in current state at t=0.
- OptReal initial_power
- OptReal initial_status
- Initial on/off (1.0 = online, 0.0 = offline).
- OptName long_transition
- std::vector<Name> long_transition_schedule
- OptReal min_down_time
- Minimum down time [hours].
- OptReal min_up_time
- Minimum up time [hours].
- OptBool must_run
- Force committed: u = 1 always.
- Name name
- Human-readable name.
- OptReal noload_cost
- OptReal noload_fuel
- OptTBRealFieldSched pmin
- OptName ramp_allowance
- OptTBRealFieldSched ramp_down
- Ramp-down limit [MW/hr] while online.
- OptTBRealFieldSched ramp_up
- Ramp-up limit [MW/hr] while online.
- OptBool relax
- LP relaxation: u/v/w continuous in [0,1].
- OptTBRealFieldSched shutdown_cost
- Shutdown cost [$/stop].
- OptTBRealFieldSched shutdown_ramp
- Max output in shutdown block [MW].
- OptTBRealFieldSched startup_cost
- OptTBRealFieldSched startup_ramp
- Max output in startup block [MW].
- OptName startup_tier_integrality
- OptName transition_integrality
- OptBoolOrName transition_status_rows
- OptName type
- Optional element type/category tag.
- Uid uid
- Unique identifier.
Startup cost tiers (hot/warm/cold)
When all five fields are present, the single startup_cost is replaced by three tier-dependent costs based on offline duration. hot_start_time < cold_start_time; offline < hot → hot cost, etc.
- OptReal hot_start_cost
- Startup cost when recently offline [$/start].
- OptReal warm_start_cost
- Startup cost at medium offline [$/start].
- OptReal cold_start_cost
- Startup cost when long offline [$/start].
- OptReal hot_start_time
- Max offline hours for hot start [h].
- OptReal cold_start_time
- Min offline hours for cold start [h].
Startup-count bounds (PLEXOS Max Starts {Hour|Day|Week|...}
- symmetric
Min Startsfloor for forced-commitment).
Two-sided bound on the number of startup events within a rolling time window. The LP emits at most TWO rows per (commitment, window) pair — one for each side that's set:
min_starts ≤ Σ_{block in window} startup_col[block] ≤ max_starts
where window is determined by the SHARED starts_scope:
"hour"→ 1 row per block (effectively startup ≤/≥ N/h)"day"→ 1 row per 24 h window (cumulative-duration boundary flush, likeUserConstraint.daily_sum)"week"→ 1 row per 7×24 h window"horizon"(default) → 1 row per stage, Σ over all blocks- integer hour count (e.g. 48, 336, 720) → per-window with that length, for arbitrary scopes the NamedEnum doesn't cover
PLEXOS exposes the cap family on its Generator class (prop 202..207: per-horizon / hour / day / week / month / year) — month/year alias to Horizon here because a typical gtopt stage is shorter than a month. PLEXOS doesn't ship a symmetric Min Starts property, but the same per-window mechanism naturally supports a floor too — useful for forced-commitment patterns and as a complement when adapting Min Energy {Day|Week} / Min CF to a startup-count surrogate.
Defaults (unset semantics):
max_startsunset → +∞ (no cap; no upper row emitted)min_startsunset → 0 (no floor; no lower row emitted) When BOTH are set to the same value the constraint pins the per-window startup count to exactly that value (two opposing inequality rows; CPLEX presolve detects the equality).
Both bounds are HARD (no soft-slack tier). PLEXOS exposes Max Starts Penalty (prop 208) but CEN PCP never populates it; surface it here only if a future case ships non-zero values.
- OptInt max_starts
- OptInt min_starts
- OptStartsScope starts_scope
- OptName uc_formulation
- std::vector<Real> startup_trajectory
- std::vector<Real> shutdown_trajectory
- OptReal trajectory_step
- Spacing of the trajectory samples [h] (default 1).
Operation wear adders (SSCC maintenance signal), default off
Separate from the fuel / energy start cost so the outputs can split them (Commitment/startup_wear_cost_sol, Commitment/operation_wear_cost_sol). All linear: valid for a relaxed commitment and with capacity expansion.
Wear part of one start [$/start] (added to the startup column, also with hot / warm / cold tiers). Must be >= 0.
- OptTBRealFieldSched startup_wear_cost
- OptTBRealFieldSched wear_hour_cost
a: wear cost per committed hour [$/h] (terma·u). Must be >= 0.- OptTBRealFieldSched wear_load_cost
Function documentation
double gtopt:: Commitment:: commitment_period_hours(double resolution) const
Resolved commitment_period [h] for a stage whose smallest time step is resolution (0 = one period per block).
std::span<const Real> gtopt:: Commitment:: effective_commitment_breaks(std::span<const Real> stage_breaks,
const std::optional<std::vector<Real>>& dflt) const noexcept
Daily cell boundaries in force for this unit on a stage whose own pattern is stage_breaks (Stage.commitment_breaks, empty = none) given the planning default dflt (model_options.commitment_breaks): the unit's own list, else — for units without their own grid (commitment_period, legacy commitment_grid "block" / "cells") — the stage's list, else dflt; empty = no daily grid.
bool gtopt:: Commitment:: is_power_based(bool global_power_based) const noexcept
Resolved per-unit formulation: true for power-based, given the planning-wide default global_power_based.
std::vector<std::pair<std::string_view, double>> gtopt:: Commitment:: long_constraints(double cycle_hours) const
Time constraints of this unit longer than a cycle of cycle_hours: (name, hours) pairs. Empty for non-cyclic units.
std::string_view gtopt:: Commitment:: long_transition_at(std::size_t stage_pos,
const OptName& dflt) const noexcept
Declared long-transition mode at stage position stage_pos (schedule, unit, then planning default dflt); empty when undeclared.
StartsScope gtopt:: Commitment:: starts_scope_enum() const noexcept
Symbolic view of starts_scope for diagnostic / test use. Returns Horizon when unset, when the variant holds an Int (the explicit hour count has no enum entry), or when the Name doesn't match an enum entry. Use starts_window_hours() for the LP-side resolved window length.
double gtopt:: Commitment:: starts_window_hours() const noexcept
Resolve starts_scope (either a named StartsScope or an integer hour count) to the rolling window length in HOURS used by CommitmentLP::add_to_lp to decide when to flush the Σ_{p ∈ window} v[p] ≤ max_starts accumulator row.
- unset →
0.0(treated as Horizon — single row per stage) - Int variant → that many hours (clamped to 0 if non-positive)
- Name variant → enum-resolved hours: Hour=1, Day=24, Week=168, Horizon=0 month/year aliases → Horizon (0) unrecognised string → Horizon (0)
Variable documentation
static LPClassName gtopt:: Commitment:: class_name
Canonical class-name constant used in LP row labels and config fields like VariableScale::class_name. Single source of truth — CommitmentLP exposes no separate ClassName member; callers reach the constant via Commitment::class_name directly (or CommitmentLP::Element::class_name in generic contexts).
std::vector<Real> gtopt:: Commitment:: commitment_breaks
Daily commitment grid: cell boundaries in hours of the day (clock time, [0, 24), strictly increasing, at least one), e.g. [3.5, 7.5, 10.5, 14.5, 17.5, 23.5] = the cells 23:30–03:30, 03:30–07:30, 07:30–10:30, 10:30–14:30, 14:30–17:30 and the peak 17:30–23:30 (the last cell wraps around midnight). The status u lives on these cells: every node (point stages: Block.time; block stages: the block midpoint) joins the cell holding its clock time Stage.start_hour + t (half-open [a, b): a node exactly on a boundary starts the later cell), v / w happen only at cell boundaries and min up / down count the real cell hours. Cells holding no node continue the previous cell's status (as the uniform overlay grid). On a cyclic stage whose length is a whole number of days, the cell straddling the period start is ONE cell: its two pieces share the status (no start / stop at the wrap).
Precedence: the unit's own commitment_breaks > its commitment_period > Stage.commitment_breaks (per-stage pattern, e.g. seasonal) > model_options.commitment_breaks (the planning default) — the last two only for units without commitment_period / commitment_grid "block" / "cells" — > Block.commitment_cell > the per-block grid. A unit with both commitment_breaks and commitment_period, or with commitment_grid "block" / "cells", is a validation error. Empty (default) = unset. Non-chronological stages ignore it.
OptName gtopt:: Commitment:: commitment_grid
Commitment grid: "block" — one status per block / cell (min up / down, starts and hours-on in the real cell durations, also for variable durations); "overlay" — a UC grid of commitment_period periods laid over the blocks (each block / cell joins its period by duration_groups, the status is shared by the blocks of a period). Default: "block" when commitment_period is unset, "overlay" when set. "block" with a commitment_period, or "overlay" without one, is a validation error.
Point stages (Stage.sampling = "point"): unset / "overlay" = the unit's uniform grid of max(commitment_period, 1 h) cells, nodes mapped by their time (never one status per node). The previous behaviour stays reachable: "block" = one status per node, "cells" (needs commitment_period) = periods as unions of the quadrature cells (midpoint rule, see cell_partition.hpp). On block stages "cells" equals "overlay".
OptCommitmentPeriod gtopt:: Commitment:: commitment_period
Binary variable period [hours]. When set, u/v/w variables are created at a coarser time resolution than the generation blocks. For example, commitment_period = 2.0 with 15-minute blocks yields one binary variable per 2-hour window (8 blocks), while generation variables remain at 15-minute resolution. Default (nullopt) = one per block.
Periods are unions of whole cells of the stage partition (blocks; quadrature cells on Stage.sampling = "point" stages): see duration_groups in cell_partition.hpp. Uniform block stages keep the legacy accumulated grouping.
"auto": P = max(smallest cell, ½·min(min_up_time,
min_down_time)); per-block binaries when neither min_up_time nor min_down_time is set.
OptName gtopt:: Commitment:: cycle
Cyclic commitment: "none" (default, chronological from initial_status) or "stage" — the stage is a typical day / week repeated in a cycle: the first period's transition wraps to the last (u_1 − u_P = v_1 − w_1, no initial state), min up/down and hot/warm/cold windows wrap around the cycle, ramps wrap (backward from the last block; central2 skipping the duplicated t_N ≡ t_0, which shares the status of t_0), and start / shutdown costs per cycle are scaled by the stage weight duration / period_hours. initial_status / initial_hours / initial_power are ignored.
OptName gtopt:: Commitment:: description
Optional free-text description (e.g. conversion provenance)
OptBool gtopt:: Commitment:: fast_start
Fast-start unit for model_options.pricing_mode = "fast_start": its u/v/w columns are relaxed to continuous [0,1] in the pricing LP (the rest of the integers stay pinned at the MIP incumbent), so its pmin / no-load / startup costs become divisible and can set the price. Explicit true/false wins; unset applies the auto rule min_up_time <= H && min_down_time <= H with H = model_options.fast_start_max_hours (default 1 h; unset min up/down count as 0). No effect on the MIP or the dispatch.
OptTBRealFieldSched gtopt:: Commitment:: fixed_status
Per-(stage, block) forced commitment status — pins the u variable to a specific value at each (stage, block) where it is set. Values are interpreted as 1.0 → committed, 0.0 → not committed; blocks where the schedule has no entry leave u free. Generalises the all-or-nothing must_run flag to schedules like UC.jl's per-block Commitment status: [true, false, true, ...] field (case14/fixed.json), and is also useful for hot-start / scenario- tracing replay where a previous solve's commitment is pinned. Overrides must_run per block — if both are set, the per-block fixed_status value wins for the blocks it covers and must_run covers the remainder.
OptReal gtopt:: Commitment:: ini_hours_down
Raw PLEXOS Gen_IniHoursDown.csv value [h]: hours the unit has been continuously offline at t = 0. See ini_hours_up for the round-trip rationale.
OptReal gtopt:: Commitment:: ini_hours_up
Raw PLEXOS Gen_IniHoursUp.csv value [h]: hours the unit has been continuously online at t = 0. Informational round-trip field for the plexos2gtopt converter — the LP uses the collapsed signed initial_hours (positive when initial_status = 1) for min-up / min-down enforcement. Carrying the raw pair lets downstream tooling (audits, PLEXOS diffs) inspect the original values without re-reading the CSV. Unset → not published.
OptReal gtopt:: Commitment:: initial_power
Initial power output [MW] at t = -1. When set, the first-block ramp-up / ramp-down rows include the p_prev = initial_power term:
p[0] − initial_power ≤ RU·u_init + SU·(1 − u_init) initial_power − p[0] ≤ RD·u[0] + SD·w[0]
instead of the looser p_prev = 0 form that the previous "for simplicity" stub used (commit ID predates this field).
When std::nullopt (default), the legacy p_prev = 0 behaviour is preserved — correct for cold starts and any generator where the converter / user didn't supply a value.
Required to round-trip UC.jl's Initial power (MW) on hot-start generators with pmin > 0 (e.g. RTS-GMLC 216_STEAM_1: pmin = 62, ramp_up = 60, initial_power = 62 — without this field the first-block LP is infeasible because the pmin floor of 62 collides with the ramp-up cap of 60). Unset → Generator.initial_generation at the horizon start (first stage of the first phase), else 0.
OptName gtopt:: Commitment:: long_transition
Explicit handling of a cyclic unit whose time constraints do not fit the typical period (min_up_time, min_down_time or a finite start window longer than the cycle length T = Σ real cell durations of the stage). The constraints that cannot be honoured within the cycle are NOT emitted (one warning per unit):
"on": committed (u = 1) for the whole typical period: pmin .. pmax, no starts / stops inside it;"off": unavailable (u = 0, output 0);"no_uc": dispatched without commitment — no u/v/w, output 0 .. pmax as a continuous generator (pmin relaxed to 0, no start costs, ramps kept). Unset:model_options.long_transition; when neither is set a long unit is a validation error (no silent dropping).
std::vector<Name> gtopt:: Commitment:: long_transition_schedule
Per-stage override of long_transition ("on" / "off" / "no_uc", by stage position; an empty entry or a short list falls back to long_transition) — e.g. on in winter months, off in summer.
OptReal gtopt:: Commitment:: noload_cost
No-load cost when committed [$/hr]
OptReal gtopt:: Commitment:: noload_fuel
No-load fuel burn while committed [fuel-unit / h] (PLEXOS Heat Rate Base). Accounting only: it adds noload_fuel · u · dt to the generator's fuel burn seen by Fuel offtake limits and fuel-basis emission sources (EmissionSource.fuel_rate). Its fuel cost stays in noload_cost (not re-priced from Fuel.price).
OptTBRealFieldSched gtopt:: Commitment:: pmin
Minimum stable level when committed [MW]. Distinct from Generator.pmin (which is the always-on hard floor that applies regardless of commitment). When this field is set, commitment_lp.cpp uses it as the per-unit minimum (gen ≥ pmin × u_commit) and leaves Generator.pmin alone as the unconditional dispatch floor. Defaults to falling back on lp.get_col_lowb(gcol) (legacy behaviour) when unset. PLEXOS analogue: Generator.Min Stable Level is commitment-conditional per the official Energy Exemplar docs, so the plexos2gtopt converter writes Min Stable Level here (not into Generator.pmin) and keeps Generator.pmin = 0.
Per-(stage, block) schedule: PLEXOS Min Stable Level is a time series (e.g. CEN PCP coal units carry 98.53 MW for most of the week and 170.53 MW for a few hours), so this is a FieldSched accepting either a scalar (constant floor, the common case) or a per-block vector. commitment_lp.cpp resolves it block-by-block.
OptName gtopt:: Commitment:: ramp_allowance
Start-up / shut-down allowance of the ramp rows: "boundary" (default, master's behaviour since the commitment tightening) — SU·v / SD·w only on the ramp rows that cross a commitment-period boundary (inside a period the plain ramp limit holds); "period" — every block of a commitment period gets the allowance of its period's v / w (the older, looser form). Without commitment_period every block is its own period and both are identical.
OptTBRealFieldSched gtopt:: Commitment:: ramp_up
Ramp-up limit [MW/hr] while online.
Per-(stage, block) ramp limits / startup-shutdown output envelopes. Each accepts either a scalar (constant rate, the common case) or a per-block vector; commitment_lp.cpp resolves them block-by-block. Scalar inputs produce identical LP rows to the legacy OptReal fields (the schedule resolves to the same constant on every block).
OptTBRealFieldSched gtopt:: Commitment:: shutdown_cost
Shutdown cost [$/stop].
Shutdown cost [$/stop], per-(stage, block) schedulable — same value forms and broadcast semantics as startup_cost. Applied to the shutdown (w) variable in the objective, resolved per block.
OptTBRealFieldSched gtopt:: Commitment:: startup_cost
Startup cost [$/start], per-(stage, block) schedulable.
Accepts the same value forms as Generator.pmax: a scalar constant, a [stage] 1-D array, a [stage][block] 2-D matrix, or a filename string referencing a schedule. Scalar / per-stage values broadcast to every block (back-compat with the legacy per-stage startup_cost). This lets a single-stage PLEXOS conversion carry the per-period Gen_StartCost profile across the horizon instead of collapsing it to one value. Applied to the startup (v) variable in the objective, resolved block-by-block. Startup cost [$/start]
OptName gtopt:: Commitment:: startup_tier_integrality
Integrality of this unit's hot / warm / cold startup-tier selectors: "continuous" (TU tier rows) or "integer". Unset → model_options.startup_tier_integrality (default "continuous").
OptName gtopt:: Commitment:: transition_integrality
Integrality of this unit's startup / shutdown columns (v / w): "auto" (binary), "continuous" or "binary". Unset → model_options.transition_integrality (default "auto"). See TransitionIntegrality. relax still relaxes u, v, w together.
OptBoolOrName gtopt:: Commitment:: transition_status_rows
REMOVED 2026-11-26 (see ModelOptions::transition_status_rows): parsed so old inputs load, ignored with a warning.
OptStartsScope gtopt:: Commitment:: starts_scope
Window-scope for max_starts. Accepts EITHER a named StartsScope ("hour" | "day" | "week" | "horizon", plus "month" | "year" aliasing to Horizon) OR a positive integer number of HOURS (e.g. 48 for a 2-day window, 720 for a calendar month). See StartsScopeValue for the variant definition; starts_window_hours() resolves both shapes to the LP-side window length.
OptName gtopt:: Commitment:: uc_formulation
Per-unit UC formulation: "energy_block" or "power_based" (see ModelOptions::uc_formulation, which it overrides).
std::vector<Real> gtopt:: Commitment:: startup_trajectory
Power-based UC only: start-up power trajectory [P^SU_1, ..., P^SU_S] [MW] — the power at the successive trajectory_step instants of the start-up process, before the unit reaches its minimum output at the start of the up period (Morales-España et al., OR Spectrum 2015, eq. 12). Empty: a quick-start unit (one block from 0 to pmin..startup_ramp).
std::vector<Real> gtopt:: Commitment:: shutdown_trajectory
Power-based UC only: shut-down power trajectory [P^SD_2, ..., P^SD_{S+1}] [MW] — the power at the successive trajectory_step instants after the unit leaves its minimum output (the last entry is normally 0).
OptTBRealFieldSched gtopt:: Commitment:: wear_load_cost
b: wear cost per MWh above the committed floor [$/MWh] (term b·(p − Pmin·u)), any sign: b < 0 makes low load more costly. The hourly wear a + b·(Pmax − Pmin) at Pmax must stay >= 0.