|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface defines the API for integer variables. Objects of this type represent integer modeling variables.
Variables are characterized by their bounds and their type. The bounds can
be changed after construction using the methods setLB()
and setUB()
.
However, the type of a variable cannot be changed after construction. The
type of an integer variable will be IloNumVarType.Int
throughout its lifetime.
Variables may be assigned a name using the method setName()
. The
name can be queried with the method getName()
. Assigning
a name is not required. By default, newly created variables will be created
without an assigned name unless a name is specified in the construction.
Unlike other modeling objects of type IloAddable
, variables
cannot be added directly to a model. Variables can only be part of a model
implicitly, when they are used by another modeling object such as a
constraint that has been added to the model.
Integer variables are generally created using any of the following methods.
Note that IloMPModeler
is available to users of ILOG CPLEX.
- IloModeler.intVar()
- IloModeler.intVarArray()
- IloMPModeler.intVar()
- IloMPModeler.intVarArray()
- IloModeler.boolVar()
- IloModeler.boolVarArray()
- IloMPModeler.boolVar()
- IloMPModeler.boolVarArray()
Integer variables can also be created with the methods:
IloModeler.numVar(), IloModeler.numVarArray(), IloMPModeler.numVar(),
and IloMPModeler.numVarArray()
by passing a parameter to variable type
IloNumVarType.Int
or IloNumVarType.Bool
. However,
this causes the compile-time information about the type of the variable to be lost.
This may incur a runtime overhead when used with certain optimizers.
This is documented for the optimizers only where it is relevant.
As with numerical variables, IloNumVar
integer variables can be
created separately or in a column-wise way. This means that when a
variable is created it is immediately installed in existing modeling
objects. Use objects of type IloColumn
and IloColumnArray
to
achieve this.
IloNumVar
,
IloNumVarType
,
IloNumExpr
,
IloIntExpr
,
IloModeler.intVar(int, int, java.lang.String)
,
IloModeler.intVarArray(int, int, int)
Method Summary | |
int |
getMax()
Returns the initial maximum value for this integer variable. |
int |
getMin()
Returns the initial minimum value for this integer variable. |
void |
setMax(int max)
Sets a new initial maximum for this integer variable. |
void |
setMin(int min)
Sets a new initial minimum for this integer variable. |
Methods inherited from interface ilog.concert.IloNumVar |
getLB, getName, getType, getUB, setLB, setName, setUB |
Method Detail |
public int getMin() throws IloException
IloException
public int getMax() throws IloException
IloException
public void setMin(int min) throws IloException
IloException
public void setMax(int max) throws IloException
IloException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |