Skip to main content
PREV CLASS NEXT CLASS

 

Class IloCplex

IloObject
   |
   +--IloCplex

Description:

Uses CPLEX parameter names as property names to change their value. For example, the following code line:

  cplex.tilim = 13;
changes the time limit.
Example:
dvar int x[1..20] in 0..40;

maximize sum(i in 1..20) x[i];

subject to {
  x[1]==0; 
  forall(i in 1..19) x[i+1]-x[i]<=2;  
}

execute {
  writeln(cplex.getObjValue());  
}
Iterating properties:
Iterates on the names of the CPLEX parameters, the values of which are different from their default.
Index resolution:
Default behavior.
Available for:
flow control

Constructor Summary
Constructor Attributes Constructor Name and Description
 
Property Summary
Field Attributes Field Name and Description
flow control
The number of solutions currently in the solution pool.
flow control
Status of the last method invoked on this object.
Method Summary
Method Attributes Method Name and Description
all
addCut(ct)
Adds the constraint ct as a cut to the invoking IloCplex object.
all
addCuts(cts)
Adds the constraints in the array cts as cuts to the invoking IloCplex object.
all
addDiversityFilter(lb, ub, dvars, weights, refs, name)
Creates and installs a named diversity filter, for the designated decision variables, with the specified lower and upper cutoff values, reference values, and weights.
all
Adds ct as a lazy constraint to the invoking IloCplex object.
all
Adds cts as an array of lazy constraints to the invoking IloCplex object.
flow control
addMIPStart(dvars, values, effort, name)
Adds a named MIP start, with the specified level of effort defined by the specified variables, and their corresponding values, to the current problem.
all
addRangeFilter(lb, ub, dvars, vals, name)
Creates a named range filter, using the specified lower bound, upper bound, decision variables, and weights.
all
Adds a constraint ct as a user cut to the invoking IloCplex object.
all
Adds an array of constraints cts as user cuts to the invoking IloCplex object.
all
basicPresolve(dvars, lbs, ubs, ranges, redundants)
Computes tighter bounds for the variables of a model and detects redundant constraints in the model extracted to the invoking IloCplex object.
flow control
changeMIPStart(mipstartindex, dvars, values, effort)
Changes the MIP start, designated by its index, by assigning corresponding values to the designated variables, and by associating the specified level of effort.
postprocessing
flow control
Deletes all cuts that were previously added to the invoking IloCplex object with the methods addCut and addCuts.
flow control
Deletes all lazy constraints added to the invoking IloCplex object with the methods addLazyConstraint and addLazyConstraints.
flow control
Resets CPLEX to accept another CPLEX model.
flow control
Deletes all user cuts that were previously added to the invoking IloCplex object with the methods addUserCut and addUserCuts.
postprocessing
flow control
conversion(dvar, type, name)
Creates an IloConversion object, with the specified name, for converting the type of a variable in a model.
all
Copy a CPLEX VM Config file.
all
delDirection(dvar)
Removes any existing branching direction assignment from the variable dvar.
all
delDirections(dvars)
Removes any existing branching direction assignments from all variables in the array dvars.
flow control
deleteMIPStarts(first, nb)
Deletes the designated number of MIP starts, starting from the MIP start specified by its index.
flow control
Deletes the specified annotation.
flow control
Deletes the specified annotation.
all
delPriorities(dvars)
Removes any existing priority order assignments from all variables in the array dvars.
all
delPriority(dvar)
Removes any existing priority order assignment from the variable dvar.
all
delSolnPoolSoln(begin, end)
Deletes the specified solution from the solution pool and renumbers the indices of the remaining solutions in the pool.
all
delSolnPoolSolns(first, end)
Deletes a range of solutions from the solution pool and renumbers the indices of the remaining solutions in the pool.
all
Deletes a CPLEX VM Config file.
all
dualFarkas(cts, values)
Returns a Farkas proof of infeasibility for the active LP model after it has been proven to be infeasible by one of the simplex optimizers.
flow control
exportModel(path)
Exports the CPLEX model to a file.
all
This method frees the presolved problem.
all
getAX(range)
Computes A times X, where A is the corresponding LP constraint matrix.
postprocessing
flow control
Accesses the currently best known bound on the optimal solution value of the problem.
flow control
getCoef(ct, dvar)
returns the coefficient of the variable in the constraint; returns 0 if not mentioned.
flow control
postprocessing
Returns the IBM ILOG CPLEX status.
postprocessing
flow control
Returns a time stamp.
flow control
Returns the MIP cutoff value being used during the MIP optimization.
postprocessing
flow control
Returns a deterministic time stamp in ticks.
all
getDirection(dvar)
Gets the branching direction of a decision variable.
flow control
Returns the node number where the current incumbent was found.
all
Returns the infeasibility of the decision variable dvar in the current solution.
all
getLb(range)
Queries the lower bound of the ranged constraints.
flow control
getLongAnnotation(name, extr)
Queries the annotation value assigned to the variable or constraint by the specified annotation.
flow control
getLongAnnotations(name, arr)
Queries the annotation value assigned to the variables or constraints by the specified annotation.
postprocessing
flow control
Accesses the relative objective gap for a MIP optimization For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
postprocessing
flow control
getMIPStart(mipstartindex, dvars, values, isset)
Returns the level of effort associated with the MIP start identified by mipstartindex and defined by the arrays dvars and vals.
postprocessing
flow control
Returns the index of the MIP start designated by its name.
postprocessing
flow control
getMIPStartName(mipstartindex)
Returns the name of the MIP start identified by its index.
postprocessing
flow control
getMultiObjInfo(info, num)
return the requested solution info of a sub-problem of a multi-objective problem.
postprocessing
flow control
return the number of sub-problems that where successfully solved during the last optimization of a multi-objective problem.
flow control
Returns the number of barrier iterations from the last solve.
postprocessing
flow control
Returns the number of binary variables in the matrix representation of the active model in the invoking IloCplex object.
postprocessing
flow control
Accesses the number of columns extracted for the invoking algorithm.
flow control
Returns the number of dual exchange operations in the crossover of the last call to the solve method, if barrier with crossover was used for solving an LP or QP.
flow control
Returns the number of dual push operations in the crossover of the last call to the solve method, if barrier with crossover was used for solving an LP or QP.
flow control
Returns the number of primal exchange operations in the crossover of the last call of the solve method, if barrier with crossover was used for solving an LP or QP.
flow control
Returns the number of primal push operations in the crossover of the last call of the solve method, if barrier with crossover was used for solving an LP or QP.
flow control
Returns the number of dual superbasic variables in the current solution of the invoking IloCplex object.
postprocessing
flow control
Returns the number of filters currently associated with the solution pool.
postprocessing
flow control
Returns the number of integer variables in the matrix representation of the active model in the invoking IloCplex object.
postprocessing
flow control
Accesses the total number of iterations executed so far during the current optimization to solve the node relaxations.
postprocessing
flow control
Returns the number of MIP starts associated with the current problem.
postprocessing
flow control
Accesses the number of nodes already processed in the current optimization.
postprocessing
flow control
Accesses the number of branch-and-cut nodes that remain to be processed in the current solution.
postprocessing
flow control
Accesses the number of nonzeros extracted to the constraint matrix A of the invoking algorithm.
flow control
If a simplex method was used for solving a continuous model, this method returns the number of iterations in phase one of the last call to the solve method.
flow control
Returns the number of primal superbasic variables in the current solution of the invoking IloCplex object.
postprocessing
flow control
Returns the number of quadratic constraints extracted from the active model for the invoking algorithm.
postprocessing
flow control
Accesses the number of rows extracted for the invoking algorithm.
flow control
Returns the number of semicontinuous variables in the matrix representation of the active model in the invoking IloCplex object.
flow control
Returns the number of semi-integer variables in the matrix representation of the active model in the invoking IloCplex object.
flow control
Returns the number of sifting iterations performed for solving the last LP with algorithm type Sifting, or, equivalently, the number of work LPs that have been solved for it.
flow control
Returns the number of sifting iterations performed for solving the last LP with algorithm type Sifting in order to achieve primal feasibility.
postprocessing
flow control
Returns the number of SOSs extracted for the invoking algorithm.
flow control
getNumAnnotation(name, extr)
Queries the annotation value assigned to the variable or constraint by the specified annotation.
flow control
getNumAnnotations(name, arr)
Queries the annotation value assigned to the variables or constraints by the specified annotation.
flow control
Returns the number of logical cores on the platform where CPLEX is currently running.
flow control
getObjCoef(dvar)
Returns the coefficient of a decision variable in the objective expression.
postprocessing
flow control
Accesses the objective value of the current solution or the solution identifier from the solution pool.
all
getPriorities(priorities, dvars)
Returns query branch priorities previously assigned to variables listed in dvars with the method setPriority or setPriorities.
all
getPriority(dvar)
Accesses the priority level of a decision variable.
flow control
Computes the mean of the objective values of the solutions currently in the solution pool.
flow control
Accesses the number of solutions that have been replaced according to the solution pool replacement strategy.
flow control
Accesses the number of solutions currently in the solution pool.
postprocessing
flow control
Returns the time it took to solve.
all
getUb(range)
Queries the upper bound of the ranged constraints.
flow control
This method returns a string specifying the version of CPLEX.
flow control
Queries whether an IloInt-valued annotation of the specified name is available in the IloCplex object.
flow control
Queries whether an IloNum-valued annotation of the specified name is available in the IloCplex object.
all
Returns if the CPLEX has a VM Config file.
flow control
importModel(path)
Imports the CPLEX model from a file.
flow control
Returns true if a dual feasible solution is recorded in the invoking IloCplex object and can be queried.
postprocessing
flow control
isMIP()
This method returns true if the invoking algorithm has extracted a model that is a MIP (mixed-integer programming problem) and false otherwise.
flow control
Returns true if a primal feasible solution is recorded in the invoking IloCplex object and can be queried.
flow control
isQC()
Returns true if the invoking algorithm has extracted a model that is quadratically constrained.
flow control
isQO()
Returns true if the invoking algorithm has extracted a model that has quadratic objective function terms.
flow control
newLongAnnotation(name, value)
Creates a new annotation of type IloInt for the specified name and assigns the specified default value to all modeling objects in the current IloCplex object.
flow control
newNumAnnotation(name, value)
Creates a new annotation of type IloNum for the specified name and assigns the specified default value to all modeling objects in the current IloCplex object.
flow control
Queries the number of annotations of type IloInt.
flow control
Queries the number of annotations of type IloNum.
flow control
Populates the solution pool.
all
Specifies an array of decision variables that should not be substituted out of the problem.
all
qpIndefCertificate(dvars, vals)
Computes assignments (returned in array vals) to all variables (returned in array dvars) such that the quadratic term of the objective function evaluates to a negative value to prove the indefiniteness.
flow control
Reads annotations from the file with the specified name and installs them in the IloCplex object.
flow control
readBasis(file)
Reads the CPLEX basis from a file.
postprocessing
flow control
Reads the MST file denoted by name and copies the MIP start information into the invoking IloCplex object.
postprocessing
flow control
readOrder(name)
Reads a priority order from a file in ORD format into the invoking IloCplex object.
all
readVMConfig(file)
Reads a CPLEX VM Config file.
all
setArrayBounds(cts, lbs, ubs)
Sets the bounds of an array of constraints
flow control
setArrayCoefs(ct, dvars, coefs)
Sets the coefficients for an array of decision variables in a constraint.
all
setArrayLbs(cts, lbs)
Sets the lower bounds of an array of constraints.
all
setArrayUbs(cts, ubs)
Sets the upper bounds of an array of constraints.
all
setBounds(ranges, lbs, ubs)
Sets the lower and upper bounds of the ranged constraints.
flow control
setCoef(ct, dvar, coef)
Sets the coefficient of a decision variable in the constraint.
all
setDirection(dvar, direction)
Defines the branching direction of a decision variable.
all
setLb(range, lb)
Sets the lower bound of the ranged constraints.
flow control
setLongAnnotation(name, extr, value)
Assigns value as the value of the annotation of the variable or constraint for the specified annotation.
flow control
setLongAnnotations(name, extrs, value)
Assigns values as the values of the annotation of the variables or constraints for the specified annotation.
flow control
setNumAnnotation(name, extr, value)
Assigns value as the value of the annotation of the variable or constraint for the specified annotation.
flow control
setNumAnnotations(name, extrs, value)
Assigns values as the values of the annotation of the variables or constraints for the specified annotation.
flow control
setObjCoef(dvar, coef)
Sets the coefficient of a decision variable in the objective expression.
all
setPriorities(dvars, priorities)
Sets the priority order for all variables in the array dvars to the corresponding value in the array priorities.
all
setPriority(dvar, priority)
Sets the priority order of a decision variable.
all
setUb(range, ub)
Sets the upper bound of the ranged constraints.
flow control
solve()
Solves the model currently extracted to the invoking IloCplex object.
flow control
solveFixed(optional)
Solves the fixed active model using a solution from the solution pool.
flow control
Writes all annotations of the IloCplex object to the file with the specified name.
flow control
writeBasis(file)
Writes the current CPLEX basis to the specified file.
flow control
Writes the annotation that CPLEX would generate automatically for Benders decomposition to a file with the specified name.
postprocessing
flow control
writeMIPStarts(name, first, nb)

