NO FRAMES

Class IloSOS2

Definition file: ilconcert/ilolinear.h
For ILOG CPLEX: represents special ordered sets of type 2 (SOS2).

This handle class represents special ordered sets of type 2 (SOS2). A special ordered set of type 2 specifies a set of variables, and only two among them may take a non zero value. These two variables must be adjacent. You may assign a weight to each variable in an SOS2. This weight specifies an order among the variables. Concert Technology asserts adjacency with respect to this assigned order. If you do not assign any weights to enforce order and adjacency among the variables, then Concert Technology considers the order in which you gave the variables to the constructor of this set and the order in which you added variables later (for example, by column generation).

When you extract a model (an instance of IloModel) for an instance of IloCplex (documented in the ILOG CPLEX Reference Manual), it will use the order of the SOS2 for branching on variables.

For more details about SOS2, see the ILOG CPLEX Reference and User's Manuals. Special ordered sets of type 2 (SOS2) commonly appear in models of piecewise linear functions. Concert Technology provides direct support for piecewise linear models in IloPiecewiseLinear.

Most member functions in this class contain assert statements. For an explanation of the macro NDEBUG (a way to turn on or turn off these assert statements), see the concept Assert and NDEBUG.

See Also:

Constructor Summary
public IloSOS2()
public IloSOS2(IloSOS2I * impl)
public IloSOS2(const IloEnv env, const char * name=0)
public IloSOS2(const IloEnv env, const IloNumVarArray vars, const char * name=0)
public IloSOS2(const IloEnv env, const IloNumVarArray vars, const IloNumArray vals, const char * name=0)
Method Summary
public IloSOS2I *getImpl() const
public voidgetNumVars(IloNumVarArray variables) const
public voidgetValues(IloNumArray values) const
Inherited Methods from IloConstraint
getImpl
Inherited Methods from IloIntExprArg
getImpl
Inherited Methods from IloNumExprArg
getImpl
Inherited Methods from IloExtractable
asConstraint, asIntExpr, asModel, asNumExpr, asObjective, asVariable, end, getEnv, getId, getImpl, getName, getObject, isConstraint, isIntExpr, isModel, isNumExpr, isObjective, isVariable, setName, setObject
Constructor Detail

IloSOS2

public IloSOS2()
This constructor creates an empty handle. You must initialize it before you use it.

IloSOS2

public IloSOS2(IloSOS2I * impl)
This constructor creates a handle object from a pointer to an implementation object.

IloSOS2

public IloSOS2(const IloEnv env, const char * name=0)

This constructor creates a special ordered set of type 2 (SOS2). You must add the variables to this set for them to be taken into account.


IloSOS2

public IloSOS2(const IloEnv env, const IloNumVarArray vars, const char * name=0)

This constructor creates a special ordered set of type 2 (SOS2). The set includes each of the variables specified in the array vars.


IloSOS2

public IloSOS2(const IloEnv env, const IloNumVarArray vars, const IloNumArray vals, const char * name=0)

This constructor creates a special ordered set of type 2 (SOS2). The set includes the variables specified in the array vars. The corresponding value in vals specifies the weight of each variable in vars.


Method Detail

getImpl

public IloSOS2I * getImpl() const
This member function returns a pointer to the implementation object of the invoking handle.

getNumVars

public void getNumVars(IloNumVarArray variables) const

This member function accesses the variables in a special ordered set of type 2 (SOS2) and puts those variables into its argument variables.


getValues

public void getValues(IloNumArray values) const

This member function accesses the weights of the variables in a special ordered set of type 2 (SOS2) and puts those weights into its argument values.