ams.opt.exprcalc.ExpressionCalc#
- class ams.opt.exprcalc.ExpressionCalc(name: str | None = None, info: str | None = None, unit: str | None = None, e_str: str | None = None, e_fn: Callable | None = None, model: str | None = None, src: str | None = None)[source]#
Class for calculating expressions.
This class is useful for performing post-solve calculations, but it does not participate in the optimization model itself.
Note: ExpressionCalc is not a CVXPY expression and should NOT be referenced in e_str by any other components, including other instances of ExpressionCalc.
Accepts
e_fn(callable takingRoutineNS) alongside the legacye_strform. The codegen emits_exprcalc_<name>callables; the descriptor mutex fromOptzBasekeeps the two forms exclusive.- __init__(name: str | None = None, info: str | None = None, unit: str | None = None, e_str: str | None = None, e_fn: Callable | None = None, model: str | None = None, src: str | None = None)[source]#
Methods
Attributes
Return the class name
Return the calculated numerical value of the underlying expression.
Mutex descriptor for
e_str/e_fnon opt elements.Mutex descriptor for
e_str/e_fnon opt elements.Where the live CVXPY object for this item came from.
Return the number of elements.
Return the shape.
Return the size.
Return the CVXPY expression value.