Initializing help system before first use

xpress.sos

Description
Class representing special ordered set (SOS) constraints. A SOS constraint is a modeling tool for constraining a small number of consecutive variables in a vector to be nonzero.
Constructors
Related topics

Constructor detail

xpress.sos
Synopsis
s = xpress.sos(indices, weights, type=1, name='') (deprecated)
Use problem.addSOS to add linked SOS constraints to the problem instead.
Arguments
indices 
List of variables composing the SOS.
weights 
List of weights (one per variable). These define the order for SOS2 constraints and may be used in branching for both types.
type 
Type of SOS. Can be 1 (default) or 2.
name 
Name of the SOS.
Description
1. Weights must be sufficiently distinct (see the SOSREFTOL control in the Optimizer manual).
2. Unlinked SOS constraints are not tied to a problem but may exist globally in a Python program. In order for them to be included into a problem, they have to be explicitly added to that problem using problem.addSOS. Unlinked SOS constraints are deprecated.
Example
The following are example declarations of SOS:
x = [xp.var() for _ in range(10)]
set1 = xp.sos(x, [0.5 + i*0.1 for i in range(10)], type=2)
v1, v2 = xp.vars(2)
set2 = xp.sos([v1, v2], [2, 5], 2, "mysos")
One or more SOS can be added to a problem via the addSOS method:
n = 10
w = [xp.var() for i in range(n)]
p = xp.problem(w)
p.addSOS([
  xp.sos([w[i], w[i+1]], [2,3])
  for i in range(n-1)
])


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