Writes MIP start information to the file denoted by name.

Methods inherited from class IloObject
end
Constructor Detail
IloCplex
IloCplex()
Property Detail
solnPoolNsolns
{int} solnPoolNsolns
The number of solutions currently in the solution pool. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Available for:
flow control

status
{int} status
Status of the last method invoked on this object. See the section CPLEX solution status in Language User's Manual > ILOG Script for OPL > Introduction to scripting > Preprocessing and postprocessing > Changing option values > Changing CPLEX parameters for details of the solution status codes.
Available for:
flow control
Method Detail
addCut
addCut(ct)
Adds the constraint ct as a cut to the invoking IloCplex object. The cut is not extracted in the same way as the regular constraints in a model, but is only copied when the method addCut is invoked. Thus, ct may be deleted or modified after addCut has been called and notification of the change will not be sent to the invoking IloCplex object. When columns are deleted from the extracted model, all cuts are deleted as well and need to be re-extracted if they should be considered. Cuts are not part of the root problem, but are considered on an as-needed basis. A solution computed by IloCplex is guaranteed to satisfy all cuts added with this method.
Parameters:
ct - A constraint.
Available for:
all

addCuts
addCuts(cts)
Adds the constraints in the array cts as cuts to the invoking IloCplex object. Everything said for addCut applies equally to each of the cuts given in the array cts.
Parameters:
cts - An array of constraints.
Available for:
all

