xpress.constraint
Class for linear, quadratic, and nonlinear constraints.
c = xpress.constraint (constraint=None, body=None, lb=-xpress.infinity, ub=xpress.infinity, sense=None, rhs=None, name='')
constraint
|
The constraint, written as a
==,
<=, or
>= condition between two expressions. Variables can appear on either or both sides of the sign. Example: x1 + 2 * x2 <= 4
|
body
|
An expression indicating the function to be constrained between
lb and
ub or by
rhs with an assigned
sense. It should not be used when
constraint is defined. Example: 3 * x1 + x2
|
lb
|
Lower bound on
body.
|
ub
|
Upper bound on
body.
|
sense
|
Sign of the constraint: one of
xpress.leq,
xpress.eq,
xpress.geq, or
xpress.rng.
|
rhs
|
Right-hand side of the constraint if
sense is defined. It may not be specified if
lb or
ub are.
|
name
|
Name of the constraint (string).
|
myconstr = x1 + x2 * (x2 + 1) <= 4
m.addConstraint(myconstr) m.addConstraint(v1 + v2 <= 3) m.addConstraint(x[i] + y[i] <= 2 for i in range (10))
m.addConstraint(xp.Sum ([y[i] for i in range (10)]) <= 1) m.addConstraint(xp.Sum ([x[i]**2 for i in range (9)]) <= x[9])
© 2001-2021 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.