lumix.nonlinear.terms.LXMinMaxTerm¶
- class lumix.nonlinear.terms.LXMinMaxTerm(vars, operation, coefficients)[source]¶
Min/Max of multiple variables.
Represents the minimum or maximum value among a set of variables. This is linearized by introducing an auxiliary variable z and adding constraints that ensure z equals the min or max of the input variables.
- Parameters:
vars (List[LXVariable])
operation (Literal['min', 'max'])
- vars¶
List of variables to take min/max over.
- operation¶
Either “min” or “max” to specify the operation.
- coefficients¶
Coefficients for each variable in the min/max operation.
Example
Minimum cost selection:
from lumix.nonlinear import LXMinMaxTerm from lumix.core import LXVariable # Select minimum cost among alternatives cost_a = LXVariable[Option, float]("cost_a").from_data(options_a) cost_b = LXVariable[Option, float]("cost_b").from_data(options_b) cost_c = LXVariable[Option, float]("cost_c").from_data(options_c) min_cost = LXMinMaxTerm( vars=[cost_a, cost_b, cost_c], operation="min", coefficients=[1.0, 1.0, 1.0] )
Maximum capacity:
# Find maximum capacity among resources max_capacity = LXMinMaxTerm( vars=[cap_1, cap_2], operation="max", coefficients=[1.0, 1.0] )
Note
Linearization for min: Introduces auxiliary variable z with constraints z <= x_i for all i. For max: z >= x_i for all i.
The auxiliary variable z represents the result of the min/max operation and can be used in subsequent constraints or the objective function.
- __init__(vars, operation, coefficients)¶
- Parameters:
vars (List[LXVariable])
operation (Literal['min', 'max'])
- Return type:
None
Methods
__init__(vars, operation, coefficients)Attributes
-
vars:
List[LXVariable]¶