addDiversityFilter
addDiversityFilter(lb, ub, dvars, weights, refs, name)
Creates and installs a named diversity filter, for the designated decision variables, with the specified lower and upper cutoff values, reference values, and weights. For more information on addDiversityFilter, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
lb - A lower bound.
ub - An upper bound.
dvars - An array with decision variables. Use built-in arrays.
weights - An array with weights. Use built-in arrays.
refs - An array with reference values. Use built-in arrays.
name - Optional: The name of the filter
Available for:
all

addLazyConstraint
addLazyConstraint(ct)
Adds ct as a lazy constraint to the invoking IloCplex object. For more information on addLazyConstraint, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
ct - A constraint.
Available for:
all

addLazyConstraints
addLazyConstraints(cts)
Adds cts as an array of lazy constraints to the invoking IloCplex object. For more information on addLazyConstraints, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
cts - An array of constraints.
Available for:
all

addMIPStart
addMIPStart(dvars, values, effort, name)
Adds a named MIP start, with the specified level of effort defined by the specified variables, and their corresponding values, to the current problem. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
dvars - An array with decision variables. Use built-in arrays.
values - An array with values. Use built-in arrays.
effort - Optional: level of effort.
name - Optional: the name of the MIP Start
Available for:
flow control

addRangeFilter
addRangeFilter(lb, ub, dvars, vals, name)
Creates a named range filter, using the specified lower bound, upper bound, decision variables, and weights. Adds the filter to the solution pool of the invoking model, and returns the index of the filter. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
lb - A lower bound.
ub - An upper bound.
dvars - An array with decision variables. Use built-in arrays.
vals - An array with values. Use built-in arrays.
name - Optional: The name of the filter
Available for:
all

addUserCut
addUserCut(ct)
Adds a constraint ct as a user cut to the invoking IloCplex object. The constraint ct is copied into the user cut pool; the ct itself is not part of the pool, so changes to ct after it has been copied into the user cut pool will not affect the user cut pool. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
ct - A constraint.
Available for:
all

addUserCuts
addUserCuts(cts)
Adds an array of constraints cts as user cuts to the invoking IloCplex object. Everything said for addUserCut applies to each of the user cuts given in the array cts. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
cts - An array of constraints.
Available for:
all

basicPresolve
basicPresolve(dvars, lbs, ubs, ranges, redundants)
Computes tighter bounds for the variables of a model and detects redundant constraints in the model extracted to the invoking IloCplex object. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
dvars - An array.
lbs - An array.
ubs - An array.
ranges - An array.
redundants - An array.
Available for:
all

