Building and Modifying Models

Problem modification routines change a problem object after it has been created. Modifications that can be made include:

Note: Names of classes, methods, and symbolic constants in the .NET API correspond very closely to those in the Java API with these systematic exceptions:

Purpose

Java API

C++ API

C API

Deletes row and column names

----

----

CPXdelnames

Adds constraints without matrix coefficients

IloModel.add(IloRange) or IloMPModeler.addRange, or IloCplex.addLe, or IloCplex.addGe, or IloCplex.addEq or IloLPMatrix.addRows

IloModel::add(IloRange)

CPXnewrows

Adds constraints

IloModel.add(IloRange) or IloMPModeler.addRange, or IloCplex.addLe, or IloCplex.addGe, or IloCplex.addEq, or IloLPMatrix.addRows

IloModel::add(IloRange)

CPXaddrows

Deletes range of constraints

IloModel.remove or IloCplex.delete or IloLPMatrix.removeRows

IloRange::end or IloModel::remove

CPXdelrows

Deletes set of constraints

IloModel.remove or IloCplex.delete or IloLPMatrix.removeRows

IloRange::end or IloModel::remove

CPXdelsetrows

Adds variables without matrix coefficients

Create IloNumVar, IloIntVar, IloSemiContVar objects or use IloLPMatrix.addCols

Create IloNumVar, IloIntVar, IloSemiContVar objects

CPXnewcols

Adds variables

Create IloNumVar, IloIntVar, IloSemiContVar objects or use IloLPMatrix.addCols

Create IloNumVar, IloIntVar, IloSemiContVar objects

CPXaddcols

Deletes range of variables

IloCplex.delete

IloNumVar::end, IloIntVar::end, IloSemiContVar::end

CPXdelcols

Deletes set of variables

IloCplex.delete

IloNumVar::end, IloIntVar::end, IloSemiContVar::end

CPXdelsetcols

Changes objective sense

IloObjective.setSense

IloObjective::setSense

CPXchgobjsen

Changes a matrix, rhs, or objective coefficient

IloMPModeler.setLinearCoef (for matrix)

IloMPModeler.addToExpr (for matrix)

IloLPMatrix.setNZ (for matrix)

IloRange.setLB, setUB, setBounds (for rhs)

IloMPModeler.setLinearCoef (for objective)

IloRange::setLinearCoef (for matrix)

IloRange::setLB, setUB, setBounds (for rhs)

IloObjective::setLinearCoef (for objective)

CPXchgcoef

Changes a list of matrix coefficients

IloMPModeler.setLinearCoefs or IloLPMatrix.setNZs

IloRange::setLinearCoef

CPXchgcoeflist

Changes a coefficient in the Q matrix

IloMPModeler.addToExpr or IloObjective.setExpr

IloObjective::setExpr

CPXchgqpcoef

Changes bounds

For IloNumVar, IloIntVar, and IloSemiContVar objects, use the methods setLB, setUB and IloSemiContVar.setSemiContLB

For IloNumVar, IloIntVar, IloBoolVar, and IloSemiContVar objects, use the methods setLB, setUB, setBounds, and IloSemiContVar::setSemiContLB

CPXchgbds

Changes constraint sense

IloRange.setLB, setUB, setBounds

IloRange::setLB, setUB, setBounds

CPXchgsense

Changes coefficient in objective function

IloMPModeler.setLinearCoef or IloObjective.setExpr

IloObjective::setLinearCoef, setExpr

CPXchgobj

Changes coefficient in righthand side

IloRange.setLB, setUB, setBounds

IloRange::setLB, setUB, setBounds

CPXchgrhs

Changes range coefficients of a set of constraints

IloRange.setLB, setUB, setBounds

IloRange::setLB, setUB, setBounds

CPXchgrngval

Changes name of a variable or constraint

IloRange.setName. (IloRange implements the interface IloAddable and thus inherits this method.)

For IloNumVar, IloIntVar, IloSemiContVar, use the method setName

IloRange::setName

For IloNumVar, IloIntVar, IloBoolVar, IloSemiContVar, use the method setName

CPXchgname

Changes names of constraints

IloRange.setName

IloRange::setName

CPXchgrowname

Changes names of variables

For IloNumVar, IloIntVar, IloSemiContVar, use the method setName

For IloNumVar, IloIntVar, IloBoolVar, IloSemiContVar, use the method setName

CPXchgcolname

Changes variable type

Use IloConversion objects

Use IloConversion objects

CPXchgctype

Changes problem name

IloModel.setName

IloModel::setName

CPXchgprobname

Changes problem type

Use IloConversion objects or IloCplex.solveFixed

IloConversion objects or IloCplex::solveFixed

CPXchgprobtype

Adds an indicator constraint to a Callable Library application

Use logical constraints in a Java application.

Use logical constraints in a C++ application.

CPXaddindconstr

Adds Special Ordered Set

Create and add IloSOS1 or IloSOS2 objects or use IloMPModeler.addSOS1, addSOS2

Create and add IloSOS1 or IloSOS2 objects

CPXaddsos

Removes Special Ordered Set

IloModel.remove

(IloSOS classes implement the interface IloAddable, both individual objects and arrays of objects).

IloSOS1::end, IloSOS2::end

CPXdelsetsos

Removes MIP priority order

IloCplex.delPriorities and

IloCplex.delDirections

IloCplex::delPriorities and

IloCplex::delDirections

CPXcopyorder with item count set to 0 or set CPX_PARAM_MIPORDIND to 0 and order will be ignored

Removes cuts

IloCplex.clearCuts

IloCplex::clearCuts

CPXfreeusercuts