Model.Sos2 Method

Solver Foundation 3.0

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Creates a constraint for a special ordered set reference row.

Namespace:  Microsoft.SolverFoundation.Services
Assembly:  Microsoft.Solver.Foundation (in Microsoft.Solver.Foundation.dll)

public static Term Sos2(
	Term referenceRow


Type: Microsoft.SolverFoundation.Services.Term
A reference row.

Return Value

Type: Microsoft.SolverFoundation.Services.Term
A constraint for a special ordered type 2 set.

The input must be a constraint of the form x == c1 * d1 + c2 * d2 + ...

where cN are constants and dN are decisions. The order of the equality matters. None of the constants can be zero, and the same constant cannot appear more than once. The result of this is the equality constraint given, with additional requirements: the sum of the dN decisions must be 1, at most two of the dN decisions can be nonzero, and any nonzero dN decisions must be adjacent in the list that is produced by sorting the dN decisions by the corresponding cN constraints.