NamedFunction#
- class NamedFunction#
NamedFunction wrapper for Python
- __copy__() NamedFunction#
- __eq__(other: ToFunction) Constraint#
Create an equality constraint: self.function == other → Constraint with EqualToZero
Returns a Constraint where (self.function - other) == 0. Note: This does NOT return bool, it creates a Constraint object.
- __ge__(other: ToFunction) Constraint#
Create a greater-than-or-equal constraint: self.function >= other → Constraint with LessThanOrEqualToZero
Returns a Constraint where (other - self.function) <= 0.
- __le__(other: ToFunction) Constraint#
Create a less-than-or-equal constraint: self.function <= other → Constraint with LessThanOrEqualToZero
Returns a Constraint where (self.function - other) <= 0.
- __new__(id: int, function: ToFunction, name: Optional[str] = None, subscripts: Sequence[int] = [], description: Optional[str] = None, parameters: Mapping[str, str] = {}) NamedFunction#
Create a new NamedFunction.
Args:
id: The unique identifier for this named functionfunction: The function (int, float, DecisionVariable, Linear, Quadratic, Polynomial, or Function)name: Optional name for the functionsubscripts: Optional subscripts for indexingdescription: Optional descriptionparameters: Optional key-value parameters
- __repr__() str#
- evaluate(state: ToState, atol: Optional[float] = None) EvaluatedNamedFunction#
Evaluate the named function with the given state.
Args:
state: A State object, dict[int, float], or iterable of (int, float) tuplesatol: Optional absolute tolerance for evaluation
Returns:
EvaluatedNamedFunctioncontaining the evaluated value
- from_bytes(bytes: bytes) NamedFunction#
- partial_evaluate(state: ToState, atol: Optional[float] = None) NamedFunction#
Partially evaluate the named function with the given state.
This modifies self in-place and returns self for method chaining.
Args:
state: A State object, dict[int, float], or iterable of (int, float) tuplesatol: Optional absolute tolerance for evaluation
Returns: Self (modified in-place) for method chaining
- to_bytes() bytes#
- property id: int#
Read-only property.
- property parameters: dict[str, str]#
Read-only property.
- property subscripts: list[int]#
Read-only property.