lumix.nonlinear.terms.LXBilinearTerm¶
- class lumix.nonlinear.terms.LXBilinearTerm(var1, var2, coefficient=1.0)[source]¶
Product of two variables: x * y.
Represents the product of two decision variables, which is nonlinear but can be linearized using different techniques depending on the variable types.
- The linearization method is automatically selected based on variable types:
Binary × Binary: AND logic (z <= x, z <= y, z >= x+y-1)
Binary × Continuous: Big-M method
Continuous × Continuous: McCormick envelopes (requires bounds)
- Parameters:
var1 (LXVariable)
var2 (LXVariable)
coefficient (float)
- var1¶
First variable in the product.
- var2¶
Second variable in the product.
- coefficient¶
Coefficient to multiply the product by (default: 1.0).
Example
Facility activation times flow:
from lumix.nonlinear import LXBilinearTerm from lumix.core import LXVariable # Flow is only active if facility is open is_open = LXVariable[Facility, int]("is_open").binary() flow_amount = LXVariable[Facility, float]("flow").continuous() # actual_flow = is_open * flow_amount actual_flow = LXBilinearTerm( var1=is_open, var2=flow_amount, coefficient=1.0 )
Rectangle area calculation:
# Area = length * width (both continuous) length = LXVariable[Shape, float]("length").continuous().bounds(1, 10) width = LXVariable[Shape, float]("width").continuous().bounds(1, 10) area = LXBilinearTerm(var1=length, var2=width)
Weighted product:
# Price * quantity with discount factor revenue = LXBilinearTerm( var1=price, var2=quantity, coefficient=0.9 # 10% discount )
Note
For Continuous × Continuous products, both variables MUST have finite bounds defined. McCormick envelopes require knowing the variable bounds to construct the linearization.
The linearization introduces auxiliary variables and constraints that ensure the auxiliary variable equals the product of the two input variables.
- __init__(var1, var2, coefficient=1.0)¶
- Parameters:
var1 (LXVariable)
var2 (LXVariable)
coefficient (float)
- Return type:
None
Methods
__init__(var1, var2[, coefficient])Attributes
-
var1:
LXVariable¶
-
var2:
LXVariable¶
- __init__(var1, var2, coefficient=1.0)¶
- Parameters:
var1 (LXVariable)
var2 (LXVariable)
coefficient (float)
- Return type:
None