You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not needed explicitly by anyone yet, but should be added for consistency with add_variables etc
Note
The following content was generated by AI.
Summary
Add a mask parameter to add_piecewise_formulation, matching the add_variables(mask=…) / add_constraints(mask=…) convention: where mask=False, no piecewise formulation is built for that entry (no auxiliary variables, no link/convexity constraints). It answers a structural question — does this entity have a piecewise relationship at all? — and takes priority over active.
Motivation
Heterogeneous sets where only some entities have a piecewise curve. Today you either split into several add_piecewise_formulation calls or rely on NaN-breakpoint tricks. A mask is the declarative, convention-aligned way to say "this entity has no curve here."
Relationship to active / active_fill (#796, #797, #798)
mask is orthogonal to gating and does not overlap with the #796 work:
state
how to express
entity has no curve
mask=False
curve, gated on/off (unit commitment)
active=status
curve, always on (ungated)
active_fill=1 (or full active=1)
mask: structural / compile-time — does the constraint exist here?
active: solve-time decision — is it engaged?
They compose: mask filters which entries get a formulation, active gates the survivors. A masked entry has no constraint, so active/active_fill for it is moot — hence mask priority. mask does not solve #796: masking the non-committable units would delete their curve, but those units still dispatch on it.
Relationship to .sel()
For a clean label-subset along one dimension, .sel() on the operands already achieves "no constraint elsewhere", so no parameter is needed there. mask earns its place for:
Ragged / multi-dim holes that no rectangular .sel() can express (scattered (gen, time) pairs, not whole labels along an axis).
Full-index output — .sel() returns reduced-index objects that must be realigned to the full coordinate afterwards; mask keeps everything on the full index with holes.
One declarative argument instead of slicing every operand (and keeping breakpoint arrays consistent).
This is not needed explicitly by anyone yet, but should be added for consistency with
add_variablesetcNote
The following content was generated by AI.
Summary
Add a
maskparameter toadd_piecewise_formulation, matching theadd_variables(mask=…)/add_constraints(mask=…)convention: wheremask=False, no piecewise formulation is built for that entry (no auxiliary variables, no link/convexity constraints). It answers a structural question — does this entity have a piecewise relationship at all? — and takes priority overactive.Motivation
Heterogeneous sets where only some entities have a piecewise curve. Today you either split into several
add_piecewise_formulationcalls or rely on NaN-breakpoint tricks. Amaskis the declarative, convention-aligned way to say "this entity has no curve here."Relationship to
active/active_fill(#796, #797, #798)maskis orthogonal to gating and does not overlap with the #796 work:mask=Falseactive=statusactive_fill=1(or fullactive=1)mask: structural / compile-time — does the constraint exist here?active: solve-time decision — is it engaged?They compose:
maskfilters which entries get a formulation,activegates the survivors. A masked entry has no constraint, soactive/active_fillfor it is moot — hencemaskpriority.maskdoes not solve #796: masking the non-committable units would delete their curve, but those units still dispatch on it.Relationship to
.sel()For a clean label-subset along one dimension,
.sel()on the operands already achieves "no constraint elsewhere", so no parameter is needed there.maskearns its place for:.sel()can express (scattered(gen, time)pairs, not whole labels along an axis)..sel()returns reduced-index objects that must be realigned to the full coordinate afterwards;maskkeeps everything on the full index with holes.Notes
activegate (treat missing/null entries as always-active) #796 gating fix; filed separately so the two designs don't get tangled.activegate support via active_gate helper (#796) #797.🤖 Generated with Claude Code