changeMIPStart
changeMIPStart(mipstartindex, dvars, values, effort)
Changes the MIP start, designated by its index, by assigning corresponding values to the designated variables, and by associating the specified level of effort. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
mipstartindex - MIP start index.
dvars - An array with decision variables. Use built-in arrays.
values - An array with values. Use built-in arrays.
effort - Optional level of effort.
Available for:
flow control

clearCuts
{void} clearCuts()
Deletes all cuts that were previously added to the invoking IloCplex object with the methods addCut and addCuts.
Available for:
postprocessing
flow control

clearLazyConstraints
{void} clearLazyConstraints()
Deletes all lazy constraints added to the invoking IloCplex object with the methods addLazyConstraint and addLazyConstraints. This method is equivalent to clearCuts. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Available for:
flow control

clearModel
clearModel()
Resets CPLEX to accept another CPLEX model.
Available for:
flow control

clearUserCuts
{void} clearUserCuts()
Deletes all user cuts that were previously added to the invoking IloCplex object with the methods addUserCut and addUserCuts. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Available for:
flow control

conversion
conversion(dvar, type, name)
Creates an IloConversion object, with the specified name, for converting the type of a variable in a model. The type is one of "ILOINT", "ILOFLOAT", "ILOBOOL". For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
dvar - The variable, the type of which is to be converted.
type - The converted type for variable dvar.
name - Optional name of the new IloConversion object.
Available for:
postprocessing
flow control

copyVMConfig
{void} copyVMConfig(xml)
Copy a CPLEX VM Config file.
Parameters:
xml - CPLEX VM Config XML string.
Available for:
all

delDirection
delDirection(dvar)
Removes any existing branching direction assignment from the variable dvar.
Parameters:
dvar - A variable.
Available for:
all

delDirections
delDirections(dvars)
Removes any existing branching direction assignments from all variables in the array dvars.
Parameters:
dvars - An array of variables.
Available for:
all

deleteMIPStarts
deleteMIPStarts(first, nb)
Deletes the designated number of MIP starts, starting from the MIP start specified by its index.
Parameters:
first - MIP start index to start deleting from.
nb - Number of MIP starts to delete.
Available for:
flow control

delLongAnnotation
delLongAnnotation(name)
Deletes the specified annotation. This method is experimental.
Parameters:
name - Name of the annotation.
Available for:
flow control

delNumAnnotation
delNumAnnotation(name)
Deletes the specified annotation. This method is experimental.
Parameters:
name - Name of the annotation.
Available for:
flow control

delPriorities
delPriorities(dvars)
Removes any existing priority order assignments from all variables in the array dvars.
Parameters:
dvars - An array of variables.
Available for:
all

delPriority
delPriority(dvar)
Removes any existing priority order assignment from the variable dvar.
Parameters:
dvar - A variable.
Available for:
all

delSolnPoolSoln
delSolnPoolSoln(begin, end)
Deletes the specified solution from the solution pool and renumbers the indices of the remaining solutions in the pool.
Parameters:
begin - A number.
end - A number.
Available for:
all

delSolnPoolSolns
{void} delSolnPoolSolns(first, end)
Deletes a range of solutions from the solution pool and renumbers the indices of the remaining solutions in the pool.
Parameters:
first - A start index.
end - An end index
Available for:
all

delVMConfig
{void} delVMConfig()
Deletes a CPLEX VM Config file.
Available for:
all

dualFarkas
{float} dualFarkas(cts, values)
Returns a Farkas proof of infeasibility for the active LP model after it has been proven to be infeasible by one of the simplex optimizers. For more information, see the class IloCplex in the CPLEX C++ Reference Manual..
Parameters:
cts - An array of constraints
values - An array.
Returns:
a number
Available for:
all

exportModel
exportModel(path)
Exports the CPLEX model to a file. The format depends on the extension of the file name passed (.lp, for example). Relative paths are resolved with respect to the current model file. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
path - Path of the file to which the model will be exported.
Available for:
flow control

freePresolve
{void} freePresolve()
This method frees the presolved problem. Under the default setting of parameter Reduce, the presolved problem is freed when an optimal solution is found; however, it is not freed if Reduce has been set to 1 (primal reductions) or to 2 (dual reductions). In these instances, the function freePresolve can be used when necessary to free it manually.
Available for:
all

getAX
{float} getAX(range)
Computes A times X, where A is the corresponding LP constraint matrix. Returns the value of the expression of the constraint range, or, equivalently, its activity level, for the current solution of the invoking IloCplex object. The range must be part of the extracted model.
Parameters:
range - A range.
Returns:
a number
Available for:
all

getBestObjValue
{float} getBestObjValue()
Accesses the currently best known bound on the optimal solution value of the problem. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Returns:
The currently best known bound on the optimal solution value of the problem.
Available for:
postprocessing
flow control

getCoef
{number} getCoef(ct, dvar)
returns the coefficient of the variable in the constraint; returns 0 if not mentioned.
Parameters:
ct - The constraint in which we search the coefficient.
dvar - The decision variable for which we need the coefficient.
Returns:
the coefficient of the decision variable in a constraint.
Available for:
flow control

getCplexStatus
{int} getCplexStatus()
Returns the IBM ILOG CPLEX status. See the section CPLEX solution status in Language User's Manual > ILOG Script for OPL > Introduction to scripting > Preprocessing and postprocessing > Changing option values > Changing CPLEX parameters for details of the solution status codes. See also the section Interpreting Solution Statistics in the IBM ILOG CPLEX User's Manual for more information about a status associated with infeasibility or unboundedness.
Returns:
The IBM ILOG CPLEX status.
Available for:
flow control
postprocessing

getCplexTime
{float} getCplexTime()
Returns a time stamp. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Returns:
The time stamp.
Available for:
postprocessing
flow control

