Constraint

class flopt.constraint.Constraint(expression, _type, name=None)[source]

Constraint Class

three type constraint, == or <=

  • eq type (equal) expression == 0

  • le type (less than or equal) expression <= 0

Parameters:
  • expression (Expression family) – expression of constraint.

  • type (ConstraintType) – Constraint type (Eq or Le)

Notes

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)
clone()[source]
Return type:

Reduction