gtopt::CommitmentLogicRule class final

Commitment-logic rule: makes the startup (v) and shutdown (w) binaries CONSISTENT with the (already run-length-repaired) status (u) so the C1 logic equality u[p] - u[p-1] - v[p] + w[p] = 0 holds at every block. The generic rounding stage rounds u, v and w INDEPENDENTLY from the LP relaxation, which almost never satisfies this coupling — so a fixed-commitment dispatch is infeasible on the logic rows and CHECKFEAS rejects the start. This rule recomputes v[p] = max(0, u[p] - u[p-1]) and w[p] = max(0, u[p-1] - u[p]) from the final u (using initial_status as u[-1]), which is exactly the value the equality forces. It NEVER touches u — it only repairs the dependent v/w — so it must run LAST, after every rule that may still move u (min-up/down, peak). A unit with no min-up/down limit still has logic rows, so this rule applies to ALL commitments, not only those MinUpDownRule processes.

Base classes

class DomainRule

Public functions

auto apply(std::span<double> values, const DomainRuleContext& ctx) const -> int override
auto name() const -> std::string_view override noexcept

Function documentation

int gtopt::CommitmentLogicRule::apply(std::span<double> values, const DomainRuleContext& ctx) const override

Returns the number of column values flipped (0 = the rule found nothing to fix).

Adjust values in place;