getCutoff
{int} getCutoff()
Returns the MIP cutoff value being used during the MIP optimization. In a minimization problem, all nodes are pruned that have an optimal solution value of the continuous relaxation that is larger than the current cutoff value. The cutoff is updated with the incumbent. If the invoking IloCplex object is an LP or QP, this method returns +IloInfinity or -IloInfinity, depending on the optimization sense.
Available for:
flow control

getDetTime
{float} getDetTime()
Returns a deterministic time stamp in ticks.

To measure elapsed deterministic time in ticks between a starting point and ending point of an operation, take the deterministic time stamp at the starting point; take the deterministic time stamp at the ending point; subtract the starting deterministic time stamp from the ending deterministic time stamp.

The absolute value of the deterministic time stamp is not meaningful.

Returns:
The deterministic time stamp.
Available for:
postprocessing
flow control

getDirection
{string} getDirection(dvar)
Gets the branching direction of a decision variable.
Parameters:
dvar - Decision variable.
Returns:
The branching direction, one of "BranchDown", "BranchGlobal", "BranchUp".
Available for:
all

getIncumbentNode
{int} getIncumbentNode()
Returns the node number where the current incumbent was found. If the invoking IloCplex object is an LP or a QP, this method returns 0 (zero).
Available for:
flow control

getInfeasibility
getInfeasibility(dvar)
Returns the infeasibility of the decision variable dvar in the current solution. The infeasibility value returned is 0 (zero) if the variable bounds are satisfied. If the infeasibility value is negative, it specifies the amount by which the lower bound of the variable must be changed; if the value is positive, it specifies the amount by which the upper bound of the variable must be changed. This method does not check for integer infeasibility.
Parameters:
dvar - A variable or a constraint.
Returns:
a number
Available for:
all

getLb
{float} getLb(range)
Queries the lower bound of the ranged constraints.
Parameters:
range - A range of constraints.
Returns:
The lower bound of the ranged constraints.
Available for:
all

getLongAnnotation
getLongAnnotation(name, extr)
Queries the annotation value assigned to the variable or constraint by the specified annotation. This method is experimental.
Parameters:
name - Name of the annotation.
extr - a variable or a constraint.
Returns:
the value
Available for:
flow control

getLongAnnotations
getLongAnnotations(name, arr)
Queries the annotation value assigned to the variables or constraints by the specified annotation. This method is experimental.
Parameters:
name - Name of the annotation.
arr - an array of variables or constraints.
Returns:
the values
Available for:
flow control

getMIPRelativeGap
{float} getMIPRelativeGap()
Accesses the relative objective gap for a MIP optimization For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Returns:
The relative objective gap.
See also:
IloCplex#isMIP
Available for:
postprocessing
flow control

getMIPStart
{string} getMIPStart(mipstartindex, dvars, values, isset)
Returns the level of effort associated with the MIP start identified by mipstartindex and defined by the arrays dvars and vals. The argument isset designates which members of dvars and which corresponding values of values participate in the MIP start - one of: "MIPStartAuto", "MIPStartCheckFeas", "MIPStartSolveFixed", "MIPStartSolveMIP", "MIPStartRepair". For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
mipstartindex - MIP start index.
dvars - An array with decision variables. Use built-in arrays.
values - An array with values. Use built-in arrays.
isset - An array to designate which members of dvars and which corresponding values of values participate in the MIP start
Returns:
The effort level.
Available for:
postprocessing
flow control

getMIPStartIndex
{int} getMIPStartIndex(name)
Returns the index of the MIP start designated by its name. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
name - The name of the MIP start.
Returns:
the MIP start index.
Available for:
postprocessing
flow control

getMIPStartName
{string} getMIPStartName(mipstartindex)
Returns the name of the MIP start identified by its index. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
mipstartindex - MIP start index.
Returns:
The name of the MIP start.
Available for:
postprocessing
flow control

getMultiObjInfo
{float} getMultiObjInfo(info, num)
return the requested solution info of a sub-problem of a multi-objective problem. info is one of : "MultiObjTime", "MultiObjDetTime", "MultiObjObjValue", "MultiObjBestObjValue", "MultiObjError", "MultiObjStatus", "MultiObjMethod", "MultiObjPriority", "MultiObjNbarierIterations", "MultiObjNsiftingIterations", "MultiObjNsiftingPhase1Iterations", "MultiObjNdegenerateIterations", "MultiObjNiterations", "MultiObjNphase1Iterations", "MultiObjNprimalPushes", "MultiObjNprimalExchanges", "MultiObjNdualPushes", "MultiObjNdualExchanges", "MultiObjNnodes", "MultiObjNnodesLeft". For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
info - The requested info
num - The sub-problem index
Returns:
The value of the info.
Available for:
postprocessing
flow control

getMultiObjNsolves
{int} getMultiObjNsolves()
return the number of sub-problems that where successfully solved during the last optimization of a multi-objective problem.
Returns:
The number of sub-problems.
Available for:
postprocessing
flow control

getNbarrierIterations
{int} getNbarrierIterations()
Returns the number of barrier iterations from the last solve.
Available for:
flow control

getNbinVars
{int} getNbinVars()
Returns the number of binary variables in the matrix representation of the active model in the invoking IloCplex object.
Returns:
The number of binary variables.
Available for:
postprocessing
flow control

getNcols
{int} getNcols()
Accesses the number of columns extracted for the invoking algorithm. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Returns:
The number of columns.
Available for:
postprocessing
flow control

getNcrossDExch
{int} getNcrossDExch()
Returns the number of dual exchange operations in the crossover of the last call to the solve method, if barrier with crossover was used for solving an LP or QP.
Available for:
flow control

getNcrossDPush
{int} getNcrossDPush()
Returns the number of dual push operations in the crossover of the last call to the solve method, if barrier with crossover was used for solving an LP or QP.
Available for:
flow control

getNcrossPExch
{int} getNcrossPExch()
Returns the number of primal exchange operations in the crossover of the last call of the solve method, if barrier with crossover was used for solving an LP or QP.
Available for:
flow control

getNcrossPPush
{int} getNcrossPPush()
Returns the number of primal push operations in the crossover of the last call of the solve method, if barrier with crossover was used for solving an LP or QP.
Available for:
flow control

getNdualSuperbasics
{int} getNdualSuperbasics()
Returns the number of dual superbasic variables in the current solution of the invoking IloCplex object.
Available for:
flow control

getNfilters
{int} getNfilters()
Returns the number of filters currently associated with the solution pool.
Returns:
The number of filters.
Available for:
postprocessing
flow control

getNintVars
{int} getNintVars()
Returns the number of integer variables in the matrix representation of the active model in the invoking IloCplex object.
Returns:
The number of integer variables.
Available for:
postprocessing
flow control

getNiterations
{int} getNiterations()
Accesses the total number of iterations executed so far during the current optimization to solve the node relaxations.
Returns:
The priority of the given decision variable.
Available for:
postprocessing
flow control

getNMIPStarts
{int} getNMIPStarts()
Returns the number of MIP starts associated with the current problem.
Returns:
The number of MIP starts.
Available for:
postprocessing
flow control

getNnodes
{int} getNnodes()
Accesses the number of nodes already processed in the current optimization.
Returns:
The priority of the given decision variable.
Available for:
postprocessing
flow control

getNnodesLeft
{int} getNnodesLeft()
Accesses the number of branch-and-cut nodes that remain to be processed in the current solution. If the invoking CPLEX object is not a MIP, this method returns 0.
Returns:
The number of branch-and-cut nodes that remain to be processed in the current solution.
Available for:
postprocessing
flow control

getNNZs
{int} getNNZs()
Accesses the number of nonzeros extracted to the constraint matrix A of the invoking algorithm.
Returns:
The number of nonzero values.
Available for:
postprocessing
flow control

getNphaseOneIterations
{int} getNphaseOneIterations()
If a simplex method was used for solving a continuous model, this method returns the number of iterations in phase one of the last call to the solve method.
Available for:
flow control

getNprimalSuperbasics
{int} getNprimalSuperbasics()
Returns the number of primal superbasic variables in the current solution of the invoking IloCplex object.
Available for:
flow control

getNQCs
{int} getNQCs()
Returns the number of quadratic constraints extracted from the active model for the invoking algorithm. This number may be different from the total number of constraints in the active model because linear constraints are not accounted for in this function
Returns:
The number of quadratic constraints.
Available for:
postprocessing
flow control

getNrows
{int} getNrows()
Accesses the number of rows extracted for the invoking algorithm. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Returns:
The number of rows.
Available for:
postprocessing
flow control

getNsemiContVars
{int} getNsemiContVars()
Returns the number of semicontinuous variables in the matrix representation of the active model in the invoking IloCplex object.
Available for:
flow control

getNsemiIntVars
{int} getNsemiIntVars()
Returns the number of semi-integer variables in the matrix representation of the active model in the invoking IloCplex object.
Available for:
flow control

getNsiftingIterations
{int} getNsiftingIterations()
Returns the number of sifting iterations performed for solving the last LP with algorithm type Sifting, or, equivalently, the number of work LPs that have been solved for it.
Available for:
flow control

getNsiftingPhaseOneIterations
{int} getNsiftingPhaseOneIterations()
Returns the number of sifting iterations performed for solving the last LP with algorithm type Sifting in order to achieve primal feasibility.
Available for:
flow control

getNSOSs
{int} getNSOSs()
Returns the number of SOSs extracted for the invoking algorithm. There may be differences in the number returned by this function and the number of numeric variables (that is, instances of the class IloNumVar, and so forth) in the model that is extracted because piecewise linear functions are extracted as a set of SOSs.
Returns:
The number of SOSs.
Available for:
postprocessing
flow control

getNumAnnotation
getNumAnnotation(name, extr)
Queries the annotation value assigned to the variable or constraint by the specified annotation. This method is experimental.
Parameters:
name - Name of the annotation.
extr - a variable or a constraint.
Returns:
the value
Available for:
flow control

getNumAnnotations
getNumAnnotations(name, arr)
Queries the annotation value assigned to the variables or constraints by the specified annotation. This method is experimental.
Parameters:
name - Name of the annotation.
arr - an array of variables or constraints.
Returns:
the values
Available for:
flow control

getNumCores
{int} getNumCores()
Returns the number of logical cores on the platform where CPLEX is currently running.
Available for:
flow control

getObjCoef
{number} getObjCoef(dvar)
Returns the coefficient of a decision variable in the objective expression.
Parameters:
dvar - The decision variable.
Returns:
the coefficient of the decision variable in the objective expression.
Available for:
flow control

getObjValue
{float} getObjValue(i)
Accesses the objective value of the current solution or the solution identifier from the solution pool.
Parameters:
i - optional The identifier of the solution.
Returns:
The objective value of the solution identifier or of the current solution if the identifier is not specified.
Available for:
postprocessing
flow control

getPriorities
getPriorities(priorities, dvars)
Returns query branch priorities previously assigned to variables listed in dvars with the method setPriority or setPriorities. When the function returns, priorities[i] will contain the priority value assigned for variable dvars[i]. If no priority has been assigned to dvars[i], priorities[i] will contain 0 (zero).
Parameters:
priorities - An array of priorities
dvars - An array of variables.
Available for:
all

getPriority
{float} getPriority(dvar)
Accesses the priority level of a decision variable.
Parameters:
dvar - Decision variable.
Returns:
The priority level of the given decision variable.
Available for:
all

getSolnPoolMeanObjValue
{int} getSolnPoolMeanObjValue()
Computes the mean of the objective values of the solutions currently in the solution pool.
Available for:
flow control

