Initializing help system before first use

problem.addConstraint

Purpose
Adds one or more constraints to the problem.
Synopsis
problem.addConstraint(*constraints, name=None)
Arguments
constraints 
Constraints or list/tuples/array of constraints.
name 
Optional name or names to assign to the constraints.
Example
N = 20
p = xpress.problem()
x = [p.addVariable() for i in range(N)]
c = [x[i] <= x[i+1] for i in range(N-1)]
c2 = x[0] >= x[19]
p.addConstraint(x[2] == x[4])
p.addConstraint(c, c2)
Further information
1. All constraint arguments can be single xpress.constraint objects, or lists, tuples, NumPy arrays, generators, dictionaries or other iterable collections of xpress.constraint objects.
2. If the name argument is provided, then only a single constraint or a single collection of constraints may be provided in the positional arguments. The name argument must either be a collection of names with the same dimensions as the provided constraint collection, or a single name prefix. In this case, the name for each constraint will be produced by combining the name prefix with the index of the constraint within the collection.

© 2001-2026 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.