|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
IloConversion
objects allow you to locally change the type of
one or more variables.
When a variable is created, its type is determined to be one of
Int
, Float
, or Bool
. The
type of a variable can be queried with the method
IloNumVar.getType()
. It cannot be changed throughout the
lifetime of the variable.
However, it is sometimes necessary to consider a model where, for example,
some integer variables are relaxed to be continuous. This is achieved
using objects of type IloConversion
. By adding an
IloConversion
object to a model, you can change the types of
the variables represented in the IloConversion
object for
that model only. When solving the model, the changed types are
used instead of the original types of the variables. Method
IloNumVar.getType()
still returns the original variable
types.
The type of a variable can be changed only once per model. An attempt
to add more than one IloConversion
object to a model
containing the same variable will cause an exception to be thrown.
To change the type of a variable more than once, you must remove the
existing IloConversion
object before adding a new
IloConversion
object. Removing the conversion object for a
variable from the model will
reinstantiate the original type of variable within that model.
IloNumVarType
,
IloMPModeler.conversion(ilog.concert.IloNumVar, ilog.concert.IloNumVarType)
Method Summary | |
ilog.concert.IloNumVarType |
getType(ilog.concert.IloNumVar var)
Returns the variable type to which the invoking IloConversion
object converts variable var . |
Methods inherited from interface ilog.concert.IloAddable |
getName, setName |
Method Detail |
public ilog.concert.IloNumVarType getType(ilog.concert.IloNumVar var)
IloConversion
object converts variable var
. If the invoking
IloConversion
object does not specify a type for that variable, null
is
returned instead.
var
- The variable to be queried for type.
var
is converted.IloNumVarType
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |