ams.core.service.MinDurWindow#
- class ams.core.service.MinDurWindow(u: Callable, u2: Callable, name: str = None, tex_name: str = None, unit: str = None, info: str = None, vtype: Type = None, no_parse: bool = True, sparse: bool = False)[source]#
Build the Rajan-Takriti window-sum coefficient matrix for the interior minimum on/off duration constraints in UC.
Returns a sparse
(n_gen * n_ts, n_gen * n_ts)block-diagonal matrixWwith:W[(g, t), (g, s)] = 1 iff s ∈ [t - TU_g + 1, t] AND t >= TU_g - 1where
TU_g = ceil(td[g] / Δt)(the duration in periods). Used in UC as:cp.reshape(Wup @ cp.vec(vgd, order='C'), vgd.shape, order='C') - ugd <= 0
so that each (g, t) row enforces
Σ_{s ∈ window} v[g, s] ≤ u[g, t](and symmetrically forwgdon the off-side). Boundary periodst < TU_g - 1get all-zero rows — Phase 2 (MinDurInit) covers those via the initial-state lock.The block-diagonal structure makes the LP relaxation of UC tight in the Rajan-Takriti convex-hull sense, while the sparse representation keeps memory linear in the number of nonzeros.
- Parameters:
Notes
Returns
scipy.sparse.csr_matrixregardless of thesparseflag — the dense fallback would defeat the size advantage. The flag is accepted for API parity withMinDuronly. Defaultsno_parse=Truebecause the sparse output cannot be wrapped incvxpy.Parameter; the e_str eval substitutes the raw matrix at parse time.- __init__(u: Callable, u2: Callable, name: str = None, tex_name: str = None, unit: str = None, info: str = None, vtype: Type = None, no_parse: bool = True, sparse: bool = False)[source]#
Methods
Assign memory for
self.vand set the array to zero.evaluate(*args, **kwargs)Return all the indexes of this item.
get_idx()Return name in a list
parse(*args, **kwargs)update()Update the Parameter value.
Attributes
Return the class name
Return the calculated numerical value of the underlying expression.
Where the live CVXPY object for this item came from.
Return the count of values in
self.v.Return the shape of the service.
Return the size.
Value of the service.