getSolnPoolNreplaced
{int} getSolnPoolNreplaced()
Accesses the number of solutions that have been replaced according to the solution pool replacement strategy.
Available for:
flow control

getSolnPoolNsolns
{int} getSolnPoolNsolns()
Accesses the number of solutions currently in the solution pool.
Available for:
flow control

getSolvedTime
{float} getSolvedTime()
Returns the time it took to solve. It is the difference between the time stamp before the call to solve and the time stamp after the solve. For more information, see IloCplex::getCplexTime in the CPLEX C++ Reference Manual.
Returns:
The time it took to solve.
Available for:
postprocessing
flow control

getUb
{float} getUb(range)
Queries the upper bound of the ranged constraints.
Parameters:
range - A range of constraints.
Returns:
The upper bound of the ranged constraints.
Available for:
all

getVersion
getVersion()
This method returns a string specifying the version of CPLEX. This method is experimental.
Returns:
a string
Available for:
flow control

hasLongAnnotation
hasLongAnnotation()
Queries whether an IloInt-valued annotation of the specified name is available in the IloCplex object. This method is experimental.
Available for:
flow control

hasNumAnnotation
hasNumAnnotation()
Queries whether an IloNum-valued annotation of the specified name is available in the IloCplex object. This method is experimental.
Available for:
flow control

hasVMConfig
{void} hasVMConfig()
Returns if the CPLEX has a VM Config file.
Returns:
Returns true or false
Available for:
all

importModel
importModel(path)
Imports the CPLEX model from a file. The format depends on the extension of the file name passed: .lp, etc. Relative paths are resolved with respect to the current model file. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
path - Path to the file from which the model will be imported.
Available for:
flow control

isDualFeasible
{boolean} isDualFeasible()
Returns true if a dual feasible solution is recorded in the invoking IloCplex object and can be queried.
Available for:
flow control

isMIP
{boolean} isMIP()
This method returns true if the invoking algorithm has extracted a model that is a MIP (mixed-integer programming problem) and false otherwise. Methods for accessing duals and reduced cost basis work only if the model is not a MIP.
Returns:
true if it is a MIP model.
The relative objective gap.
Available for:
postprocessing
flow control

isPrimalFeasible
{boolean} isPrimalFeasible()
Returns true if a primal feasible solution is recorded in the invoking IloCplex object and can be queried.
Available for:
flow control

isQC
{boolean} isQC()
Returns true if the invoking algorithm has extracted a model that is quadratically constrained. Otherwise, it returns false. For an explanation of quadratically constrained see the document: User's Manual for CPLEX > Continuous optimization > Solving problems with quadratic constraints (QCP) > Identifying a quadratically constrained program (QCP) > Characteristics of a quadratically constrained program
Available for:
flow control

isQO
{boolean} isQO()
Returns true if the invoking algorithm has extracted a model that has quadratic objective function terms. Otherwise, it returns false. For more information, see the document: User's Manual for CPLEX > Continuous optimization > Solving problems with a quadratic objective (QP)
Available for:
flow control

newLongAnnotation
newLongAnnotation(name, value)
Creates a new annotation of type IloInt for the specified name and assigns the specified default value to all modeling objects in the current IloCplex object. This method is experimental.
Parameters:
name - Name of the annotation.
value - optional, default value, 0 otherwise.
Available for:
flow control

newNumAnnotation
newNumAnnotation(name, value)
Creates a new annotation of type IloNum for the specified name and assigns the specified default value to all modeling objects in the current IloCplex object. This method is experimental.
Parameters:
name - Name of the annotation.
value - optional, default value, 0 otherwise.
Available for:
flow control

numLongAnnotations
numLongAnnotations()
Queries the number of annotations of type IloInt. This method is experimental.
Available for:
flow control

numNumAnnotations
numNumAnnotations()
Queries the number of annotations of type IloNum. This method is experimental.
Available for:
flow control

populate
{boolean} populate()
Populates the solution pool. For more information on populate, see the class IloCplex in the CPLEX C++ Reference Manual.
Returns:
true if the populate has been successful.
Available for:
flow control

protectVariables
protectVariables(dvars)
Specifies an array of decision variables that should not be substituted out of the problem. If presolve can fix a variable to a value, it is removed, even if it is specified in the protected list. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
dvars - An array of variables.
Available for:
all

qpIndefCertificate
qpIndefCertificate(dvars, vals)
Computes assignments (returned in array vals) to all variables (returned in array dvars) such that the quadratic term of the objective function evaluates to a negative value to prove the indefiniteness. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
dvars - An array of variables
vals - An array of floats
Available for:
all

readAnnotations
readAnnotations(path)
Reads annotations from the file with the specified name and installs them in the IloCplex object. This method is experimental.
Parameters:
path - Path to the file.
Available for:
flow control

readBasis
readBasis(file)
Reads the CPLEX basis from a file. See the class IloCplex in IDE and OPL - OPL Interfaces - C++ interface reference manual - optim.cplex.cpp - Classes
Parameters:
file - File from which the basis will be imported.
Available for:
flow control

readMIPStarts
{void} readMIPStarts(name)
Reads the MST file denoted by name and copies the MIP start information into the invoking IloCplex object. The parameter AdvInd must be turned on (its default is 1 (one)) in order for the MIP start information to be used with a subsequent MIP optimization.

By convention, the file extension is .mst. The MST file format is documented in the reference manual CPLEX File Formats and in the stylesheet solution.xsl and schema solution.xsd in the include directory of the product. Examples of its use appear in the examples distributed with the product and in the CPLEX User's Manual.

Parameters:
name - The MSR file name.
Available for:
postprocessing
flow control

