Types of Decision Variables#
jijmodeling
supports integer variables IntegerVar
and continuous variables ContinuousVar
in addition to binary variables BinaryVar
as decision variables. Unlike BinaryVar
, IntegerVar
and ContinuousVar
require setting lower and upper bounds.
import jijmodeling as jm
# Integer variable with lower bound 0 and upper bound 10
x = jm.IntegerVar("x", lower_bound=0, upper_bound=10)
# Continuous variable with lower bound 0 and upper bound 2.5
y = jm.ContinuousVar("y", lower_bound=0.0, upper_bound=2.5)
Additionally, jijmodeling
supports semi-integer and semi-continuous variables that take values within a range or 0.
# Integer variable taking values in the interval [3, 10] or 0
sx = jm.SemiIntegerVar("x", lower_bound=3, upper_bound=10)
# Continuous variable taking values in the interval [0.5, 2.0] or 0
sy = jm.SemiContinuousVar("y", lower_bound=0.5, upper_bound=2.0)
The lower and upper bounds of variables can be set to either Placeholder
or numerical values.
L = jm.Placeholder("Lower")
U = jm.Placeholder("Upper")
x = jm.IntegerVar("x", lower_bound=L, upper_bound=U)
y = jm.ContinuousVar("y", lower_bound=L/2, upper_bound=U*U)