public interface IloIntVar extends IloIntExpr, IloNumVar, ilog.concert.IloIntCollectionVar
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.
Integer variables are generally created using any of the following methods.
Note that IloMPModeler
is available to users of 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.
Modifier and Type | Method and Description |
---|---|
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.
|
int getMin() throws IloException
IloException
int getMax() throws IloException
IloException
void setMin(int min) throws IloException
IloException
void setMax(int max) throws IloException
IloException