problem.addConstraint
problem.addConstraint |
Purpose
Adds one or more constraints to the problem.
Synopsis
problem.addConstraint(c1, c2, ...)
Argument
c1,c2...
|
Constraints or list/tuples/array of constraints created with the
xpress.constraint() call.
|
Example
N = 20 x = [xpress.var() for i in range(N)] c = [x[i] <= x[i+1] for i in range(N-1)] c2 = x[0] >= x[19] p = xpress.problem() p.addVariable(x) p.addConstraint(x[2] == x[4]) p.addConstraint(c, c2)
Further information
All arguments can be single constraints or lists, tuples, or NumPy arrays of constraints created as
xpress.constraint objects. Arguments do not need to be declared prior to the call.