- class flopt.constraint.Constraint(expression, _type, name=None)¶
three type constraint, == or <=
eq type (equal) expression == 0
le type (less than or equal) expression <= 0
expression (Expression family) – expression of constraint.
type (ConstraintType) – Constraint type (Eq or Le)
For some types, the constraint class may not be created if the constant is placed on the left side.
import flopt import numpy as np a = flopt.Variable('a', cat='Binary') np.float64(0) <= a >>> True a >= np.float64(0) >>> Constraint(Expression(-1, a, *), Le, None)
- Return type