lpSolveAPI (version 5.5.2.0-17.6)

add.SOS: Add A Special Ordered Set Constraint

Description

Add a Special Ordered Set (SOS) constraint to an lpSolve linear program model object.

Usage

add.SOS(lprec, name, type, priority, columns, weights)

Arguments

lprec

an lpSolve linear program model object.

name

a character string specifying a name for the SOS constraint.

type

a positive integer specifying the type of the SOS constraint.

priority

an integer specifying the priority of the SOS constraint.

columns

a numeric vector of unique values from the set {1, …, n} (where n is the number of decision variables in lprec) indicating which decision variables belong to the special ordered set.

weights

a numeric vector the same length as columns specifying the variable weights.

Value

If the operation was successful: a single integer value containing the list index of the new special ordered set. A return value of 0 indicates an error.

References

http://lpsolve.sourceforge.net/5.5/index.htm