readOrder
{void} readOrder(name)
Reads a priority order from a file in ORD format into the invoking IloCplex object. The names in the ORD file must match the names in the active model. The priority order will be associated with the model. The parameter MipOrdInd must be nonzero for the next invocation of the method IloCplex.solve to take the order into account.

By convention, the file extension is .ord. The ORD file format is documented in the reference manual CPLEX File Formats.

Parameters:
name - The file name.
Available for:
postprocessing
flow control

readVMConfig
{void} readVMConfig(file)
Reads a CPLEX VM Config file.
Parameters:
file - CPLEX VM Config file.
Available for:
all

setArrayBounds
setArrayBounds(cts, lbs, ubs)
Sets the bounds of an array of constraints
Parameters:
cts - An array of constraints.
lbs - Lower bounds.
ubs - Upper bounds.
Available for:
all

setArrayCoefs
setArrayCoefs(ct, dvars, coefs)
Sets the coefficients for an array of decision variables in a constraint.
Parameters:
ct - The linear constraint
dvars - The array of decision variables new coefficient.
coefs - The array of new coefficients (same size as variable array)
Available for:
flow control

setArrayLbs
setArrayLbs(cts, lbs)
Sets the lower bounds of an array of constraints.
Parameters:
cts - An array of constraints.
lbs - Lower bounds.
Available for:
all

setArrayUbs
setArrayUbs(cts, ubs)
Sets the upper bounds of an array of constraints.
Parameters:
cts - An array of constraints.
ubs - Upper bounds.
Available for:
all

setBounds
setBounds(ranges, lbs, ubs)
Sets the lower and upper bounds of the ranged constraints.
Parameters:
ranges - An array of ranges.
lbs - An array of lower bounds.
ubs - An array of upper bounds.
Available for:
all

setCoef
setCoef(ct, dvar, coef)
Sets the coefficient of a decision variable in the constraint.
Parameters:
ct - Constraint (must be a range).
dvar - The decision variable.
coef - The new coefficient.
Available for:
flow control

setDirection
setDirection(dvar, direction)
Defines the branching direction of a decision variable.
Parameters:
dvar - Decision variable.
direction - The branching direction, one of "BranchDown", "BranchGlobal", "BranchUp".
Available for:
all

setLb
setLb(range, lb)
Sets the lower bound of the ranged constraints.
Parameters:
range - A range of constraints.
lb - A lower bound.
Available for:
all

setLongAnnotation
setLongAnnotation(name, extr, value)
Assigns value as the value of the annotation of the variable or constraint for the specified annotation. This method is experimental.
Parameters:
name - Name of the annotation.
extr - a variable or a constraint.
value - value to be set.
Available for:
flow control

setLongAnnotations
setLongAnnotations(name, extrs, value)
Assigns values as the values of the annotation of the variables or constraints for the specified annotation. This method is experimental.
Parameters:
name - Name of the annotation.
extrs - an array of variables or constraints.
value - an array of values to be set.
Available for:
flow control

setNumAnnotation
setNumAnnotation(name, extr, value)
Assigns value as the value of the annotation of the variable or constraint for the specified annotation. This method is experimental.
Parameters:
name - Name of the annotation.
extr - a variable or a constraint.
value - value to be set.
Available for:
flow control

setNumAnnotations
setNumAnnotations(name, extrs, value)
Assigns values as the values of the annotation of the variables or constraints for the specified annotation. This method is experimental.
Parameters:
name - Name of the annotation.
extrs - an array of variables or constraints.
value - an array of values to be set.
Available for:
flow control

setObjCoef
setObjCoef(dvar, coef)
Sets the coefficient of a decision variable in the objective expression.
Parameters:
dvar - The decision variable.
coef - The new coefficient.
Available for:
flow control

setPriorities
setPriorities(dvars, priorities)
Sets the priority order for all variables in the array dvars to the corresponding value in the array priorities. For more information, see the class IloCplex in the CPLEX C++ Reference Manual.
Parameters:
dvars - An array of variables
priorities - An array of floats
Available for:
all

setPriority
setPriority(dvar, priority)
Sets the priority order of a decision variable.
Parameters:
dvar - Decision variable.
priority - New priority number.
Available for:
all

setUb
setUb(range, ub)
Sets the upper bound of the ranged constraints.
Parameters:
range - A range of constraints.
ub - An upper bound.
Available for:
all

solve
{boolean} solve()
Solves the model currently extracted to the invoking IloCplex object. The method returns true if it finds a solution (not necessarily an optimal one).
Returns:
true if the solve has been successful.
Available for:
flow control

solveFixed
{boolean} solveFixed(optional)
Solves the fixed active model using a solution from the solution pool.
Parameters:
optional - solution pool number.
Returns:
true if the solve has been successful.
Available for:
flow control

writeAnnotations
writeAnnotations(path)
Writes all annotations of the IloCplex object to the file with the specified name. This method is experimental.
Parameters:
path - Path to the file.
Available for:
flow control

writeBasis
writeBasis(file)
Writes the current CPLEX basis to the specified file. By convention, the file extension is .bas. The BAS file format is documented in the reference manual CPLEX File Formats.
Parameters:
file - File to which the basis will be exported.
Available for:
flow control

writeBendersAnnotation
writeBendersAnnotation(path)
Writes the annotation that CPLEX would generate automatically for Benders decomposition to a file with the specified name. This method is experimental.
Parameters:
path - Path to the file.
Available for:
flow control

writeMIPStarts
{void} writeMIPStarts(name, first, nb)

Writes MIP start information to the file denoted by name. The designated MIP starts begin with the one designated by the index first and continue to the specified number nb of members. All MIP starts will be written if the first and nb arguments are omitted. The single MIP start designated by first will be written if the num argument is omitted.

By convention, the file extension is .mst.

Parameters:
name - The MST file name.
first
nb
Available for:
postprocessing
flow control

©Copyright IBM Corp. 1987-2011.