AttachedDecisionVariable

AttachedDecisionVariable#

class AttachedDecisionVariable#

Attached decision variable — a write-through handle bound to a host (Instance or ParametricInstance).

AttachedDecisionVariable is returned by add_decision_variable(v) (insertion), attached_decision_variable(id) (lookup), and the decision_variables getter on both hosts. Reads pull live data from the parent host's SoA store and metadata setters write back through to it. Handles also participate in arithmetic (x + y, 2 * x etc.) via ToFunction — only the id is consumed for that, no host borrow is taken, so arithmetic works even while the host is mutably borrowed elsewhere. Call detach() for an independent DecisionVariable snapshot.

DecisionVariableMetadata has no provenance field, so the write-through surface omits the corresponding getter.

__add__(rhs: ScalarLike | LinearLike | Parameter) Linear#
__add__(rhs: Quadratic) Quadratic
__add__(rhs: Polynomial) Polynomial
__add__(rhs: Function) Function
__copy__() AttachedDecisionVariable#
__deepcopy__(_memo: Any) AttachedDecisionVariable#
__eq__(other: ToFunction) Constraint#

Create an equality constraint: self == otherConstraint with EqualToZero.

__ge__(other: ToFunction) Constraint#

Create a greater-than-or-equal constraint.

__le__(other: ToFunction) Constraint#

Create a less-than-or-equal constraint.

__mul__(rhs: ScalarLike) Linear#
__mul__(rhs: LinearLike | Parameter) Quadratic
__mul__(rhs: Quadratic | Polynomial) Polynomial
__mul__(rhs: Function) Function
__neg__() Linear#

Negation operator: -xLinear(-1 * x).

__radd__(lhs: ScalarLike | LinearLike | Parameter) Linear#
__radd__(lhs: Quadratic) Quadratic
__radd__(lhs: Polynomial) Polynomial
__radd__(lhs: Function) Function
__repr__() str#
__rmul__(lhs: ScalarLike) Linear#
__rmul__(lhs: LinearLike | Parameter) Quadratic
__rmul__(lhs: Quadratic | Polynomial) Polynomial
__rmul__(lhs: Function) Function
__rsub__(lhs: ScalarLike | LinearLike | Parameter) Linear#
__rsub__(lhs: Quadratic) Quadratic
__rsub__(lhs: Polynomial) Polynomial
__rsub__(lhs: Function) Function
__sub__(rhs: ScalarLike | LinearLike | Parameter) Linear#
__sub__(rhs: Quadratic) Quadratic
__sub__(rhs: Polynomial) Polynomial
__sub__(rhs: Function) Function
add_description(description: str) None#
add_name(name: str) None#
add_parameter(key: str, value: str) None#
add_parameters(parameters: Mapping[str, str]) None#
add_subscripts(subscripts: Sequence[int]) None#
detach() DecisionVariable#

Return a DecisionVariable snapshot of the current state. Mutations on the returned object do not propagate back.

set_description(description: str) None#
set_name(name: str) None#

Set the name. Writes through to the parent host's SoA metadata store.

set_parameters(parameters: Mapping[str, str]) None#
set_subscripts(subscripts: Sequence[int]) None#
property bound: Bound#

Read-only property.

property description: str#

Read-only property.

property id: int#

Read-only property.

The id this handle points at.

property instance: Any#

Read-only property.

The parent host this variable lives in.

property kind: int#

Read-only property.

property name: str#

Read-only property.

property parameters: dict[str, str]#

Read-only property.

property subscripts: list[int]#

Read-only property.

property substituted_value: Optional[float]#

Read-only property.