12.07.2015 Views

ILOG CPLEX C++ API 11.0 Reference Manual

ILOG CPLEX C++ API 11.0 Reference Manual

ILOG CPLEX C++ API 11.0 Reference Manual

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong><strong>Reference</strong> <strong>Manual</strong>2007Copyright © 1987-2006 <strong>ILOG</strong> SA. All rights reserved. Legal terms. Privacy policy.<strong>ILOG</strong>, the <strong>ILOG</strong> design, <strong>CPLEX</strong>, and all other logos and product and service names of <strong>ILOG</strong> are registered trademarks or trademarks of <strong>ILOG</strong> in France,the U.S. and/or other countries.Java TM and all Java-based marks are either trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.Microsoft, Windows, and Windows NT are either trademarks or registered trademarks of Microsoft Corporation in the U.S. and other countries.All other brand, product and company names are trademarks or registered trademarks of their respective holders.Printed in France


T ABLE OF C ONTENTSWelcome to Concert Technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16Group optim.concert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39ILOSTLBEGIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .46ILO_NO_MEMORY_MANAGER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .47IloAbs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48IloAdd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49IloAlgorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50IloAlgorithm::CannotExtractException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57IloAlgorithm::CannotRemoveException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59IloAlgorithm::Exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61IloAlgorithm::NotExtractedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62IloAlgorithm::Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64IloAnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66IloArcCos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70IloArray. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71IloBarrier. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75IloBaseEnvMutex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .78IloBool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79IloBoolArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80IloBoolVar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83IloBoolVarArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .86IloCeil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89IloCondition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .90IloConstraint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93IloConstraintArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96IloCplex::Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99IloDeleterMode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .100IloDiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101IloDisableNANDetection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104IloDiv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 3


T ABLE OF C ONTENTSIloEmptyHandleException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106IloEnableNANDetection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107IloEndMT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108IloEnv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109IloEnvironmentMismatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .115IloException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .116IloExponent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118IloExpr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119IloExprArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126IloExpr::LinearIterator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .128IloExtractable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .130IloExtractableArray. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135IloExtractableVisitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138IloFastMutex. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .140IloFloatVar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144IloFloatVarArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145IloFloor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .146IloGetClone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147IloHalfPi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148IloIfThen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .149IloInitMT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .152IloInt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .153IloIntArray. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154IloIntExpr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .158IloIntExprArg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161IloIntExprArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163IloIntSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166IloIntSet::Iterator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172IloIntSetVar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174IloIntSetVarArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179IloIntTupleSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 4


T ABLE OF C ONTENTSIloIntTupleSetIterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184IloIntVar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185IloIntVarArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191IloIsNAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195IloIterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .196IloLexicographic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198IloLog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199IloMax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200IloMaximize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .201IloMin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202IloMinimize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .203IloModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .204IloModel::Iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208IloMutexDeadlock. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210IloMutexNotOwner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .211IloMutexProblem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212IloNot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .214IloNum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .216IloNumArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .217IloNumExpr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .220IloNumExprArg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223IloNumExprArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225IloNumExpr::NonLinearExpression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .228IloNumVar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .229IloNumVarArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235IloNumVar::Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .240IloObjective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241IloObjective::Sense . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247IloOr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248IloPi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252IloPiecewiseLinear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .253<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 5


T ABLE OF C ONTENTSoperator< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .315operator> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .322operator|| . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .323Group optim.concert.cplex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .324IloConversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325IloNumColumn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .329IloNumColumnArray. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .332IloSOS1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .334IloSOS1Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .337IloSOS2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .340IloSOS2Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .344IloSemiContVar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .347IloSemiContVarArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .351Group optim.concert.extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .354IloCsvLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .356IloCsvReader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .360IloCsvReader::IloColumnHeaderNotFoundException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .369IloCsvReader::IloCsvReaderParameterException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .370IloCsvReader::IloDuplicatedTableException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371IloCsvReader::IloFieldNotFoundException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .372IloCsvReader::IloFileNotFoundException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .373IloCsvReader::IloIncorrectCsvReaderUseException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .374IloCsvReader::IloLineNotFoundException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .375IloCsvReader::IloTableNotFoundException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .376IloCsvReader::LineIterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .377<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 7


T ABLE OF C ONTENTSILOBARRIERCALLBACK0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .473ILOBRANCHCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .474ILOCONTINUOUSCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .475ILO<strong>CPLEX</strong>GOAL0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .476ILOCROSSOVERCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .478ILOCUTCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .479ILODISJUNCTIVECUTCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .480ILODISJUNCTIVECUTINFOCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .481ILOFLOWMIRCUTCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .482ILOFLOWMIRCUTINFOCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .483ILOFRACTIONALCUTCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .484ILOFRACTIONALCUTINFOCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .485ILOHEURISTICCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .486ILOINCUMBENTCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .487ILOLAZYCONSTRAINTCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .488ILOMIPCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .489ILOMIPINFOCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .490ILONETWORKCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .491ILONODECALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .492ILOPRESOLVECALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .493ILOPROBINGCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .494ILOPROBINGINFOCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .495ILOSIMPLEXCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .496ILOSOLVECALLBACK0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .497ILOTUNINGCALLBACK0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .498ILOUSERCUTCALLBACK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .499IloBound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .500IloBound::Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .503IloCplex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .504IloCplex::Aborter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .557IloCplex::Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .559<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 9


T ABLE OF C ONTENTSIloCplex::BarrierCallbackI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .561IloCplex::BasisStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .563IloCplex::BasisStatusArray. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .564IloCplex::BoolParam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .565IloCplex::BranchCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .567BranchCallbackI::BranchType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .575IloCplex::BranchDirection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .576IloCplex::BranchDirectionArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .577IloCplex::Callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .578IloCplex::CallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .580Callback::Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .584IloCplex::ConflictStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .586IloCplex::ConflictStatusArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .587IloCplex::ContinuousCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .588IloCplex::ControlCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .591ControlCallbackI::IntegerFeasibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .600ControlCallbackI::IntegerFeasibilityArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .601ControlCallbackI::PresolvedVariableException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .602IloCplex::CplexStatus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .604IloCplex::CrossoverCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .609IloCplex::CutCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .611IloCplex::CutType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .614IloCplex::DeleteMode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .615IloCplex::DisjunctiveCutCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .616IloCplex::DisjunctiveCutInfoCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .619IloCplex::DualPricing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .621IloCplex::Exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .622IloCplex::FlowMIRCutCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .624IloCplex::FlowMIRCutInfoCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .627IloCplex::FractionalCutCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .629IloCplex::FractionalCutInfoCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .632<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 10


T ABLE OF C ONTENTSIloCplex::Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .727IloCplex::Relaxation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .731IloCplex::SearchLimit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .733IloCplex::SearchLimitI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .735IloCplex::SimplexCallbackI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .737IloCplex::SolveCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .739IloCplex::StringParam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .744IloCplex::TuningCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .745IloCplex::TuningStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .747IloCplex::UnknownExtractableException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .748IloCplex::UserCutCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .749IloCplex::VariableSelect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .752Group optim.cplex.cpp.advanced . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .753IloCplex::BranchCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .754IloCplex::ControlCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .763IloCplex::CutCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .773IloCplex::Goal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .777IloCplex::GoalI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .779IloCplex::HeuristicCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .794IloCplex::IncumbentCallbackI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .801IloCplex::LazyConstraintCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .805IloCplex::NodeCallbackI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .808IloCplex::SolveCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .814IloCplex::UserCutCallbackI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .819<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 12


Welcome to Concert TechnologyThis reference manual documents the <strong>C++</strong> <strong>API</strong> of <strong>ILOG</strong> Concert Technology.What Is Concert Technology?Concert Technology offers a <strong>C++</strong> library of classes and functions that enable you todesign models of problems for both math programming (including linear programming,mixed integer programming, quadratic programming, and network programming) andconstraint programming solutions.This library is not a new programming language: it lets you use data structures andcontrol structures provided by <strong>C++</strong>. Thus, the Concert Technology part of an applicationcan be completely integrated with the rest of that application (for example, the graphicinterface, connections to databases, etc.) because it can share the same objects.Furthermore, you can use the same objects to model your problem whether you choose aconstraint programming or math programming approach. In fact, Concert Technologyenables you to combine these technologies simultaneously.What You Need to KnowThis manual assumes that you are familiar with the operating system where you areusing Concert Technology. Since Concert Technology is written for <strong>C++</strong> developers, thismanual assumes that you can write <strong>C++</strong> code and that you have a working knowledge ofyour <strong>C++</strong> development environment.NotationThroughout this manual, the following typographic conventions apply:◆◆◆Samples of code are written in this typeface.The names of constructors and member functions appear in this typeface in thesection where they are documented.Important ideas are emphasized like this.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 13


Naming ConventionsThe names of types, classes, and functions defined in the Concert Technology librarybegin with Ilo.The names of classes are written as concatenated, capitalized words. For example:IloNumVarA lower case letter begins the first word in names of arguments, instances, and memberfunctions. Other words in such a name begin with a capital letter. For example,IloNumVarArray::setBoundsThere are no public data members in Concert Technology.Accessors begin with the keyword get followed by the name of the data member.Accessors for Boolean members begin with is followed by the name of the datamember. Like other member functions, the first word in such a name begins with a lowercase letter, and any other words in the name begin with a capital letter.Modifiers begin with the keyword set followed by the name of the data member.Related DocumentsThe Concert Technology 2.0 library comes with the following documentation. Theonline documentation, in HTML format, may be accessed through standard HTMLbrowsers.◆◆◆The <strong>Reference</strong> <strong>Manual</strong> documents the predefined <strong>C++</strong> classes, global functions, typedefinitions, and macros in the libraries. It also provides formal explanations of certain, such as arrays, handles, notification, and column-wise modeling.The README file, delivered in the standard distribution, contains the most currentinformation about platform prerequisites for Concert Technology.Source code for examples is located in the examples directory in the standarddistribution.For More Information<strong>ILOG</strong> offers technical support, users' mailing lists, and comprehensive websites for itsproducts, including Concert Technology, <strong>ILOG</strong> <strong>CPLEX</strong>, and <strong>ILOG</strong> Solver.Technical SupportFor technical support of Concert Technology, you should contact your local distributor,or, if you are a direct <strong>ILOG</strong> customer, contact the technical support center listed for your<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 14


licensed <strong>ILOG</strong> product, whether <strong>CPLEX</strong> or Solver. We encourage you to use e-mail forfaster, better service.Web SitesThere are two kinds of web pages available to users of Concert Technology: web pagesrestricted to owners of a paid maintenance contract; web pages freely available to all.Web Pages for a Paid Maintenance ContractThe technical support pages on our world wide web sites contain FAQ (FrequentlyAsked/Answered Questions) and the latest patches for some of our products. Changesare posted in the product mailing list. Access to these pages is restricted to owners of anongoing maintenance contract. The maintenance contract number and the name of theperson this contract is sent to in your company will be needed for access, as explained onthe login page.All three of these sites contain the same information, but access is localized, so werecommend that you connect to the site corresponding to your location, and select theServices page from the home page.◆◆Americas: http://www.ilog.comAsia & Pacific Nations: http://www.ilog.com.sg◆ Europe, Africa, and Middle East: http://www.ilog.frWeb Pages for General InformationIn addition to those web pages for technical support of a paid maintenance contract, youwill find other web pages containing additional information about Concert Technology,including technical papers that have also appeared at industrial and academicconferences, models developed by <strong>ILOG</strong> and its customers, news about progress inoptimization. This freely available information is located at these localized web sites:◆◆◆http://www.ilog.com/products/optimization/http://www.ilog.com.sg/products/optimization/http://www.ilog.fr/products/optimization/<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 15


ConceptsArraysFor most basic classes (such as IloNumVar or IloConstraint) in ConcertTechnology, there is also a corresponding class of arrays where the elements of thearray are instances of that basic class. For example, elements of an instance ofIloConstraintArray are instances of the class IloConstraint.Arrays in an EnvironmentEvery array must belong to an environment (an instance of IloEnv). In other words,when you create a Concert Technology array, you pass an instance of IloEnv as aparameter to the constructor. All the elements of a given array must belong to the sameenvironment.Extensible ArraysConcert Technology arrays are extensible. That is, you can add elements to the arraydynamically. You add elements by means of the add member function of the arrayclass.You can also remove elements from an array by means of its remove member function.<strong>Reference</strong>s to elements of an array change whenever an element is added to or removedfrom the array. For example,IloNumArray x;IloNum *x1ptr = &(x[1]);x.add(1.3);*x1ptr no longer valid!Arrays as HandlesLike other Concert Technology objects, arrays are implemented by means of two classes:a handle class corresponding to an implementation class. An object of the handle classcontains a data member (the handle pointer) that points to an object (its implementationobject) of the corresponding implementation class. As a Concert Technology user, youwill be working primarily with handles.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 16


Copying ArraysMany handles may point to the same implementation object. This principle holds true forarrays as well as other handle classes in Concert Technology. When you want to createmore than one handle for the same implementation object, you should use either thecopy constructor or the assignment operator of the array class. For example,new implsame implof arrayIloNumArray array(env); // creates a handle pointing toIloNumArray array1(array); // creates a handle pointing toIloNumArray array2;// creates an empty handlearray2 = array; // sets impl of handle array2 to implTo take another example, the following lines add all elements of a1 to a2, essentiallycopying the array.IloNumArray a1;IloNumArray a2;a2.clear();a2.add(a1);Programming Hint: Using Arrays EfficientlyIf your application only reads an array (that is, if your function does not modify anelement of the array), then we recommend that you pass the array to your function as aconst parameter. This practice forces Concert Technology to access the constconversion of the index operator (that is, operator[]), which is faster.Assert and NDEBUGMost member functions of classes in Concert Technology are inline functions thatcontain an assert statement. This statement asserts that the invoking object and themember function parameters are consistent; in some member functions, the assertstatement checks that the handle pointer is non-null. These statements can be suppressedby the macro NDEBUG. This option usually reduces execution time. The price you payfor this choice is that attempts to access through null pointers are not trapped and usuallyresult in memory faults.Compilation with assert statements will not prevent core dumps by incorrect code.Instead, compilation with assert statements moves the execution of the incorrectcode (the core dump, for example) to a place where you can see what is causing theproblem in a source code debugger. Correctly written code will never cause one of theseConcert Technology assert statements to fail.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 17


Branch & Cut<strong>CPLEX</strong> uses branch & cut search when solving mixed integer programming (MIP)models. The branch & cut search procedure manages a search tree consisting of nodes.Every node represents an LP or QP subproblem to be processed; that is, to be solved, tobe checked for integrality, and perhaps to be analyzed further. Nodes are called active ifthey have not yet been processed. After a node has been processed, it is no longer active.Cplex processes active nodes in the tree until either no more active nodes are availableor some limit has been reached.A branch is the creation of two new nodes from a parent node. Typically, a branchoccurs when the bounds on a single variable are modified, with the new boundsremaining in effect for that new node and for any of its descendants. For example, if abranch occurs on a binary variable, that is, one with a lower bound of 0 (zero) and anupper bound of 1 (one), then the result will be two new nodes, one node with a modifiedupper bound of 0 (the downward branch, in effect requiring this variable to take only thevalue 0), and the other node with a modified lower bound of 1 (the upward branch,placing the variable at 1). The two new nodes will thus have completely distinct solutiondomains.A cut is a constraint added to the model. The purpose of adding any cut is to limit thesize of the solution domain for the continuous LP or QP problems represented at thenodes, while not eliminating legal integer solutions. The outcome is thus to reduce thenumber of branches required to solve the MIP.As an example of a cut, first consider the following constraint involving three binary(0-1) variables:20x + 25y + 30z


immediately. If possible, an incumbent solution (that is, the best known solution thatsatisfies all the integrality requirements) is established at this point for later use in thealgorithm. Such a solution may be established either by <strong>CPLEX</strong> or by a user whospecifies a starting solution by means of the Callable Library routineCPXcopymipstart or the Concert Technology methodIloCplex::setVectors.If you are solving a sequence of problems by modifying the problem already in memoryand re-solving, then you do not need to establish a starting solution explicitly every time,because for each revised problem, the solution of the previous problem will be retainedas a possible starting solution.When processing a node, <strong>CPLEX</strong> starts by solving the continuous relaxation of itssubproblem. that is, the subproblem without integrality constraints. If the solutionviolates any cuts, <strong>CPLEX</strong> may add some or all of them to the node problem and mayresolve it, if <strong>CPLEX</strong> has added cuts. This procedure is iterated until no more violatedcuts are detected (or deemed worth adding at this time) by the algorithm. If at any pointin the addition of cuts the node becomes infeasible, the node is pruned (that is, it isremoved from the tree).Otherwise, <strong>CPLEX</strong> checks whether the solution of the node-problem satisfies theintegrality constraints. If so, and if its objective value is better than that of the currentincumbent, the solution of the node-problem is used as the new incumbent. If not,branching will occur, but first a heuristic method may be tried at this point to see if anew incumbent can be inferred from the LP-QP solution at this node, and other methodsof analysis may be performed on this node. The branch, when it occurs, is performed ona variable where the value of the present solution violates its integrality requirement.This practice results in two new nodes being added to the tree for later processing.Each node, after its relaxation is solved, possesses an optimal objective function valueZ. At any given point in the algorithm, there is a node whose Z value is better (less, inthe case of a minimization problem, or greater for a maximization problem) than all theothers. This Best Node value can be compared to the objective function value of theincumbent solution. The resulting MIP Gap, expressed as a percentage of the incumbentsolution, serves as a measure of progress toward finding and proving optimality. Whenactive nodes no longer exist, then these two values will have converged toward eachother, and the MIP Gap will thus be zero, signifying that optimality of the incumbent hasbeen proven.It is possible to tell <strong>CPLEX</strong> to terminate the branch & cut procedure sooner than acompleted proof of optimality. For example, a user can set a time limit or a limit on thenumber of nodes to be processed. Indeed, with default settings, <strong>CPLEX</strong> will terminatethe search when the MIP Gap has been brought lower than 0.0001 (0.01%), because it isoften the case that much computation is invested in moving the Best Node value afterthe eventual optimal incumbent has been located. This termination criterion for the MIPGap can be changed by the user, of course.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 19


Callbacks in Concert TechnologyA callback is an object with a main method implemented by a user. This user-writtenmain method is called by the IloCplex algorithm at specific points duringoptimization.Callbacks may be called repeatedly at various points during optimization; for eachplace a callback is called, <strong>ILOG</strong> <strong>CPLEX</strong> provides a separate callback class (derivedfrom the class IloCplex::CallbackI). Such a callback class provides the specific<strong>API</strong> as a protected method to use for the particular implementation.There are several varieties of callbacks:◆ Informational callbacks allow your application to gather information about theprogress of MIP optimization without interfering with performance of the search. Inaddition, an informational callback also enables your application to terminateoptimization.◆◆Query callbacks, also known as diagnostic callbacks, enable your application toretrieve information about the progress of optimization, whether continuous ordiscrete. The information available depends on the algorithm (primal simplex, dualsimplex, barrier, mixed integer, or network) that you are using. For example, a querycallback can return the current objective value, the number of simplex iterations thathave been completed, and other details. Query callbacks can also be called frompresolve, probing, fractional cuts, and disjunctive cuts. Query callbacks may impedeperformance because the internal data structures that support query callbacks must beupdated frequently. Furthermore, query or diagnostic callbacks make assumptionsabout the path of the search, assumptions that are correct with respect to conventionalbranch and cut but that may be false with respect to dynamic search. For this reason,query or diagnostic callbacks are not compatible with dynamic search. In otherwords, <strong>CPLEX</strong> normally turns off dynamic search in the presence of query ordiagnostic callbacks in an application.Control callbacks make it possible for you to define your own user-written routinesand for your application to call those routines to interrupt and resume optimization.Control callbacks enable you to direct the search when you are solving a MIP in aninstance of IloCplex. For example, control callbacks enable you to select the nextnode to process or to control the creation of subnodes (among other possibilities).Control callbacks are an advanced feature of <strong>ILOG</strong> <strong>CPLEX</strong>, and as such, they requirea greater degree of familiarity with <strong>CPLEX</strong> algorithms. Because control callbackscan alter the search path in this way, control callbacks are not compatible withdynammic search. In other words, <strong>CPLEX</strong> normally turns off dynamic search in thepresence of control callbacks in an application.If you want to take advantage of dynamic search in your application, you should restrictyour use of callbacks to the informational callbacks.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 20


If you see a need for query, diagnostic, or control callbacks in your application, you canoverride the normal behavior of <strong>CPLEX</strong> by nondefault settings of the parametersMIPSearch, ParallelMode, and Threads. For more details about theseparameters and their settings, see the <strong>ILOG</strong> <strong>CPLEX</strong> Parameter <strong>Reference</strong> <strong>Manual</strong>.You do not create instances of the class IloCplex::CallbackI; rather, you useone of its child classes to implement your own callback. In order to implement youruser-written callbacks with an instance of IloCplex, you should follow these steps:◆ 1. Determine which kind of callback you want to write, and choose the appropriateclass for it. The class hierarchy (displayed online when you click Tree on the menu)may give you some ideas about which kind of callback suits your purpose.◆2. Derive your own subclass, MyCallbackI, say, from the appropriate predefinedcallback class.◆ 3. In your subclass of the callback class, use the protected <strong>API</strong> defined in the baseclass to implement the main routine of your user-written callback. (All constructorsof predefined callback classes are protected; they can be called only from userwrittenderived subclasses.)◆ 4. In your subclass, implement the method duplicateCallback.◆ 5. Write a function myCallback, say, that creates an instance of yourimplementation class in the Concert Technology environment and returns it as anIloCplex::Callback handle.◆ 6. Create an instance of your callback class and pass it to the member functionIloCplex::use.There are macros of the form ILOXXXCALLBACKn (for n from 0 to 7) available tofacilitate steps 2 through 5, where XXX stands for the particular callback underconstruction and n stands for the number of arguments that the function written in step 5is to receive in addition to the environment argument.You can use one instance of a callback with only one instance of IloCplex. Whenyou use a callback with a second instance of IloCplex, a copy will be automaticallycreated using the method duplicateCallback, and that copy will be used instead.Also, an instance of IloCplex takes account of only one instance of a particularcallback at any given time. That is, if you call IloCplex::use more than once withthe same class of callback, the last call overrides any previous one. For example, you canuse only one primal simplex callback at a time, or you can use only one network callbackat a time; and so forth.Existing extractables should never be modified within a callback. Temporaryextractables, such as arrays, expressions, and range constraints, can be created andmodified. Temporary extractables are often useful, for example, for computing cuts.Example<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 21


Here is an example showing you how to terminate optimization after a given period oftime if the solution is good enough. It uses one of the predefined macros to facilitatewriting a control callback with a timer, a time limit, and a way to recognize a goodenough solution.ILOMIPINFOCALLBACK3(nodeLimitCallback,IloBool, aborted,IloNum, nodeLimit,IloNum, acceptableGap){if ( !aborted && hasIncumbent() ) {IloNum objval = getIncumbentObjValue();IloNum bound = getBestObjValue();IloNum gap = fabs(objval - bound) / (1.0 + fabs(bound)) * 100.0;if ( getNnodes() > nodeLimit &&gap < acceptableGap ) {getEnv().out()


The following undocumented classes provide the underlying mechanism for columnwisemodeling:◆IloAddValueToObj◆ IloAddValueToRangeThe following operators are useful in column-wise modeling:◆ in the class IloRange,IloAddValueToRange operator() (IloNum value);◆ in the class IloObjective,IloAddValueToObj operator () (IloNum value);That is, the operator () in extractable classes, such as IloRange orIloObjective, creates descriptors of how Concert Technology should add the new,yet-to-be-created variable to the invoking extractable object.You can use the operator + to link together the objects returned by operator ()to form a column. You can then use an instance of IloNumColumn to build up columnexpressions within a programming loop and thus save them for later use or to pass themto functions.Here is how to use an instance of IloNumColumn with operators from IloRangeand IloObjective to create a column with a coefficient of 2 in the objective, with10 in range1, and with 3 in range2. The example then uses that column when itcreates the new variable newvar1, and it uses column expressions when it createsnewvar2 and newvar3.IloNumColumn col = obj(2) + range1(10) + range2(3);IloNumVar newvar1(col);IloNumVar newvar2(col + range3(17));IloNumVar newvar3(range1(1) + range3(3));In other words, given an instance obj of IloObjective and the instances range1,range2, and range3 of IloRange, those lines create the new variables newvar1,newvar2, and newvar3 and add them as linear terms to obj, range1, and range3in the following way:obj: + 2*newvar1 + 2*newvar2range1: +10*newvar1 + 10*newvar2 + 1*newvar3range2: + 3*newvar1 + 3*newvar2range3: + 17*newvar2 +3*newvar3<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 23


For more information, refer to the documentation ofIloNumColumn,IloObjective, and IloRange.Creation of Extractable ObjectsFor most Concert applications, you can simply create the extractable objects that youneed to build your model, then let their destructors manage the subsequent deletions.However, when memory use is critical to your application, you may need to take controlof the deletion of extractable objects. In such cases, you will need a deeperunderstanding of how <strong>ILOG</strong> Concert Technology creates and maintains extractableobjects. The following guidelines, along with the concept Deletion of ExtractableObjects, should help.1. An expression (that is, an instance of the class IloExpr) ispassed by value to anextractable object (an instance of the class IloExtractable). Therefore, you candelete the original expression after passing it by value without affecting the extractableobject that received it.Similarly, instances of IloNumColumn and IloIntSet are passed by value to anypredefined Concert Technology objects. More generally, if you have multiple handlespassed to Concert objects pointing to an instance of IloExpr, IloNumColumn, orIloIntSet, and you call a method that modifies one of those handles, ConcertTechnology performs a lazy copy. In other words, it first copies the implementationobject for the handle you are modifying and then makes the modification. The otherhandles pointing to the original implementation object remain unchanged, and yourmodification has no impact on them.Lazy copying does not apply to other Concert Technology objects. In general, it isrecommended that you avoid using multiple handles to the same object if you do not feelcomfortable with lazy copying.2. A variable (that is, an instance of IloNumVar, IloIntVar,or IloBoolVar)is passed by reference to an extractable object. Therefore, when your Concertapplication is in linear deleter mode, deleting a variable will remove it from anyextractables that received it.3. An extractable object is passed by reference to a logical constraint (such asIloIfThen) or to a nonlinear expression (such as IloMax). Therefore, you shouldnot delete the original expression after passing it to such functions unless you havefinished with the associated model.Here are some examples to consider in light of these guidelines. The first exampleillustrates guidelines 2 and 3.IloEnv env;IloNumVar x(env, 0, IloInfinity, "X");IloNumVar y(env, 0, IloInfinity, "Y");<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 24


IloNumVar z(env, 0, IloInfinity, "Z");IloExpr e = x + y;IloConstraint c1 = (e = z);IloConstraint c3 = IloIfThen(env, c1, c2);e.end(); // OK; c1 and c2 use copies of e;c1.end();// BAD IDEA; c3 still references c1IloModel m(env);m.add (c3); // c3 is not correctly represented in m.In that example, since c1 is passed by reference, the call to c1.end raises errors. Incontrast, the call to e.end causes no harm because e is passed by value.The following example illustrates guidelines 1 and 2.IloEnv env;IloModel model(env);IloNumVar y(env, 0, 10, "y");#ifdef WILLDELETEIloNumVar y2 = y; // second handle pointing to implementation ofy#elseIloExpr y2 = y; // first handle pointing to expression 1*y#endifIloConstraint cst = y2


Deletion of Extractable ObjectsAs a modeling layer, Concert allows the creation and destruction of extractablesthrough the methods IloExtractable::end andIloExtractableArray::endElements. The purpose of these methods is toreclaim memory associated with the deleted objects while maintaining the safestpossible Concert environment. In this context, a safe Concert environment is definedby the property that no object points to a deleted object; a pointer to a deleted object isreferred to as a dangling pointer in <strong>C++</strong>.There exist two paradigms to make sure of the safety of the delete operation. The first,linear mode, comes from math programming; in a Concert application, linear mode ispossible only on extractable and other objects used in linear programming. The second,safe generic mode, is stricter and is valid on all Concert extractable objects.You can access both paradigms by calling IloEnv::setDeleter(IloDeleterModemode), where mode may be IloLinearDeleterMode orIloSafeDeleterMode.Linear ModeTo use linear mode, you must either◆ call IloEnv::setDeleter(IloLinearDeleterMode), or◆ refrain from calling IloEnv::setDeleter, as linear is the default mode.In linear mode, the following behavior is implemented:◆ If a range constraint is deleted, it is removed from the models that contain it.◆ If a variable is deleted, its coefficient is set to 0 (zero) in the ranges, expressions, andobjectives where it appears. The variable is removed from the special ordered sets oftype 1 and 2 (that is, SOS1 and SOS2), as well as from instances ofIloConversion where it appears.ExampleThis example tests the linear mode deletion of a variable x.void TestLinearDeleter() {IloEnv env;env.out()


}model.add(con);model.add(con2);model.add(sos);env.out()


◆after a call to IloEnv::setDeleter(IloSafeDeleterMode) and◆ before a call to IloEnv::unsetDeleter.Objects not managed by this dependency graph are referred to here as "nondeletable".An attempt to delete a nondeletable object will throw an exception.It is recommended that you create this graph just after the creation of the environmentand that you refrain from using IloEnv::unsetDeleter because building anincomplete dependency graph is very error prone and should only be attempted byadvanced users. A clear example of this incomplete graph is the separation of a modelbetween a nondeletable base model and deletable extensions of this base model.Calling IloExtractable::end on extractable xi will succeed only if no otherextractable object uses extractable xi. If this is not the case, a call toIloExtractable::end will throw an exceptionIloDeleter::RequiresAnotherDeletionException indicating whichextractable object uses the extractable object that you want to delete.ExampleThis example shows an attempt to delete one extractable object that is used by another.void TestSafeDeleter() {IloEnv env;env.out()


TestSafeDeleterCaught You cannot end x1(F)[0..10] before IloRange rng3()


exception explicitly. Instead, the system calls the constructor of the exception to createit, and the system calls the destructor of the exception to delete it.When exceptions are enabled on a platform that supports <strong>C++</strong> exceptions, an instance ofa class of Concert Technology is able to throw an exception in case of error. Onplatforms that do not support <strong>C++</strong> exceptions, it is possible for Concert Technology toexit in case of error.Programming Hint: Throwing and Catching ExceptionsExceptions are thrown by value. They are not allocated on the <strong>C++</strong> heap, nor in aConcert Technology environment. The correct way to catch an exception is to catch areference to the error (indicated by the ampersand &), like this:catch(IloException& oops);ExtractionGoalsConcert Technology offers classes for you to design a model of your problem. You canthen invoke an algorithm to extract information from your model to solve the problem.In this context, an algorithm is an instance of a class such as IloCplex, documentedin the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong> <strong>Manual</strong>, or IloSolver, documented in the <strong>ILOG</strong>Solver <strong>Reference</strong> <strong>Manual</strong>.For details about what each algorithm extracts from a model, see the reference manualdocumenting that algorithm. For example, the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong> <strong>Manual</strong> listsprecisely which classes of Concert Technology are extracted by an instance ofIloCplex. In general terms, an instance of IloCplex extracts a model as rows andcolumns, where the columns indicate decision variables of the model. Also in generalterms, an instance of IloSolver extracts an instance of a class whose name beginsIlo to a corresponding instance of a class whose name begins Ilc. For example, aninstance of IloAllDiff is extracted by IloSolver as an instance ofIlcAllDiff.Goals can be used to control the branch and cut search in IloCplex . Goals areimplemented in the class IloCplex::GoalI . The class IloCplex::Goal isthe handle class. That is, it contains a pointer to an instance of IloCplex::GoalIalong with accessors of objects in the implmenetation class.To implement your own goal, you need to subclass IloCplex::GoalI andimplement its virtual member functions execute and duplicateGoal. The methodexecute controls the branch & cut search. The method duplicateGoal creates acopy of the invoking goal object to be used for parallel branch & cut search.Implementing your goal can be greatly simplified if you use one of the macrosILO<strong>CPLEX</strong>GOALn.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 30


Every branch & cut node maintains a goal stack, possibly containingIloCplex::GoalI objects. After IloCplex solves the relaxation of a node, itpops the top goal from the goal stack and calls its method execute. There are severaltypes of goals:◆ If OrGoal is executed, IloCplex will create child nodes. Each of the childnodes will be initialized with a copy of the goal stack of the current node. Then, foreach child node, the specified goal in the OrGoal is pushed onto the correspondinggoal stack of the child node. Finally, the current node is deleted. (SeeIloCplex#GoalI::OrGoal for a more detailed discussion.)◆If a cut goal is executed, the constraint will be added to the current node relaxation.Constraint goals are provided to represent both local and global cuts. Local cut goalsare conventionally used to express branching.◆ If AndGoal is executed, its subgoals are simply pushed onto the stack. (SeeIloCplex::GoalI::AndGoal for a more detailed discussion.)◆ If IloCplex::GoalI::FailGoal is executed, IloCplex will prune thecurrent node; that is, it will discontinue the search at the current node. IloCplexwill continue with another node if there is one still available in the tree.◆ If IloCplex::GoalI::SolutionGoal is executed, IloCplex willattempt to inject a user-provided solution as a new incumbent. Before <strong>ILOG</strong> <strong>CPLEX</strong>accepts the injected solution, it first tests whether the injected solution is feasiblewith respect to the model and goals.◆ When <strong>ILOG</strong> <strong>CPLEX</strong> executes any other goal, the returned goal is simply pushedonto the stack.IloCplex continues popping goals from the goal stack until OrGoal or FailGoalis executed, or until the stack becomes empty; in the case of an empty stack, it willcontinue with a built-in search strategy.The predefined goals OrGoal and AndGoal allow you to combine goals. AndGoalallows you to execute different goals at one node, while OrGoal allows you to executedifferent goals on different, newly created nodes. A conventional use of these two goalsin a return statement of a user-written goal looks like this:return AndGoal ( OrGoal (branch1, branch2), this);This AndGoal first pushes this (the goal currently being executed) onto the goalstack, and then it pushes the OrGoal. Thus the OrGoal is on top of the stack and willbe executed next. When the OrGoal executes, it creates two new nodes and copies theremaining goal stack to both of them. Thus both new nodes will have this goal on topof the goal stack at this point. Then the OrGoal proceeds to push branch1 onto the<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 31


goal stack of the first child node and branch2 onto the goal stack of the second goalchild node. Conventionally, branch1 and branch2 contain cut goals, so byexecuting branch1 and branch2 at the respective child nodes, the child nodes willbe restricted to represent smaller subproblems than their parent. After branch1 andbranch2 have been executed, this is on top of the node stack of both child nodes;that is, both child nodes will continue branching according to the same rule. Insummary, this example creates the branches branch1 and branch2 and continues inboth branches to control the same search strategy this.To perform a search using a goal, you need to solve the extracted model by calling themethod IloCplex::solve(goal) with the goal to use as an argument instead ofthe standard IloCplex::solve. The method solve(goal) simply pushes thegoal onto the goal stack of the root node before calling the standard solve.See AlsoIloCplex::Goal and IloCplex::GoalIHandle ClassInfeasibility ToolsMost Concert Technology entities are implemented by means of two classes: a handleclass and an implementation class, where an object of the handle class contains a datamember (the handle pointer) that points to an object (its implementation object) of thecorresponding implementation class. As a Concert Technology user, you will beworking primarily with handles.As handles, these objects should be passed in either of these ways:◆ as const by value (when no change is involved);◆ by reference (when the function to which the handle is passed changes theimplementation of that handle).They should be created as automatic objects, where "automatic" has the usual <strong>C++</strong>meaning.Member functions of a handle class correspond to member functions of the same namein the implementation class.When you problem is infeasible, <strong>ILOG</strong> <strong>CPLEX</strong> offers tools to help you diagnose thecause or causes of infeasibility in your model and possibly repair it:IloCplex::refineConflict and IloCplex::feasOpt.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 32


Conflict RefinerGiven an infeasible model, the conflict refiner can identify conflicting constraints andbounds within the model to help you identify the causes of the infeasibility. In thiscontext, a conflict is a subset of the constraints and bounds of the model which aremutually contradictory. The conflict refiner first examines the full infeasible model toidentify portions of the conflict that it can remove. By this process of refinement, theconflict refiner arrives at a minimal conflict. A minimal conflict is usually smaller thanthe full infeasible model and thus makes infeasibility analysis easier. To invoke theconflict refiner, call the method IloCplex::refineConflict.If a model happens to include multiple independent causes of infeasibility, then it maybe necessary for the user to repair one such cause and then repeat the diagnosis withfurther conflict analysis.A conflict does not provide information about the magnitude of change in data valuesneeded to achieve feasibility. The techniques that <strong>ILOG</strong> <strong>CPLEX</strong> uses to refine a conflictinclude or remove constraints or bounds in trial conflicts; the techniques do not vary thedata in constraints nor in bounds. To gain insight about changes in bounds on variablesand constraints, consider the FeasOpt feature.Also consider FeasOpt for an approach to automatic repair of infeasibility.Refining a conflict in an infeasible model as defined here is similar to finding anirreducibly inconsistent set (IIS), an established technique in the published literature,long available within <strong>ILOG</strong> <strong>CPLEX</strong>. Both tools (conflict refiner and IIS finder) attemptto identify an infeasible subproblem in an infeasible model. However, the conflictrefiner is more general than the IIS finder. The IIS finder is applicable only in continuous(that is, LP) models, whereas the conflict refiner can work on any type of problem, evenmixed integer programs (MIP) and those containing quadratic elements (QP or QCP).Also the conflict refiner differs from the IIS finder in that a user may organizeconstraints into one or more groups for a conflict. When a user specifies a group, theconflict refiner will make sure that either the group as a whole will be present in aconflict (that is, all its members will participate in the conflict, and removal of one willresult in a feasible subproblem) or that the group will not participate in the conflict atall.See the method IloCplex::refineConflictExt for more about groups.A user may also assign a numeric preference to constraints or to groups of constraints.In the case of an infeasible model having more than one possible conflict, preferencesguide the conflict refiner toward identifying constraints in a conflict as the user prefers.In these respects, the conflict refiner represents an extension and generalization of theIIS finder.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 33


FeasOptLogical ConstraintsAlternatively, after a model have been proven infeasible, IloCplex::feasOptperforms an additional optimization that computes a minimal relaxation of theconstraints over variables, of the bounds on variables, and of the righthand sides ofconstraints to make the model feasible. The parameter FeasOptMode lets you guidefeasOpt in its computation of this relaxation.IloCplex::feasOpt works in two phases. In its first phase, it attempts to minimizeits relaxation of the infeasible model. That is, it attempts to find a feasible solution thatrequires minimal change. In its second phase, it finds an optimal solution among thosethat require only as much relaxation as it found necessary in the first phase.Your choice of values for the parameter FeasOptMode indicates two aspects to <strong>ILOG</strong><strong>CPLEX</strong>:◆ whether to stop in phase one or continue to phase two:◆ Min means stop in phase one with a minimal relaxation.◆ Opt means continue to phase two for an optimum among those minimalrelaxations.◆ how to measure the minimality of the relaxation:◆ Sum means <strong>ILOG</strong> <strong>CPLEX</strong> should minimize the sum of all relaxations◆ Inf means that <strong>ILOG</strong> <strong>CPLEX</strong> should minimize the number of constraints andbounds relaxed.The possible values of FeasOptMode are documented in the methodIloCplex::feasOpt.The status of the bounds and constraints of a relaxation returned by a call ofIloCplex::feasOpt are documented in the enumeration IloCplex::Status.For <strong>ILOG</strong> <strong>CPLEX</strong>, a logical constraint combines linear constraints by means of logicaloperators, such as logical and, logical or, negation (that is, not), conditional statements(that is, if ... then ...) to express complex relations between linear constraints. <strong>ILOG</strong><strong>CPLEX</strong> can also handle certain logical expressions appearing within a linear constraint.One such logical expression is the minimum of a set of variables. Another such logicalexpression is the absolute value of a variable.In <strong>C++</strong> applications, the class IloCplex can extract modeling objects to solve a widevariety of MIPs and LPs. Under some conditions, a problem expressed in terms oflogical constraints may be equivalent to a continuous LP, rather than a MIP. In such acase, there is no need for branching during the search for a solution. Whether a problem<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 34


(or parts of a problem) represented by logical terms can be modeled and solved by LPdepends on the shape of those logical terms. In this context, shape means convex orconcave in the formal, mathematical sense.For more about convexity, see that topic in the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong>.In fact, the class IloCplex can extract logical constraints as well as some logicalexpressions. The logical constraints that IloCplex can extract are these:◆IloAnd which can also be represented by the overloaded operator &&;◆ IloOr which can also be represented by the overloaded operator ||;◆ IloDiff which can also be represented by the overloaded operator !=;◆ IloNot, negation, which can also be represented by the overloaded operator !;◆IloIfThen◆ == (that is, the equivalence relation)◆ != (that is, the exclusive-or relation)For examples of logical constraints in <strong>ILOG</strong> <strong>CPLEX</strong>, see the <strong>ILOG</strong> <strong>CPLEX</strong> User's<strong>Manual</strong>.Normalization: Reducing Linear TermsNormalizing is sometimes known as reducing the terms of a linear expression.Linear expressions consist of terms made up of constants and variables related byarithmetic operations; for example, x + 3y is a linear expression of two terms consistingof two variables. In some expressions, a given variable may appear in more than oneterm, for example, x + 3y +2x. Concert Technology has more than one way of dealingwith linear expressions in this respect, and you control which way Concert Technologytreats expressions from your application.In one mode, Concert Technology analyzes linear expressions that your applicationpasses it and attempts to reduce them so that a given variable appears in only one term inthe linear expression. This is the default mode. You set this mode with the memberfunction IloEnv::setNormalizer(IloTrue).In the other mode, Concert Technology assumes that no variable appears in more thanone term in any of the linear expressions that your application passes to ConcertTechnology. We call this mode assume normalized linear expressions. You set this modewith the member function IloEnv::setNormalizer(IloFalse).In classes such as IloExpr or IloRange, there are member functions that check thesetting of the member function IloEnv::setNormalizer in the environment andbehave accordingly. The documentation of those member functions indicates how theybehave with respect to normalization.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 35


When you set IloEnv::setNormalizer(IloFalse), those member functionsassume that no variable appears in more than one term in a linear expression. This modemay save time during computation, but it entails the risk that a linear expression maycontain one or more variables, each of which appears in one or more terms. Such a casemay cause certain assertions in member functions of a class to fail if you do not compilewith the flag -DNDEBUG.By default, those member functions attempt to reduce expressions. This mode mayrequire more time during preliminary computation, but it avoids of the possibility of afailed assertion in case of duplicates.For more information, refer to the documentation of IloEnv,IloExpr, andIloRange.NotificationYou may modify the elements of a model in Concert Technology. For example, you mayadd or remove constraints, change the objective, add or remove columns, add or removerows, and so forth.In order to maintain consistency between a model and the algorithms that may use it,Concert Technology notifies algorithms about changes in the objects that the algorithmshave extracted. In this manual, member functions that are part of this notificationsystem are indicated like this:Note:This member function notifies Concert Technology algorithms aboutthis change of this invoking object.Piecewise LinearitySome problems are most naturally represented by constraints over functions that arenot purely linear but consist of linear segments. Such functions are sometimes known aspiecewise linear.How to Define a Piecewise Linear FunctionTo define a piecewise linear function in <strong>ILOG</strong> <strong>CPLEX</strong>, you need these components:◆ the variable of the piecewise linear function;◆ the breakpoints of the piecewise linear function;◆ the slope of each segment (that is, the rate of increase or decrease of the functionbetween two breakpoints);◆ the geometric coordinates of at least one point of the function.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 36


In other words, for a piecewise linear function of n breakpoints, you need to know n+1slopes. Typically, the breakpoints of a piecewise linear function are specified as an arrayof numeric values. The slopes of its segments are indicated as an array of numeric valuesas well. The geometric coordinates of at least one point of the function must also bespecified. Then in <strong>ILOG</strong> <strong>CPLEX</strong>, those details are brought together by the globalfunction IloPiecewiseLinear.Another way to specify a piecewise linear function is to give the slope of the firstsegment, two arrays for the coordinates of the breakpoints, and the slope of the lastsegment.For examples of these ways of defining a piecewise linear function, see this topic in the<strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong>.Discontinuous Piecewise Linear FunctionsIntuitively, in a continuous piecewise linear function, the endpoint of one segment hasthe same coordinates as the initial point of the next segment. There are piecewise linearfunctions, however, where two consecutive breakpoints may have the same x coordinatebut differ in the value of f(x). Such a difference is known as a step in the piecewise linearfunction, and such a function is known as discontinuous.Syntactically, a step is represented in this way:◆ The value of the first point of a step in the array of slopes is the height of the step.◆ The value of the second point of the step in the array of slopes is the slope of thefunction after the step.By convention, a breakpoint belongs to the segment that starts at that breakpoint.In <strong>ILOG</strong> <strong>CPLEX</strong>, a discontinuous piecewise linear function is also represented as aninstance of the class created by the global function IloPiecewiseLinear.For examples of discontinuous piecewise linear functions, see this topic in the <strong>ILOG</strong><strong>CPLEX</strong> User's <strong>Manual</strong>.Using IloPiecewiseLinearWhether it represents a continuous or a discontinuous piecewise linear function, aninstance of the class created by the global function IloPiecewiseLinear behaveslike a floating-point expression. That is, you may use it in a term of a linear expressionor in a constraint added to a model (an instance of IloModel).UnboundednessThe treatment of models that are unbounded involves a few subtleties. Specifically, adeclaration of unboundedness means that <strong>ILOG</strong> <strong>CPLEX</strong> has determined that the modelhas an unbounded ray. Given any feasible solution x with objective z, a multiple of theunbounded ray can be added to x to give a feasible solution with objective z-1 (or z+1 for<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 37


maximization models). Thus, if a feasible solution exists, then the optimal objective isunbounded. Note that <strong>ILOG</strong> <strong>CPLEX</strong> has not necessarily concluded that a feasiblesolution exists. Users can call the methods IloCplex::isPrimalFeasible andIloCplex::isDualFeasible to determine whether <strong>ILOG</strong> <strong>CPLEX</strong> has alsoconcluded that the model has a feasible solution.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 38


Group optim.concertThe <strong>ILOG</strong> Concert <strong>API</strong>.Classes SummaryIloAlgorithm The base class of algorithms inConcert Technology.IloAlgorithm::CannotExtractExceptionIloAlgorithm::CannotRemoveExceptionIloAlgorithm::ExceptionIloAlgorithm::NotExtractedExceptionThe class of exceptions thrown if anobject cannot be extracted from amodel.The class of exceptions thrown if anobject cannot be removed from amodel.The base class of exceptions thrownby classes derived from IloAlgorithm.The class of exceptions thrown if anextractable object has no value in thecurrent solution of an algorithm.IloAnd Defines a logical conjunctive-ANDamong other constraints.IloArray A template to create classes ofarrays for elements of a given class.IloBarrier A system class to synchronizethreads at a specified number.IloBaseEnvMutex A class to initialize multithreading inan application.IloBoolArrayIloBoolArray is the array class ofthe basic Boolean class for a model.IloBoolVar An instance of this class representsa constrained Boolean variable in aConcert Technology model.IloBoolVarArrayIloBoolVarArray is the array class ofthe Boolean variable class.IloCondition Provides synchronization primitivesadapted to Concert Technology foruse in a parallel application.IloConstraint An instance of this class is aconstraint in a model.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 39


IloConstraintArrayIloConstraintArray is the arrayclass of constraints for a model.IloDiff Constraint that enforces inequality.IloEmptyHandleException The class of exceptions thrown if anempty handle is passed.IloEnv The class of environments formodels or algorithms in ConcertTechnology.IloEnvironmentMismatch This exception is thrown if you try tobuild an object using objects fromanother environment.IloException Base class of Concert Technologyexceptions.IloExpr An instance of this class representsan expression in a model.IloExprArrayIloExprArray is the array class ofthe expressions class.IloExpr::LinearIterator An iterator over the linear part of anexpression.IloExtractableBase class of all extractable objects.IloExtractableArray An array of extractable objects.IloExtractableVisitor The class IloExtractableVisitorinspects all nodes of an expression.IloFastMutex Synchronization primitives adaptedto the needs of Concert Technology.IloIfThen This class represents a conditionconstraint.IloIntArrayIloIntArray is the array class of thebasic integer class.IloIntExpr The class of integer expressions inConcert Technology.IloIntExprArg A class used internally in ConcertTechnology.IloIntExprArray The array class of IloIntExpr.IloIntSet An instance of this class offers aconvenient way to represent a set ofinteger values.IloIntSet::IteratorThis class is an iterator that traversesthe elements of a finite set of numericvalues.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 40


IloIntSetVarThe class IloIntSetVar represents aset of integer values.IloIntSetVarArray The array class of the set variableclass for integer values.IloIntTupleSetOrdered set of values represented byan array.IloIntTupleSetIterator Class of iterators to traverseenumerated values of a tuple-set.IloIntVar An instance of this class representsa constrained integer variable in aConcert Technology model.IloIntVarArray The array class of IloIntVar.IloIterator A template to create iterators for aclass of extractable objects.IloModel Class for models.IloModel::Iterator Nested class of iterators to traversethe extractable objects in a model.IloMutexDeadlock The class of exceptions thrown dueto mutex deadlock.IloMutexNotOwner The class of exceptions thrown.IloMutexProblem Exception.IloNot Negation of its argument.IloNumArrayIloNumArray is the array class of thebasic floating-point class.IloNumExpr The class of numeric expressions ina Concert model.IloNumExprArg A class used internally in ConcertTechnology.IloNumExprArray The class IloNumExprArray.IloNumExpr::NonLinearExpressionThe class of exceptions thrown if anumeric constant of a nonlinearexpression is set or queried.IloNumVar An instance of this class representsa numeric variable in a model.IloNumVarArray The array class of IloNumVar.IloObjective An instance of this class is anobjective in a model.IloOr Represents a disjunctive constraint.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 41


IloRandom This handle class produces streamsof pseudo-random numbers.IloRangeAn instance of this class is a range ina model.IloRangeArrayIloRangeArray is the array class ofranges for a model.IloSemaphoreProvides synchronization primitives.IloSolution Instances of this class storesolutions to problems.IloSolutionIterator This template class creates a typediterator over solutions.IloSolution::Iterator It allows you to traverse the variablesin a solution.IloSolutionManip An instance of this class accesses aspecific part of a solution.IloTimer Represents a timer.Macros SummaryIloFloatVar An instance of this class representsa constrained floating-point variablein Concert Technology.IloFloatVarArray The array class of IloFloatVar.IloHalfPi Half pi.IloPi Pi.IloQuarterPi Quarter pi.ILOSTLBEGINIloThreeHalfPi Three half-pi.IloTwoPi Two pi.Enumerations SummaryIloAlgorithm::Status An enumeration for the classIloAlgorithm.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 42


IloDeleterMode An enumeration to set the mode ofan IloDeleter.IloNumVar::Type nested enumeration.IloObjective::Sense Specifies objective as minimizationor maximization.Type Definitions SummaryIloBool Type for Boolean values.IloCplex::Status An enumeration for the classIloAlgorithm.IloInt Type for signed integers.IloNum Type for numeric values as floatingpointnumbers.IloSolutionArrayThis type definition represents arraysof instances of IloSolution.Global Functions SummaryIloAbsIloAbs returns the absolute value ofits argument.IloAdd Template to add elements to amodel.IloArcCos Trigonometric functions.IloCeilComputes the least integer value notless than its argument.IloDisableNANDetection Disables NaN (Not a number)detection.IloDiv This function is available for integerdivision.IloEnableNANDetection Enables NaN (Not a number)detection.IloEndMT This function ends multithreading.IloExponent Returns the exponent of itsargument.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 43


IloFloor This function computes the largestinteger value not greater.IloGetClone Creates a clone.IloInitMT This function initializesmultithreading.IloIsNAN Tests whether a double value is aNaN.IloLexicographicIloLog Returns the natural logarithm of itsargument.IloMax Returns a numeric valuerepresenting the max of numericvalues.IloMaximizeThis function defines a maximizationobjective in a model.IloMin Returns a numeric valuerepresenting the min of numericvalues.IloMinimize This function defines a minimizationobjective in a model.IloPiecewiseLinear Represents a continuous ordiscontinuous piecewise linearfunction.IloPowerReturns the power of its arguments.IloRound This function computes the nearestinteger value.IloScalProd Represents the scalar product.IloScalProd Represents the scalar product.IloScalProd Represents the scalar product.IloScalProd Represents the scalar product.IloSquare Returns the square of its argument.IloSum For constraint programming: returnsa numeric value representing the sumof numeric values.operator && Overloaded <strong>C++</strong> operator forconjunctive constraints.operator * Returns an expression equal to theproduct of its arguments.operator new Overloaded <strong>C++</strong> new operator.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 44


operator! Overloaded <strong>C++</strong> operator fornegation.operator!= overloaded <strong>C++</strong> operator.operator% Returns an expression equal to themodulo of its arguments.operator% Returns an expression equal to themodulo of its arguments.operator+ Returns an expression equal to thesum of its arguments.operator- Returns an expression equal to thedifference of its arguments.operator/ Returns an expression equal to thequotient of its arguments.operator overloaded <strong>C++</strong> operator.operator overloaded <strong>C++</strong> operator.operatoroperator overloaded <strong>C++</strong> operator.operator==operator> overloaded <strong>C++</strong> operator.operator>= overloaded <strong>C++</strong> operator.operator>> Overloaded <strong>C++</strong> operator redirectsinput.operator|| Overloaded <strong>C++</strong> operator for adisjunctive constraint.Global Variables SummaryILO_NO_MEMORY_MANAGER OS environment variable controlsConcert Technology memorymanager.DescriptionConcert Technology offers a <strong>C++</strong> library of classes and functions that enable you todesign models of problems for both math programming (including linear programming,mixed integer programming, quadratic programming, and network programming) andconstraint programming solutions.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 45


ILOSTLBEGINILOSTLBEGINCategorySynopsisDescriptionMacroILOSTLBEGIN()This macro enables you run your application either with the STL (Standard TemplateLibrary) of Microsoft Visual <strong>C++</strong> or with other platforms. It is defined as:using namespace stdwhen the STL is used (ports of type stat_sta, stat_mta or stat_mda);otherwise, its value is simply null.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 46


ILO_NO_MEMORY_MANAGERILO_NO_MEMORY_MANAGERCategoryDefinition FileGlobal Variableilconcert/ilosys.hSummary OS environment variable controls Concert Technology memory manager.This operating-system environment variable enables you to control the memorymanager of Concert Technology.Concert Technology uses its own memory manager to provide faster memory allocationfor certain Concert Technology objects. The use of this memory manager can hidememory problems normally detected by memory usage applications (such as RationalPurify, for example). If you are working in a software development environment capableof detecting bad memory access, you can use this operating-system environmentvariable to turn off the Concert Technology memory manager in order to detect suchanomalies during software development.For example, if you are working in such a development environment on a personalcomputer running Microsoft XP, use this statement:set ILO_NO_MEMORY_MANAGER=1If you are working on a UNIX platform, using a C-shell, here is one way of setting thisenvironment variable:setenv ILO_NO_MEMORY_MANAGER<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 47


IloAbsIloAbsCategoryDefinition FileSynopsisSummaryDescriptionGlobal Functionilconcert/iloexpression.hpublic IloNumExprArg IloAbs(const IloNumExprArg arg)public IloNum IloAbs(IloNum val)public IloNum IloPower(IloNum val1,IloNum val2)public IloIntExprArg IloAbs(const IloIntExprArg arg)IloAbs returns the absolute value of its argument.Concert Technology offers predefined functions that return an expression from analgebraic function on expressions. These predefined functions also return a numericvalue from an algebraic function on numeric values as well.IloAbs returns the absolute value of its argument.What Is ExtractedIloAbs is extracted by an instance of IloCplex and linearized automatically.IloAbs is extracted by an instance of IloCP or IloSolver as an instance ofIlcAbs.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 48


IloAddIloAddCategoryDefinition FileSynopsisGlobal Functionilconcert/ilomodel.hpublic X IloAdd(IloModel & mdl,X x)Summary Template to add elements to a model.DescriptionThis <strong>C++</strong> template helps when you want to add elements to a model. In those synopses,X represents a class, x is an instance of the class X. The class X must beIloExtractable, IloExtractableArray, or one of their subclasses.If model is an instance of IloModel, derived from IloExtractable, then x willbe added to the top level of that model.As an alternative to this way of adding extractable objects to a model, you may also useIloModel::add.This template preserves the original type of its argument x when it returns x. Thisfeature of the template may be useful, for example, in cases like this:IloRange rng = IloAdd(model, 3 * x + y == 17);For a comparison of these two ways of adding extractable objects to a model, seeAdding Extractable Objects in the documentation of IloExtractable.See AlsoIloAnd, IloExtractable, IloExtractableArray, IloModel, IloOr<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 49


IloAlgorithmIloAlgorithmCategoryClassInheritancePathDefinition Fileilconcert/iloalg.hSummary The base class of algorithms in Concert Technology.Constructor SummarypublicIloAlgorithm(IloAlgorithmI * impl=0)Method Summarypublic voidpublic voidpublic ostream &public voidpublic IloEnvpublic IloIntpublic voidpublic IloModelpublic IloNumpublic IloAlgorithm::Statuspublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic voidclear() constend()error() constextract(const IloModel) constgetEnv() constgetIntValue(const IloIntVar) constgetIntValues(constIloIntVarArray,IloIntArray) constgetModel() constgetObjValue() constgetStatus() constgetTime() constgetValue(const IloNumExprArg) constgetValue(const IloObjective) constgetValue(const IloIntVar) constgetValue(const IloNumVar) constgetValues(const IloIntVarArray,IloNumArray)const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 50


IloAlgorithmpublic voidpublic IloBoolpublic ostream &public voidpublic voidpublic voidpublic voidpublic voidpublic IloBoolpublic ostream &getValues(const IloNumVarArray,IloNumArray)constisExtracted(const IloExtractable) constout() constprintTime() constresetTime() constsetError(ostream &)setOut(ostream &)setWarning(ostream &)solve() constwarning() constInner EnumerationIloAlgorithm::Status An enumeration for the class IloAlgorithm.Inner ClassIloAlgorithm::IloAlgorithm::CannotRemoveExceptionIloAlgorithm::IloAlgorithm::CannotExtractExceptionIloAlgorithm::IloAlgorithm::ExceptionIloAlgorithm::IloAlgorithm::NotExtractedExceptionThe class of exceptions thrown if an objectcannot be removed from a model.The class of exceptions thrown if an objectcannot be extracted from a model.The base class of exceptions thrown byclasses derived from IloAlgorithm.The class of exceptions thrown if anextractable object has no value in the currentsolution of an algorithm.DescriptionIloAlgorithm is the base class of algorithms in Concert Technology. An instance ofthis class represents an algorithm in Concert Technology.In general terms, you define a model, and Concert Technology extracts objects from itfor your target algorithm and then solves for solutions.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.Status<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 51


IloAlgorithmThe member function getStatus returns a status showing information about thecurrently extracted model and the solution (if there is one). For explanations of thestatus, see the nested enumeration IloAlgorithm::Status.ExceptionsThe class IloAlgorithm::Exception, derived from the class IloException,is the base class of exceptions thrown by classes derived from IloAlgorithm. For anexplanation of exceptions thrown by instances of IloAlgorithm, seeIloAlgorithm::Exception.Streams and OutputThe class IloAlgorithm supports these communication streams:◆◆ostream& error() const; for error messages.ostream& out() const; for general output.◆ ostream& warning() const; for warning messages about nonfatal conditions.Child classes:◆ the class IloCplex in the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong> <strong>Manual</strong>◆ the class IloCP in the <strong>ILOG</strong> CP Optimizer <strong>Reference</strong> <strong>Manual</strong>.◆ the class IloSolver in the <strong>ILOG</strong> Solver <strong>Reference</strong> <strong>Manual</strong> .See AlsoConstructorsMethodsIloEnv, IloModel, IloAlgorithm::Status,IloAlgorithm::Exceptionpublic IloAlgorithm(IloAlgorithmI * impl=0)This constructor creates an algorithm in Concert Technology from its implementationobject. This is the default constructor.public void clear() constThis member function clears the current model from the algorithm.public void end()This member function deletes the invoking algorithm. That is, it frees memoryassociated with the invoking algorithm.public ostream & error() constThis member function returns a reference to the stream currently used for errormessages from the invoking algorithm. IloAlgorithm::error is initialized withthe value of IloEnv::error.public void extract(const IloModel) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 52


IloAlgorithmThis member function extracts the extractable objects from a model into the invokingalgorithm if a member function exists to extract the objects from the model for theinvoking algorithm. Not all extractable objects can be extracted by all algorithms; seethe documentation of the algorithm class you are using for a list of extractable classes itsupports.When you use this member function to extract extractable objects from a model, itextracts all the elements of that model for which Concert Technology creates therepresentation of the extractable object suitable for the invoking algorithm.The attempt to extract may fail. In case such a failure occurs, Concert Technologythrows the exception CannotExtractException on platforms that support <strong>C++</strong>exceptions when exceptions are enabled.For example, a failure will occur if you attempt to extract more than one objective for aninvoking algorithm that accepts only one objective, and Concert Technology will throwthe exception MultipleObjException.public IloEnv getEnv() constThis member function returns the environment of the invoking algorithm.public IloInt getIntValue(const IloIntVar) constThis member function returns the integer value of an integer variable in the currentsolution of the invoking algorithm. For example, to access the variable, use the memberfunction getIntValue(var) where var is an instance of the class IloIntVar.If there is no value to return for var, this member function raises an error. This memberfunction throws the exception NotExtractedException if there is no value toreturn (for example, if var was not extracted by the invoking algorithm).public void getIntValues(const IloIntVarArray,IloIntArray) constThis member function accepts an array of variables vars and puts the correspondingvalues into the array vals; the corresponding values come from the current solution ofthe invoking algorithm. The array vals must be a clean, empty array when you pass itto this member function.If there are no values to return for vars, this member function raises an error. Onplatforms that support <strong>C++</strong> exceptions, when exceptions are enabled, this memberfunction throws the exception NotExtractedException in such a case.public IloModel getModel() constThis member function returns the model of the invoking algorithm.public IloNum getObjValue() constThis member function returns the numeric value of the objective function associatedwith the invoking algorithm.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 53


IloAlgorithmpublic IloAlgorithm::Status getStatus() constThis member function returns a status showing information about the current model andthe solution. For explanations of the status, see the nested enumerationIloAlgorithm::Status.public IloNum getTime() constThis member function returns the amount of time elapsed in seconds since the mostrecent reset of the invoking algorithm. (The member function printTime directs theoutput of getTime to the output channel of the invoking algorithm.)See AlsoIloTimerpublic IloNum getValue(const IloNumExprArg) constThis member function returns the value of an expression in the current solution of theinvoking algorithm. For example, to access the expression, use the member functiongetValue(expr) where expr is an instance of the class IloNumExprArg.If there is no value to return for expr, this member function raises an error. Thismember function throws the exception NotExtractedException if there is novalue to return (for example, if expr was not extracted by the invoking algorithm).public IloNum getValue(const IloObjective) constThis member function returns the value of an objective in the current solution of theinvoking algorithm. For example, to access the objective, use the member functiongetValue(obj) where obj is an instance of the class IloObjective.If there is no value to return for obj, this member function raises an error. This memberfunction throws the exception NotExtractedException if there is no value toreturn (for example, if obj was not extracted by the invoking algorithm).public IloNum getValue(const IloIntVar) constThis member function returns the numeric value of an integer variable in the currentsolution of the invoking algorithm. For example, to access the variable, use the memberfunction getValue(var) where var is an instance of the class IloIntVar.If there is no value to return for var, this member function raises an error. This memberfunction throws the exception NotExtractedException if there is no value toreturn (for example, if var was not extracted by the invoking algorithm).public IloNum getValue(const IloNumVar) constThis member function returns the numeric value of a numeric variable in the currentsolution of the invoking algorithm. For example, to access the value of the variable, usethe member function getValue(var) where var is an instance of the classIloNumVar.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 54


IloAlgorithmIf there is no value to return for var, this member function raises an error. This memberfunction throws the exception NotExtractedException if there is no value toreturn (for example, if var was not extracted by the invoking algorithm).public void getValues(const IloIntVarArray,IloNumArray) constThis member function accepts an array of variables vars and puts the correspondingvalues into the array vals; the corresponding values come from the current solution ofthe invoking algorithm. The array vals must be a clean, empty array when you pass itto this member function.If there are no values to return for vars, this member function raises an error. Onplatforms that support <strong>C++</strong> exceptions, when exceptions are enabled, this memberfunction throws the exception NotExtractedException in such a case.public void getValues(const IloNumVarArray,IloNumArray) constThis member function accepts an array of variables vars and puts the correspondingvalues into the array vals; the corresponding values come from the current solution ofthe invoking algorithm. The array vals must be a clean, empty array when you pass itto this member function.If there are no values to return for vars, this member function raises an error. Onplatforms that support <strong>C++</strong> exceptions, when exceptions are enabled, this memberfunction throws the exception NotExtractedException in such a case.public IloBool isExtracted(const IloExtractable) constThis member function returns IloTrue if extr has been extracted for the invokingalgorithm; otherwise, it returns IloFalse.public ostream & out() constThis member function returns a reference to the stream currently used for logging.General output from the invoking algorithm is accessible through this member function.IloAlgorithm::out is initialized with the value of IloEnv::out.public void printTime() constThis member function directs the output of the member function getTime to an outputchannel of the invoking algorithm. (The member function getTime accesses theelapsed time in seconds since the most recent reset of the invoking algorithm.)public void resetTime() constThis member function resets the timer on the invoking algorithm. The type of timer isplatform dependent. On Windows systems, the time is elapsed wall clock time. OnUNIX systems, the time is CPU time.public void setError(ostream &)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 55


IloAlgorithmThis member function sets the stream for errors generated by the invoking algorithm. Bydefault, the stream is defined by an instance of IloEnv as cerr.public void setOut(ostream &)This member function redirects the out() stream with the stream given as anargument.This member function can be used with IloEnv::getNullStream to suppressscreen output by redirecting it to the null stream.public void setWarning(ostream &)This member function sets the stream for warnings from the invoking algorithm. Bydefault, the stream is defined by an instance of IloEnv as cout.public IloBool solve() constThis member function solves the current model in the invoking algorithm. In otherwords, solve works with all extractable objects extracted from the model for thealgorithm. The member function returns IloTrue if it finds a solution (not necessarilyan optimal one). Here is an example of its use:if (algo.solve()) {algo.out()


IloAlgorithm::CannotExtractExceptionIloAlgorithm::CannotExtractExceptionCategoryInner ClassInheritancePathDefinition Fileilconcert/iloalg.hSummary The class of exceptions thrown if an object cannot be extracted from a model.Method Summarypublic voidpublic const IloAlgorithmI *public IloExtractableArray &end()getAlgorithm() constgetExtractables()Inherited methods from IloExceptionIloException::end, IloException::getMessageDescriptionMethodsIf an attempt to extract an object from a model fails, this exception is thrown.public void end()This member function deletes the invoking exception. That is, it frees memoryassociated with the invoking exception.public const IloAlgorithmI * getAlgorithm() constThe member function getAlgorithm returns the algorithm from which the exceptionwas thrown.public IloExtractableArray & getExtractables()<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 57


IloAlgorithm::CannotExtractExceptionThe member function getExtractables returns the extractable objects that triggered theexception.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 58


IloAlgorithm::CannotRemoveExceptionIloAlgorithm::CannotRemoveExceptionCategoryInner ClassInheritancePathDefinition Fileilconcert/iloalg.hSummary The class of exceptions thrown if an object cannot be removed from a model.Method Summarypublic voidpublic const IloAlgorithmI *public IloExtractableArray &end()getAlgorithm() constgetExtractables()Inherited methods from IloExceptionIloException::end, IloException::getMessageDescriptionMethodsIf an attempt to remove an extractable object from a model fails, this exception isthrown.public void end()This member function deletes the invoking exception. That is, it frees memoryassociated with the invoking exception.public const IloAlgorithmI * getAlgorithm() constThe member function getAlgorithm returns the algorithm from which the exceptionwas thrown.public IloExtractableArray & getExtractables()<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 59


IloAlgorithm::CannotRemoveExceptionThe member function getExtractables returns the extractable objects that triggered theexception.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 60


IloAlgorithm::ExceptionIloAlgorithm::ExceptionCategoryInner ClassInheritancePathDefinition Fileilconcert/iloalg.hSummary The base class of exceptions thrown by classes derived from IloAlgorithm.Constructor SummarypublicException(const char * str)Inherited methods from IloExceptionIloException::end, IloException::getMessageDescriptionSee AlsoConstructorsIloAlgorithm is the base class of algorithms in Concert Technology.The class IloAlgorithm::Exception, derived from the class IloException, is thebase class of exceptions thrown by classes derived from IloAlgorithm.On platforms that support <strong>C++</strong> exceptions, when exceptions are enabled, the memberfunction extract will throw an exception if you attempt to extract an unsuitableobject from your model for an algorithm. An extractable object is unsuitable for analgorithm if there is no member function to extract the object from your model to thatalgorithm.For example, an attempt to extract more than one objective into an algorithm thataccepts only one objective will throw an exception.Similarly, the member function getValue will throw an exception if you attempt toaccess the value of a variable that has not yet been bound to a value.IloAlgorithm, IloExceptionpublic Exception(const char * str)This constructor creates an exception thrown from a member of IloAlgorithm. Theexception contains the message string str, which can be queried with the memberfunction IloException::getMessage.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 61


IloAlgorithm::NotExtractedExceptionIloAlgorithm::NotExtractedExceptionCategoryInner ClassInheritancePathDefinition Fileilconcert/iloalg.hSummary The class of exceptions thrown if an extractable object has no value in the currentsolution of an algorithm.Constructor SummarypublicNotExtractedException(const IloAlgorithmI*,const IloExtractable)Method Summarypublic const IloAlgorithmI * getAlgorithm() constpublic const IloExtractable & getExtractable()Inherited methods from IloExceptionIloException::end, IloException::getMessageDescriptionIf an expression, numeric variable, objective, or array of extractable objects has no valuein the current solution of an algorithm, this exception is thrown.Constructors public NotExtractedException(const IloAlgorithmI *,const IloExtractable)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 62


IloAlgorithm::NotExtractedExceptionThe constructor NotExtractedException creates an exception thrown from thealgorithm object alg for the extractable object extr.Methodspublic const IloAlgorithmI * getAlgorithm() constThe member function getAlgorithm returns the algorithm from which the exceptionwas thrown.public const IloExtractable & getExtractable()The member function getExtractable returns the extractable object that triggeredthe exception.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 63


IloAlgorithm::StatusIloAlgorithm::StatusCategoryDefinition FileSynopsisInner Enumerationilconcert/iloalg.hStatus{Unknown,Feasible,Optimal,Infeasible,Unbounded,InfeasibleOrUnbounded,Error};Summary An enumeration for the class IloAlgorithm.DescriptionIloAlgorithm is the base class of algorithms in Concert Technology, andIloAlgorithm::Status is an enumeration limited in scope to the classIloAlgorithm. The member function getStatus returns a status showinginformation about the current model and the solution.Unknown specifies that the algorithm has no information about the solution of themodel.Feasible specifies that the algorithm found a feasible solution (that is, an assignmentof values to variables that satisfies the constraints of the model, though it may notnecessarily be optimal). The member functions getValue access this feasiblesolution.Optimal specifies that the algorithm found an optimal solution (that is, an assignmentof values to variables that satisfies all the constraints of the model and that is provedoptimal with respect to the objective of the model). The member functions getValueaccess this optimal solution.Infeasible specifies that the algorithm proved the model infeasible; that is, it is notpossible to find an assignment of values to variables satisfying all the constraints in themodel.Unbounded specifies that the algorithm proved the model unbounded.InfeasibleOrUnbounded specifies that the model is infeasible or unbounded.Error specifies that an error occurred and, on platforms that support exceptions, thatan exception has been thrown.See Also the enumeration IloCplex::Status in the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong><strong>Manual</strong> for status specific to the <strong>CPLEX</strong> algorithms.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 64


IloAlgorithm::StatusSee AlsoFieldsIloAlgorithm, operatorUnknownFeasibleOptimalInfeasibleUnboundedInfeasibleOrUnboundedError<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 65


IloAndIloAndCategoryClassInheritancePathDefinition Fileilconcert/ilomodel.hSummary Defines a logical conjunctive-AND among other constraints.Constructor SummarypublicpublicpublicIloAnd()IloAnd(IloAndI * impl)IloAnd(const IloEnv env,const char * name=0)Method Summarypublic voidpublic voidpublic IloAndI *public voidpublic voidadd(const IloConstraintArray array) constadd(const IloConstraint constraint) constgetImpl() constremove(const IloConstraintArray array) constremove(const IloConstraint constraint) constInherited methods from IloConstraintIloConstraint::getImpl<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 66


IloAndInherited methods from IloIntExprArgIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionAn instance of IloAnd represents a conjunctive constraint. In other words, it defines alogical conjunctive-AND among any number of constraints. It lets you represent aconstraint on constraints in your model. Since an instance of IloAnd is a constraintitself, you can build up extensive conjunctions by adding constraints to an instance ofIloAnd by means of the member function add. You can also remove constraints froman instance of IloAnd by means of the member function remove.The elements of a conjunctive constraint must be in the same environment.In order for the constraint to take effect, you must add it to a model with the templateIloAdd or the member function IloModel::add and extract the model for analgorithm with the member function extract.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.Conjunction of Goals<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 67


IloAndIf you want to represent the conjunction of goals (rather than constraints) in yourmodel, then you should consider the function IloAndGoal (documented in the <strong>ILOG</strong>Solver <strong>Reference</strong> <strong>Manual</strong>).What Is ExtractedAll the constraints (that is, instances of IloConstraint or one of its subclasses) thathave been added to a conjunctive constraint (an instance of IloAnd) and that have notbeen removed from it will be extracted when an algorithm such as IloCplex, IloCP,or IloSolver extracts the constraint.ExampleFor example, you may write:IloAnd and(env);and.add(constraint1);and.add(constraint2);and.add(constraint3);Those lines are equivalent to :IloAnd and = constraint1 && constraint2 && constraint3;See AlsoConstructorsIloConstraint, IloOr, operator &&public IloAnd()This constructor creates an empty handle. You must initialize it before you use it.public IloAnd(IloAndI * impl)This constructor creates a handle object from a pointer to an implementation object.public IloAnd(const IloEnv env,const char * name=0)This constructor creates a conjunctive constraint for use in the environment env. Inorder for the constraint to take effect, you must add it to a model with the templateIloAdd or the member function IloModel::add and extract the model for analgorithm with the member function extract.The optional argument name is set to 0 by default.Methodspublic void add(const IloConstraintArray array) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 68


IloAndThis member function makes all the elements in array elements of the invokingconjunctive constraint. In other words, it applies the invoking conjunctive constraint toall the elements of array.Note: The member function add notifies Concert Technology algorithmsabout this change to the invoking object.public void add(const IloConstraint constraint) constThis member function makes constraint one of the elements of the invokingconjunctive constraint. In other words, it applies the invoking conjunctive constraint toconstraint.Note: The member function add notifies Concert Technology algorithmsabout this change to the invoking object.public IloAndI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public void remove(const IloConstraintArray array) constThis member function removes all the elements of array from the invokingconjunctive constraint so that the invoking conjunctive constraint no longer applies toany of those elements.Note: The member function remove notifies Concert Technologyalgorithms about this change to the invoking object.public void remove(const IloConstraint constraint) constThis member function removes constraint from the invoking conjunctive constraintso that the invoking conjunctive constraint no longer applies to constraint.Note: The member function remove notifies Concert Technologyalgorithms about this change to the invoking object.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 69


IloArcCosIloArcCosCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloNumExprArg IloArcCos(const IloNumExprArg arg)public IloNum IloCos(IloNum val)public IloNum IloSin(IloNum val)public IloNum IloTan(IloNum val)public IloNum IloArcCos(IloNum val)public IloNum IloArcSin(IloNum val)public IloNum IloArcTan(IloNum val)public IloNumExprArg IloSin(const IloNumExprArg arg)public IloNumExprArg IloCos(const IloNumExprArg arg)public IloNumExprArg IloTan(const IloNumExprArg arg)public IloNumExprArg IloArcSin(const IloNumExprArg arg)public IloNumExprArg IloArcTan(const IloNumExprArg arg)Summary Trigonometric functions.DescriptionConcert Technology offers predefined functions that return an expression from atrigonometric function on an expression. These predefined functions also return anumeric value from a trigonometric function on a numeric value as well.Programming HintIf you want to manipulate constrained floating-point expressions in degrees, we stronglyrecommend that you call the trigonometric functions on variables expressed in radiansand then convert the results to degrees (rather than declaring the constrained floatingpointexpressions in degrees and then converting them to radians to call thetrigonometric functions).The reason for that advice is that the method we recommend gives more accurate resultsin the context of the usual floating-point pitfalls.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 70


IloArrayIloArrayCategoryClassInheritancePathDefinition Fileilconcert/iloenv.hSummary A template to create classes of arrays for elements of a given class.Constructor SummarypublicIloArray(IloEnv env,IloInt max=0)Method Summarypublic voidadd(IloArray< X > ax) constpublic voidadd(IloInt more,X x) constpublic voidadd(X x) constpublic voidclear()public voidend()public IloEnvgetEnv() constpublic IloIntgetSize() constpublic X & operator[](IloInt i)public const X &operator[](IloInt i) constpublic voidremove(IloInt first,IloInt nb=1)DescriptionThis <strong>C++</strong> template creates a class of arrays for elements of a given class. In other words,you can use this template to create arrays of Concert Technology objects; you can alsouse this template to create arrays of arrays (that is, multidimensional arrays).In its synopsis, X represents a class, x is an instance of the class X. This template createsthe array class (IloArrayX) for any class in Concert Technology, including classeswith names in the form IloXArray, such as IloExtractableArray. ConcertTechnology predefines the array classes listed here as See Also. The member functionsdefined by this template are documented in each of those predefined classes.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 71


IloArrayThe classes you create in this way consist of extensible arrays. That is, you can addelements to the array as needed.Deleting ArraysThe member function end created by this template deletes only the array; the memberfunction does not delete the elements of the array.Copying ArraysLike certain other Concert Technology classes, a class of arrays created by IloArrayis a handle class corresponding to an implementation class. In other words, an instanceof an IloArray class is a handle pointing to a corresponding implementation object.More than one handle may point to the same implementation object.Input and Output of Multidimensional ArraysThe template operator >> makes it possible to read numeric values from a file in theformat [x, y, z, ...] where x, y, z are the results of the operator >> forclass X. Class X must provide a default constructor for operator >> to work. Thatis, the statement X x;must work for X. This input operator is limited to numeric values.Likewise, the template operator at the end of that statement. It is necessary in <strong>C++</strong>.)However, there is a practical limit of four on the number of dimensions supported by theinput operator for reading multidimensional arrays. This limit is due to the inability ofcertain <strong>C++</strong> compilers to support templates correctly. Specifically, you can read input bymeans of the input operator for multidimensional arrays of one, two, three, or fourdimensions. There is no such limit on the number of dimensions with respect to theoutput operator for multidimensional arrays.See Also these classes in the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong> <strong>Manual</strong>:IloSemiContVarArray, IloSOS1Array, IloSOS2Array,IloNumColumnArray.See AlsoIloAnyArray, IloAnySetVarArray, IloAnyVarArray, IloBoolArray,IloBoolVarArray, IloConstraintArray, IloExprArray,IloExtractableArray, IloFloatArray, IloFloatVarArray, IloIntArray,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 72


IloArrayIloIntVarArray, IloNumVarArray, IloRangeArray,IloSolutionArrayConstructorsMethodspublic IloArray(IloEnv env,IloInt max=0)This constructor creates an array of max elements, all of which are empty handles.public void add(IloArray< X > ax) constThis member function appends the elements in ax to the invoking array.public void add(IloInt more,X x) constThis member function appends x to the invoking array multiple times. The argumentmore specifies how many times.public void add(X x) constThis member function appends x to the invoking array.public void clear()This member function removes all the elements from the invoking array. In other words,it produces an empty array.public void end()This member function first removes the invoking extractable object from all otherextractable objects where it is used (such as a model, ranges, etc.) and then deletes theinvoking extractable object. That is, it frees all the resources used by the invoking object.After a call to this member function, you cannot use the invoking extractable objectagain.public IloEnv getEnv() constThis member function returns the environment where the invoking array was created.The elements of the invoking array belong to the same environment.public IloInt getSize() constThis member function returns an integer specifying the size of the invoking array. Anempty array has size 0 (zero).public X & operator[](IloInt i)This operator returns a reference to the object located in the invoking array at theposition specified by the index i.public const X & operator[](IloInt i) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 73


IloArrayThis operator returns a reference to the object located in the invoking array at theposition specified by the index i. On const arrays, Concert Technology uses theconst operator:IloArray operator[] (IloInt i) const;public void remove(IloInt first,IloInt nb=1)This member function removes elements from the invoking array. It begins removingelements at the index specified by first, and it removes nb elements (nb = 1 bydefault).<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 74


IloBarrierIloBarrierCategoryClassInheritancePathDefinition Fileilconcert/ilothread.hSummary A system class to synchronize threads at a specified number.Constructor SummarypublicIloBarrier(int count)Method Summarypublic intwait()DescriptionThe class IloBarrier provides synchronization primitives adapted to ConcertTechnology. A barrier, an instance of this class, serves as a rendezvous for a specificnumber of threads. After you create a barrier for n threads, the first n-1 threads to reachthat barrier will be blocked. The nth thread to arrive at the barrier completes thesynchronization and wakes up the n-1 threads already waiting at that barrier. When thenth thread arrives, the barrier resets itself. Any other thread that arrives at this point isblocked and will participate in a new barrier of size n.See ILOUSEMT for details about the compilation macro to use with instances of thisclass.Note:The class IloBarrier has nothing to do with the <strong>ILOG</strong> <strong>CPLEX</strong>barrier optimizer.System ClassIloBarrier is a system class.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 75


IloBarrierMost Concert Technology classes are actually handle classes whose instances point toobjects of a corresponding implementation class. For example, instances of the ConcertTechnology class IloNumVar are handles pointing to instances of the implementationclass IloNumVarI. Their allocation and de-allocation in a Concert Technologyenvironment are managed by an instance of IloEnv.However, system classes, such as IloBarrier, differ from that Concert Technologypattern. IloBarrier is an ordinary <strong>C++</strong> class. Its instances are allocated on the <strong>C++</strong>heap.Instances of IloBarrier are not automatically de-allocated by a call toIloEnv::end. You must explicitly destroy instances of IloBarrier by means of acall to the delete operator (which calls the appropriate destructor) when your applicationno longer needs instances of this class.Furthermore, you should not allocate—neither directly nor indirectly—any instance ofIloBarrier in a Concert Technology environment because the destructor for thatinstance of IloBarrier will never be called automatically by IloEnv::end whenit cleans up other Concert Technology objects in that Concert Technology environment.For example, it is not a good idea to make an instance of IloBarrier part of aconventional Concert Technology model allocated in a Concert Technologyenvironment because that instance will not automatically be de-allocated from theConcert Technology environment along with the other Concert Technology objects.De-allocating Instances of IloBarrierInstances of IloBarrier differ from the usual Concert Technology objects becausethey are not allocated in a Concert Technology environment, and their de-allocation isnot managed automatically for you by IloEnv::end. Instead, you must explicitlydestroy instances of IloBarrier by calling the delete operator when yourapplication no longer needs those objects.See AlsoConstructorsMethodsIloCondition, IloFastMutex, ILOUSEMTpublic IloBarrier(int count)This constructor creates an instance of IloBarrier of size count and allocates it onthe <strong>C++</strong> heap (not in a Concert Technology environment).public int wait()The first count-1 calls to this member function block the calling thread. The last call(that is, the call numbered count) wakes up all the count-1 waiting threads. Once athread has been woken up, it leaves the barrier. When a thread leaves the barrier (that is,when it returns from the wait call), it will return either 1 (one) or 0 (zero). If the threadreturns 0, the barrier is not yet empty. If the thread returns 1, it was the last thread at thebarrier.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 76


IloBarrierA nonempty barrier contains blocked threads or exiting threads.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 77


IloBaseEnvMutexIloBaseEnvMutexCategoryClassInheritancePathDefinition Fileilconcert/iloenv.hSummary A class to initialize multithreading in an application.Method Summarypublic virtual voidpublic virtual voidlock()unlock()DescriptionSee AlsoMethodsAn instance of this base class in the function IloInitMT initializes multithreading in aConcert Technology application. For a general purpose mutex, see the classIloFastMutex.IloFastMutex, IloInitMTpublic virtual void lock()This member function locks a mutex.public virtual void unlock()This member function unlocks a mutex.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 78


IloBoolIloBoolCategoryDefinition FileSynopsisType Definitionilconcert/ilosys.hIloInt IloBoolSummary Type for Boolean values.DescriptionSee AlsoThis type definition represents Boolean values in Concert Technology. Those values areIloTrue and IloFalse. Booleans are, in fact, integers of type IloInt.IloFalse is 0 (zero), and IloTrue is 1 (one). This type anticipates the built-inbool type proposed for standard <strong>C++</strong>. By using this type, you can be sure that theConcert Technology components of your application will port in this respect withoutsource changes across different hardware platforms.IloBoolArray, IloInt, IloModel, IloNum<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 79


IloBoolArrayIloBoolArrayCategoryClassInheritancePathDefinition FileSummaryilconcert/iloenv.hIloBoolArray is the array class of the basic Boolean class for a model.Constructor SummarypublicpublicpublicIloBoolArray(IloArrayI * i=0)IloBoolArray(const IloEnv env,IloInt n=0)IloBoolArray(const IloEnv env,IloInt n,constIloBool v0,const IloBool v1...)Method Summarypublic void add(IloInt more,const IloBool x)public void add(const IloBool x)public void add(const IloBoolArray x)Inherited methods from IloIntArrayIloIntArray::contains, IloIntArray::contains, IloIntArray::discard,IloIntArray::discard, IloIntArray::operator[], IloIntArray::operator[],IloIntArray::operator[], IloIntArray::toNumArrayDescriptionIloBoolArray is the array class of the basic Boolean class for a model. It is a handleclass. The implementation class for IloBoolArray is the undocumented classIloBoolArrayI.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 80


IloBoolArrayInstances of IloBoolArray are extensible. (They differ from instances ofIlcBoolArray in this respect.) <strong>Reference</strong>s to an array change whenever an elementis added to or removed from the array.For each basic type, Concert Technology defines a corresponding array class. That arrayclass is a handle class. In other words, an object of that class contains a pointer toanother object allocated in a Concert Technology environment associated with a model.Exploiting handles in this way greatly simplifies the programming interface since thehandle can then be an automatic object: as a developer using handles, you do not have toworry about memory allocation.As handles, these objects should be passed by value, and they should be created asautomatic objects, where “automatic” has the usual <strong>C++</strong> meaning.Member functions of a handle class correspond to member functions of the same namein the implementation class.Assert and NDEBUGMost member functions of the class IloBoolArray are inline functions that containan assert statement. This statement checks that the handle pointer is not null. Thesestatements can be suppressed by the macro NDEBUG. This option usually reducesexecution time. The price you pay for this choice is that attempts to access through nullpointers are not trapped and usually result in memory faults.See AlsoConstructorsIloBoolpublic IloBoolArray(IloArrayI * i=0)This constructor creates an array of Boolean values from an implementation object.public IloBoolArray(const IloEnv env,IloInt n=0)This constructor creates an array of n Boolean values for use in a model in theenvironment specified by env. By default, its elements are empty handles.public IloBoolArray(const IloEnv env,IloInt n,const IloBool v0,const IloBool v1...)This constructor creates an array of n Boolean values; the elements of the new array takethe corresponding values: v0, v1, ...,v(n-1).Methodspublic void add(IloInt more,const IloBool x)This member function appends x to the invoking array of Boolean values; it appends xmore times.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 81


IloBoolArraypublic void add(const IloBool x)This member function appends the value x to the invoking array.public void add(const IloBoolArray x)This member function appends the values in the array x to the invoking array.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 82


IloBoolVarIloBoolVarCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary An instance of this class represents a constrained Boolean variable in a ConcertTechnology model.Constructor SummarypublicpublicpublicIloBoolVar(IloEnv env,IloInt min=0,IloIntmax=1,const char * name=0)IloBoolVar(IloEnv env,const char * name)IloBoolVar(const IloAddNumVar & column,constchar * name=0)Inherited methods from IloIntVarIloIntVar::getImpl, IloIntVar::getLB, IloIntVar::getMax,IloIntVar::getMin, IloIntVar::getUB, IloIntVar::setBounds,IloIntVar::setLB, IloIntVar::setMax, IloIntVar::setMin,IloIntVar::setPossibleValues, IloIntVar::setUBInherited methods from IloIntExprArg<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 83


IloBoolVarIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionSee AlsoConstructorsAn instance of this class represents a constrained Boolean variable in a ConcertTechnology model. Boolean variables are also known as binary decision variables. Theycan assume the values 0 (zero) or 1 (one).Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.What Is ExtractedAn instance of IloBoolVar is extracted by IloSolver (documented in the <strong>ILOG</strong>Solver <strong>Reference</strong> <strong>Manual</strong>) as an instance of the class IlcBoolVar (also documentedin the <strong>ILOG</strong> Solver <strong>Reference</strong> <strong>Manual</strong>).An instance of IloBoolVar is extracted by IloCplex (documented in the <strong>ILOG</strong><strong>CPLEX</strong> <strong>Reference</strong> <strong>Manual</strong>) as a column representing a numeric variable of type Boolwith bounds as specified by IloBoolVar.IloIntVar, IloNumVarpublic IloBoolVar(IloEnv env,IloInt min=0,IloInt max=1,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 84


IloBoolVarconst char * name=0)This constructor creates a Boolean variable and makes it part of the environment env.By default, the Boolean variable assumes a value of 0 (zero) or 1 (one). By default, itsname is the empty string, but you can specify a name of your own choice.public IloBoolVar(IloEnv env,const char * name)This constructor creates a Boolean variable and makes it part of the environment env.By default, its name is the empty string, but you can specify a name of your own choice.public IloBoolVar(const IloAddNumVar & column,const char * name=0)This constructor creates an instance of IloBoolVar like this:IloNumVar(column, 0.0, 1.0, ILOBOOL, name);<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 85


IloBoolVarArrayIloBoolVarArrayCategoryClassInheritancePathDefinition FileSummaryilconcert/iloexpression.hIloBoolVarArray is the array class of the Boolean variable class.Constructor SummarypublicIloBoolVarArray(IloDefaultArrayI * i=0)public IloBoolVarArray(const IloEnv env,IloInt n)publicIloBoolVarArray(const IloEnv env,constIloNumColumnArray columnarray)Method Summarypublic void add(IloInt more,const IloBoolVar x)public void add(const IloBoolVar x)public void add(const IloBoolVarArray x)public IloBoolVaroperator[](IloInt i) constpublic IloBoolVar & operator[](IloInt i)public IloIntExprArgoperator[](IloIntExprArg anIntegerExpr) constInherited methods from IloIntVarArray<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 86


IloBoolVarArrayIloIntVarArray::add, IloIntVarArray::add, IloIntVarArray::add,IloIntVarArray::endElements, IloIntVarArray::operator[],IloIntVarArray::operator[], IloIntVarArray::operator[],IloIntVarArray::toNumVarArrayInherited methods from IloIntExprArrayIloIntExprArray::add, IloIntExprArray::add, IloIntExprArray::add,IloIntExprArray::endElements, IloIntExprArray::operator[],IloIntExprArray::operator[], IloIntExprArray::operator[]Inherited methods from IloExtractableArrayIloExtractableArray::add, IloExtractableArray::add,IloExtractableArray::add, IloExtractableArray::endElements,IloExtractableArray::setNamesDescriptionSee AlsoConstructorsFor each basic type, Concert Technology defines a corresponding array class.IloBoolVarArray is the array class of the Boolean variable class for a model. It is ahandle class.Instances of IloBoolVarArray are extensible.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.IloBoolVarpublic IloBoolVarArray(IloDefaultArrayI * i=0)This constructor creates an empty extensible array of Boolean variables.public IloBoolVarArray(const IloEnv env,IloInt n)This constructor creates an extensible array of n Boolean variables.public IloBoolVarArray(const IloEnv env,const IloNumColumnArray columnarray)This constructor creates an extensible array of Boolean variables from a column array.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 87


IloBoolVarArrayMethodspublic void add(IloInt more,const IloBoolVar x)This member function appends x to the invoking array of Boolean variables. Theargument more specifies how many times.public void add(const IloBoolVar x)This member function appends the value x to the invoking array.public void add(const IloBoolVarArray x)This member function appends the variables in the array x to the invoking array.public IloBoolVar operator[](IloInt i) constThis operator returns a reference to the extractable object located in the invoking array atthe position specified by the index i. On const arrays, Concert Technology uses theconst operator:IloBoolVar operator[] (IloInt i) const;public IloBoolVar & operator[](IloInt i)This operator returns a reference to the extractable object located in the invoking array atthe position specified by the index i.public IloIntExprArg operator[](IloIntExprArg anIntegerExpr) constThis subscripting operator returns an expression argument for use in a constraint orexpression. For clarity, let's call A the invoking array. When anIntegerExpr isbound to the value i, the domain of the expression is the domain of A[i]. Moregenerally, the domain of the expression is the union of the domains of the expressionsA[i] where the i are in the domain of anIntegerExpr.This operator is also known as an element constraint.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 88


IloCeilIloCeilCategoryDefinition FileSynopsisGlobal Functionilconcert/iloenv.hpublic IloNum IloCeil(IloNum val)Summary Computes the least integer value not less than its argument.DescriptionThis function computes the least integer value not less than val.Examples:IloCeil(IloInfinity) is IloInfinity.IloCeil(-IloInfinity) is -IloInfinity.IloCeil(0) is 0.IloCeil(0.4) is 1.IloCeil(-0.4) is 0.IloCeil(0.5) is 1.IloCeil(-0.5) is 0.IloCeil(0.6) is 1.IloCeil(-0.6) is 0.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 89


IloConditionIloConditionCategoryClassInheritancePathDefinition FileSummaryilconcert/ilothread.hProvides synchronization primitives adapted to Concert Technology for use in a parallelapplication.Constructor SummarypublicIloCondition()Method Summarypublic voidbroadcast()public voidnotify()public void wait(IloFastMutex * m)DescriptionThe class IloCondition provides synchronization primitives adapted to ConcertTechnology for use in a parallel application.See ILOUSEMT for details about the compilation macro to use with instances of thisclass.An instance of the class IloCondition allows several threads to synchronize on aspecific event. In this context, inter-thread communication takes place through signals.A thread expecting a condition of the computation state (say, conditionC) to be truebefore it executes a treatmentT can wait until the condition is true. Whencomputation reaches a state where conditionC holds, then another thread can signalthis fact by notifying a single waiting thread or by broadcasting to all the waiting threadsthat conditionC has now been met.The conventional template for waiting on conditionC looks like this:<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 90


IloConditionmutex.lock();while (conditionC does not hold)condition.wait(&mutex);doTreatmentT();mutex.unlock();That template has the following properties:◆◆◆The whole fragment is a critical section so that the evaluation of conditionC isprotected. (Indeed, it would be unsafe to evaluate conditionC while at the sametime another thread modifies the computation state and affects the truth value ofconditionC.) The pair of member functions IloFastMutex::lock andIloFastMutex::unlock delimit the critical section.When a thread enters the wait call, the mutex is automatically unlocked by thesystem.The loop that repeatedly checks conditionC is essential to the correctness of thecode fragment. It protects against the following possibility: between the time that athread modifies the computation state (so that conditionC holds) and notifies awaiting thread and the moment the waiting thread wakes up, the computation statemight have been changed by another thread, and conditionC might very well befalse.◆ Upon returning from the wait call, the mutex is locked. The operation of waking upand locking the mutex is atomic. In other words, nothing can happen between thewaking and the locking.System ClassIloCondition is a system class.Most Concert Technology classes are actually handle classes whose instances point toobjects of a corresponding implementation class. For example, instances of the ConcertTechnology class IloNumVar are handles pointing to instances of the implementationclass IloNumVarI. Their allocation and de-allocation on the Concert Technology heapare managed by an instance of IloEnv.However, system classes, such as IloCondition, differ from that ConcertTechnology pattern. IloCondition is an ordinary <strong>C++</strong> class. Its instances areallocated on the <strong>C++</strong> heap.Instances of IloCondition are not automatically de-allocated by a call toIloEnv::end. You must explicitly destroy instances of IloCondition by meansof a call to the delete operator (which calls the appropriate destructor) when yourapplication no longer needs instances of this class.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 91


IloConditionFurthermore, you should not allocate—neither directly nor indirectly—any instance ofIloCondition on the Concert Technology heap because the destructor for thatinstance of IloCondition will never be called automatically by IloEnv::endwhen it cleans up other Concert Technology objects on the Concert Technology heap.For example, it is not a good idea to make an instance of IloCondition part of aconventional Concert Technology model allocated on the Concert Technology heapbecause that instance will not automatically be de-allocated from the ConcertTechnology heap along with the other Concert Technology objects.De-allocating Instances of IloConditionInstances of IloCondition differ from the usual Concert Technology objectsbecause they are not allocated on the Concert Technology heap, and their de-allocationis not managed automatically for you by IloEnv::end. Instead, you must explicitlydestroy instances of IloCondition by calling the delete operator when yourapplication no longer needs those objects.See AlsoConstructorsMethodsIloFastMutex, ILOUSEMTpublic IloCondition()This constructor creates an instance of IloCondition and allocates it on the <strong>C++</strong>heap (not in a Concert Technology environment). The instance contains data structuresspecific to an operating system.public void broadcast()This member function wakes all threads currently waiting on the invoking condition. Ifthere are no threads waiting, this member function does nothing.public void notify()This member function wakes one of the threads currently waiting on the invokingcondition.public void wait(IloFastMutex * m)This member function first puts the calling thread to sleep while it unlocks the mutex m.Then, when either of the member functions broadcast or notify wakes up thatthread, this member function acquires the lock on m and returns.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 92


IloConstraintIloConstraintCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary An instance of this class is a constraint in a model.Constructor SummarypublicpublicIloConstraint()IloConstraint(IloConstraintI * impl)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 93


IloConstraintMethod Summarypublic IloConstraintI *IloConstraint::getImpl() constInherited methods from IloIntExprArgIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionAn instance of this class is a constraint in a model. To create a constraint, you can:◆use a constructor from a subclass of IloConstraint, such as IloRange,IloAllDiff, etc. For example:IloAllDiff allDiff(env, vars);◆use a logical operator between constraints to return a constraint. For example, youcan use the logical operators on other constraints, like this:IloOr myOr = myConstraint1 || myConstraint2;<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 94


IloConstraint◆use an arithmetic operator between a numeric variable and an expression to return aconstraint. For example, you can use the arithmetic operators on numeric variablesor expressions, like this:IloRange rng = ( x + 3*y


IloConstraintArrayIloConstraintArrayCategoryClassInheritancePathDefinition FileSummaryilconcert/iloexpression.hIloConstraintArray is the array class of constraints for a model.Constructor SummarypublicpublicpublicIloConstraintArray(IloDefaultArrayI * i=0)IloConstraintArray(const IloConstraintArray &copy)IloConstraintArray(const IloEnv env,IloIntn=0)Method Summarypublic void add(IloInt more,const IloConstraint x)public void add(const IloConstraint x)public void add(const IloConstraintArray x)public IloConstraintoperator[](IloInt i) constpublic IloConstraint & operator[](IloInt i)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 96


IloConstraintArrayInherited methods from IloExtractableArrayIloExtractableArray::add, IloExtractableArray::add,IloExtractableArray::add, IloExtractableArray::endElements,IloExtractableArray::setNamesDescriptionSee AlsoConstructorsFor each basic type, Concert Technology defines a corresponding array class.IloConstraintArray is the array class of constraints for a model.Instances of IloConstraintArray are extensible. That is, you can add moreelements to such an array. <strong>Reference</strong>s to an array change whenever an element is addedor removed from the array.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.ArraysIloConstraint, operator>>, operatorpublic IloConstraintArray(IloDefaultArrayI * i=0)This constructor creates an empty array. You cannot create instances of theundocumented class IloDefaultArrayI. As an argument in this defaultconstructor, it allows you to pass 0 (zero) as a value to an optional argument in functionsand member functions that accept an array as an argument.public IloConstraintArray(const IloConstraintArray & copy)This copy constructor makes a copy of the array specified by copy.public IloConstraintArray(const IloEnv env,IloInt n=0)This constructor creates an array of n elements, each of which is an empty handle.Methodspublic void add(IloInt more,const IloConstraint x)This member function appends constraint to the invoking array multiple times. Theargument more specifies how many times.public void add(const IloConstraint x)This member function appends constraint to the invoking array.public void add(const IloConstraintArray x)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 97


IloConstraintArrayThis member function appends the elements in array to the invoking array.public IloConstraint operator[](IloInt i) constThis operator returns a reference to the constraint located in the invoking array at theposition specified by the index i. On const arrays, Concert Technology uses theconst operator:IloConstraint operator[] (IloInt i) const;public IloConstraint & operator[](IloInt i)This operator returns a reference to the constraint located in the invoking array at theposition specified by the index i.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 98


IloCplex::StatusIloCplex::StatusCategoryDefinition FileSynopsisInner Type Definitionilcplex/ilocplexi.hCplexStatus StatusSummary An enumeration for the class IloAlgorithm.DescriptionSee AlsoIloAlgorithm is the base class of algorithms in Concert Technology, andIloAlgorithm::Status is an enumeration limited in scope to the classIloAlgorithm. The member function getStatus returns a status showinginformation about the current model and the solution.Unknown specifies that the algorithm has no information about the solution of themodel.Feasible specifies that the algorithm found a feasible solution (that is, an assignmentof values to variables that satisfies the constraints of the model, though it may notnecessarily be optimal). The member functions getValue access this feasiblesolution.Optimal specifies that the algorithm found an optimal solution (that is, an assignmentof values to variables that satisfies all the constraints of the model and that is provedoptimal with respect to the objective of the model). The member functions getValueaccess this optimal solution.Infeasible specifies that the algorithm proved the model infeasible; that is, it is notpossible to find an assignment of values to variables satisfying all the constraints in themodel.Unbounded specifies that the algorithm proved the model unbounded.InfeasibleOrUnbounded specifies that the model is infeasible or unbounded.Error specifies that an error occurred and, on platforms that support exceptions, thatan exception has been thrown.See Also the enumeration IloCplex::Status in the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong><strong>Manual</strong> for status specific to the <strong>CPLEX</strong> algorithms.IloAlgorithm, operator<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 99


IloDeleterModeIloDeleterModeCategoryDefinition FileSynopsisEnumerationilconcert/iloenv.hIloDeleterMode{IloLinearDeleterMode,IloSafeDeleterMode,IloRecursiveDeleterMode,IloSmartDeleterMode};Summary An enumeration to set the mode of an IloDeleter.DescriptionFieldsThis enumeration allows you to set the IloDeleter mode. The modesIloRecursiveDeleterMode and IloSmartDeleterMode are not documentedand should not be used.You can set the mode using the member function IloEnv::setDeleter. For adescription of deletion in <strong>ILOG</strong> Concert Technology, refer to Deletion of ExtractableObjects.IloLinearDeleterModeIloSafeDeleterModeIloRecursiveDeleterModeIloSmartDeleterMode<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 100


IloDiffIloDiffCategoryClassInheritancePathDefinition Fileilconcert/ilomodel.hSummary Constraint that enforces inequality.Constructor SummarypublicpublicpublicpublicIloDiff()IloDiff(IloDiffI * impl)IloDiff(const IloEnv env,const IloNumExprArgexpr1,const IloNumExprArg expr2,const char *name=0)IloDiff(const IloEnv env,const IloNumExprArgexpr1,IloNum val,const char * name=0)Method Summarypublic IloDiffI *getImpl() constInherited methods from IloConstraintIloConstraint::getImpl<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 101


IloDiffInherited methods from IloIntExprArgIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionSee AlsoAn instance of this class is a constraint that enforces inequality (that is, “not equal” asspecified by !=) in Concert Technology.To create a constraint, you can:◆ use the inequality operator!= on constrained variables (instances ofIloNumVar and its subclasses) or expressions (instances of IloExpr and itssubclasses).◆ use a constructor from this class.In order for the constraint to take effect, you must add it to a model with the templateIloAdd or the member function IloModel::add and extract the model for analgorithm with the member function extract.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.IloAllDiff, IloConstraint, IloExpr, IloNumVar<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 102


IloDiffConstructorspublic IloDiff()This constructor creates an empty handle. You must initialize it before you use it.public IloDiff(IloDiffI * impl)This constructor creates a handle object from a pointer to an implementation object.public IloDiff(const IloEnv env,const IloNumExprArg expr1,const IloNumExprArg expr2,const char * name=0)This constructor creates a constraint that enforces inequality (!=) in a model between thetwo expressions that are passed as its arguments. You must use the template IloAdd orthe member function IloModel::add to add this constraint to a model in order for itto be taken into account.The optional argument name is set to 0 by default.public IloDiff(const IloEnv env,const IloNumExprArg expr1,IloNum val,const char * name=0)This constructor creates a constraint that enforces inequality (!=) in a model between theexpression expr1 and the floating-point value that are passed as its arguments. Youmust use the template IloAdd or the member function IloModel::add to add thisconstraint to a model in order for it to be taken into account.The optional argument name is set to 0 by default.Methodspublic IloDiffI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 103


IloDisableNANDetectionIloDisableNANDetectionCategoryDefinition FileSynopsisGlobal Functionilconcert/ilosys.hpublic void IloDisableNANDetection()Summary Disables NaN (Not a number) detection.DescriptionThis function turns off NaN (Not a number) detection.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 104


IloDivIloDivCategoryDefinition FileGlobal Functionilconcert/iloexpression.hSynopsis public IloIntExprArg IloDiv(const IloIntExprArg x,const IloIntExprArg y)public IloIntExprArg IloDiv(const IloIntExprArg x,IloInt y)public IloIntExprArg IloDiv(IloInt x,const IloIntExprArg y)Summary This function is available for integer division.DescriptionThis function is available for integer division. For numeric division, use operator/.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 105


IloEmptyHandleExceptionIloEmptyHandleExceptionCategoryClassInheritancePathDefinition Fileilconcert/iloenv.hSummary The class of exceptions thrown if an empty handle is passed.Constructor SummarypublicpublicIloEmptyHandleException()IloEmptyHandleException(const char * message)Inherited methods from IloExceptionIloException::end, IloException::getMessageDescriptionConstructorsThe exception IloEmptyHandleException is thrown if an empty handle is passedas an argument to a method, function, or class constructor.public IloEmptyHandleException()public IloEmptyHandleException(const char * message)This constructor creates an exception containing the message string message.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 106


IloEnableNANDetectionIloEnableNANDetectionCategoryDefinition FileSynopsisGlobal Functionilconcert/ilosys.hpublic void IloEnableNANDetection()Summary Enables NaN (Not a number) detection.DescriptionThis function enables your application to detect invalid data as a NaN (Not a number).<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 107


IloEndMTIloEndMTCategoryDefinition FileSynopsisGlobal Functionilconcert/iloenv.hpublic void IloEndMT()Summary This function ends multithreading.DescriptionThis function ends multithreading in a Concert Technology application.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 108


IloEnvIloEnvCategoryClassInheritancePathDefinition Fileilconcert/iloenv.hSummary The class of environments for models or algorithms in Concert Technology.Constructor SummarypublicpublicIloEnv()IloEnv(IloEnvI * impl)Method Summarypublic voidpublic ostream &public IloExtractableI *public IloEnvI *public IloIntpublic IloIntpublic ostream &public IloRandompublic IloNumpublic IloIntpublic const char *public IloBoolpublic ostream &public voidIloEnv::end()IloEnv::error() constgetExtractable(IloInt id)getImpl() constgetMaxId() constgetMemoryUsage() constIloEnv::getNullStream() constgetRandom() constgetTime() constgetTotalMemoryUsage() constgetVersion() constisValidId(IloInt id) constIloEnv::out() constprintTime() constpublic voidIloEnv::setDeleter(IloDeleterMode mode)constpublic void setError(ostream & s)public voidsetNormalizer(IloBool val) constpublic void setOut(ostream & s)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 109


IloEnvpublic void setWarning(ostream & s)public voidunsetDeleter() constpublic ostream &IloEnv::warning() constDescriptionAn instance of this class is an environment, managing memory and identifiers formodeling objects. Every Concert Technology object, such as an extractable object, amodel, or an algorithm, must belong to an environment. In <strong>C++</strong> terms, when youconstruct a model (an instance of IloModel) or an algorithm (an instance ofIloCplex, IloCP,orIloSolver, for example), then you must pass one instance ofIloEnv as an argument of that constructor.Environment and Memory ManagementAn environment (an instance of IloEnv) efficiently manages memory allocations forthe objects constructed with that environment as an argument. For example, whenConcert Technology objects in your model are extracted by an algorithm, thoseextracted objects are handled as efficiently as possible with respect to memorymanagement; there is no unnecessary copying that might cause memory explosions inyour application on the part of Concert Technology.When your application deletes an instance of IloEnv, Concert Technology willautomatically delete all models and algorithms depending on that environment as well.You delete an environment by calling the member function env.end.The memory allocated for Concert Technology arrays, expressions, sets, and columns isnot freed until all references to these objects have terminated and the objects themselveshave been deleted.Certain classes documented in this manual, such as IloFastMutex, are known assystem classes. They do not belong to a Concert Technology environment; in otherwords, an instance of IloEnv is not an argument in their constructors. As aconsequence, a Concert Technology environment does not attempt to manage theirmemory allocation and de-allocation; a call of IloEnv:end will not delete an instanceof a system class. These system classes are clearly designated in this documentation,and the appropriate constructors and destructors for them are documented in this manualas well.Environment and InitializationAn instance of IloEnv in your application initializes certain data structures andmodeling facilities for Concert Technology. For example, IloEnv initializes thesymbolic constant IloInfinity.The environment also specifies the current assumptions about normalization or thereduction of terms in linear expressions. For an explanation of this concept, see theconcept Normalization: Reducing Linear Terms<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 110


IloEnvEnvironment and Communication StreamsAn instance of IloEnv in your application initializes the default output streams forgeneral information, for error messages, and for warnings.Environment and Extractable ObjectsEvery extractable object in your problem must belong to an instance of IloEnv. In <strong>C++</strong>terms, in the constructor of certain extractable objects that you create, such as aconstrained variable, you must pass an instance of IloEnv as an argument to specifywhich environment the extractable object belongs to. An extractable object (that is, aninstance of IloExtractable or one of its derived subclasses) is tied throughout itslifetime to the environment where it is created. It can be used only with extractableobjects belonging to the same environment. It can be extracted only for an algorithmattached to the same environment.Two different environments cannot share the same extractable object.You can extract objects from only one environment into a given algorithm. In otherwords, algorithms do not extract objects from two or more different environments.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.See AlsoConstructorsIloException, IloModel, operator newpublic IloEnv()This constructor creates an environment to manage the extractable objects in ConcertTechnology.public IloEnv(IloEnvI * impl)This constructor creates an environment (a handle) from its implementation object.Methodspublic void end()When you call this member function, it cleans up the invoking environment. In otherwords, it deletes all the extractable objects (instances of IloExtractable and itssubclasses) created in that environment and frees the memory allocated for them. It alsodeletes all algorithms (instances of IloAlgorithm and its subclasses) created in thatenvironment and frees memory allocated for them as well, including the representationsof extractable objects extracted for those algorithms.The memory allocated for Concert Technology arrays, expressions, sets, and columns isnot freed until all references to these objects have terminated and the objects themselveshave been deleted.public ostream & error() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 111


IloEnvThis member function returns a reference to the output stream currently used for errormessages from the invoking environment. It is initialized as cerr.public IloExtractableI * getExtractable(IloInt id)This member function returns the extractable associated with the specified identifier id.public IloEnvI * getImpl() constThis member function returns the implementation object of the invoking environment.public IloInt getMaxId() constThis member function returns the highest id of all extractables int the current IloEnvpublic IloInt getMemoryUsage() constThis member function returns a value in bytes specifying how full the heap is.public ostream & getNullStream() constThis member function calls the null stream of the environment. This member functioncan be used with IloAlgorithm::setOut() to suppress screen output byredirecting it to the null stream.public IloRandom getRandom() constEach instance of IloEnv contains a random number generator, an instance of the classIloRandom. This member function returns that IloRandom instance.public IloNum getTime() constThis member function returns the amount of time elapsed in seconds since theconstruction of the invoking environment. (The member function printTime directsthis information to the output stream of the invoking environment.)public IloInt getTotalMemoryUsage() constThis member function returns a value in bytes specifying how large the heap is.public const char * getVersion() constThis member function returns a string specifying the version of <strong>ILOG</strong> ConcertTechnology.public IloBool isValidId(IloInt id) constThis methods tells you if the current id is associated with a live extractable.public ostream & out() constThis member function returns a reference to the output stream currently used forlogging. General output from the invoking environment is accessible through thismember function. By default, the logging output stream is defined by an instance ofIloEnv as cout.public void printTime() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 112


IloEnvThis member function directs the output of the member function getTime to the outputstream of the invoking environment. (The member function getTime accesses theelapsed time in seconds since the creation of the invoking environment.)public void setDeleter(IloDeleterMode mode) constThis member function sets the mode for the deletion of extractables, as described in theconcept Deletion of Extractable Objects. The mode can beIloLinearDeleterMode or IloSafeDeleterMode.public void setError(ostream & s)This member function sets the stream for errors generated by the invoking environment.By default, the stream is defined by an instance of IloEnv as cerr.public void setNormalizer(IloBool val) constThis member function turns on or off the facilities in Concert Technology fornormalizing linear expressions. Normalizing linear expressions is also known asreducing the terms of a linear expression. In this context, a linear expression that doesnot contain multiple terms with the same variable is said to be normalized. The conceptin this manual offers examples of this idea.When val is IloTrue, (the default), then Concert Technology analyzes linearexpressions to determine whether any variable appears more than once in a given linearexpression. It then combines terms in the linear expression to eliminate any duplicationof variables. This mode may require more time during preliminary computation, but itavoids the possibility of an assertion failing in the case of duplicated variables in theterms of a linear expression.When val is IloFalse, then Concert Technology assumes that all linear expressionsin the invoking environment have already been processed to reduce them to their mostefficient form. In other words, Concert Technology assumes that linear expressions havebeen normalized. This mode may save time during computation, but it entails the riskthat a linear expression may contain one or more variables, each of which appears in oneor more terms. This situation will cause certain assert statements in ConcertTechnology to fail if you do not compile with the flag -DNDEBUG.public void setOut(ostream & s)This member function redirects the out() stream with the stream given as anargument.This member function can be used with IloEnv::getNullStream to suppressscreen output by redirecting it to the null stream.public void setWarning(ostream & s)This member function sets the stream for warnings from the invoking environment. Bydefault, the stream is defined by an instance of IloEnv as cout.public void unsetDeleter() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 113


IloEnvThis member function unsets the mode for the deletion of extractables, as described inthe concept Deletion of Extractable Objects.public ostream & warning() constThis member function returns a reference to the output stream currently used forwarnings from the invoking environment. By default, the warning output stream isdefined by an instance of IloEnv as cout.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 114


IloEnvironmentMismatchIloEnvironmentMismatchCategoryClassInheritancePathDefinition Fileilconcert/iloenv.hSummary This exception is thrown if you try to build an object using objects from anotherenvironment.Constructor SummarypublicpublicIloEnvironmentMismatch()IloEnvironmentMismatch(const char * message)Inherited methods from IloExceptionIloException::end, IloException::getMessageDescriptionConstructorsThe IloEnvironmentMismatch exception is thrown if you try to build an objectusing objects from another environment.public IloEnvironmentMismatch()public IloEnvironmentMismatch(const char * message)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 115


IloExceptionIloExceptionCategoryClassInheritancePathDefinition Fileilconcert/ilosys.hSummary Base class of Concert Technology exceptions.Constructor SummaryprotectedIloException(const char * message=0,IloBooldeleteMessage=IloFalse)Method Summarypublic virtual voidpublic virtual const char *IloException::end()IloException::getMessage() constDescriptionSee AlsoConstructorsThis class is the base class for exceptions in Concert Technology. An instance of thisclass represents an exception on platforms that support exceptions when exceptions areenabled.IloEnv, operatorprotected IloException(const char * message=0,IloBool deleteMessage=IloFalse)This protected constructor creates an exception.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 116


IloExceptionMethodspublic virtual void end()This member function deletes the invoking exception. That is, it frees memoryassociated with the invoking exception.public virtual const char * getMessage() constThis member function returns the message (a character string) of the invoking exception.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 117


IloExponentIloExponentCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloNumExprArg IloExponent(const IloNumExprArg arg)public IloNum IloExponent(IloNum val)Summary Returns the exponent of its argument.DescriptionConcert Technology offers predefined functions that return an expression from analgebraic function on expressions. These predefined functions also return a numericvalue from an algebraic function on numeric values as well.IloExponent returns the exponentiation of its argument. In order to conform to IEEE754 standards for floating-point arithmetic, you should use this function in your ConcertTechnology applications, rather than the standard <strong>C++</strong> exp.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 118


IloExprIloExprCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary An instance of this class represents an expression in a model.Constructor SummarypublicpublicpublicpublicpublicpublicIloExpr()IloExpr(IloNumExprI * expr)IloExpr(const IloNumLinExprTerm term)IloExpr(const IloIntLinExprTerm term)IloExpr(IloNumExprArg)IloExpr(const IloEnv env,IloNum=0)Method Summarypublic IloNumpublic IloNumLinTermI *publicIloExpr::LinearIteratorpublic IloBoolpublic IloIntpublic IloExpr &public IloExpr &public IloExpr &public IloExpr &getConstant() constgetImpl() constgetLinearIterator() constisNormalized() constnormalize() constoperator *=(IloNum val)operator+=(const IloIntLinExprTerm term)operator+=(const IloNumLinExprTerm term)operator+=(const IloIntVar var)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 119


IloExprpublic IloExpr &public IloExpr &public IloExpr &public IloExpr &public IloExpr &public IloExpr &public IloExpr &public IloExpr &public IloExpr &public IloExpr &public voidpublic voidpublic voidpublic voidpublic voidoperator+=(const IloNumVar var)operator+=(const IloNumExprArg expr)operator+=(IloNum val)operator-=(const IloIntLinExprTerm term)operator-=(const IloNumLinExprTerm term)operator-=(const IloIntVar var)operator-=(const IloNumVar var)operator-=(const IloNumExprArg expr)operator-=(IloNum val)operator/=(IloNum val)remove(const IloNumVarArray vars)setConstant(IloNum cst)setLinearCoef(const IloNumVar var,IloNumvalue)setLinearCoefs(const IloNumVarArrayvars,IloNumArray values)setNumConstant(IloNum constant)Inherited methods from IloNumExprIloNumExpr::getImpl, IloNumExpr::operator *=, IloNumExpr::operator+=,IloNumExpr::operator+=, IloNumExpr::operator-=, IloNumExpr::operator-=,IloNumExpr::operator/=Inherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractable<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 120


IloExprIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectInner ClassIloExpr::IloExpr::LinearIteratorAn iterator over the linear part of anexpression.DescriptionAn instance of this class represents an expression in a model. An instance of IloExpris a handle.Expressions in EnvironmentsThe variables in an expression must all belong to the same environment as theexpression itself. In other words, you must not mix variables from differentenvironments within the same expression.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.Programming Hint: Creating ExpressionsIn addition to using a constructor of this class to create an expression, you may alsoinitialize an instance of IloExpr as a <strong>C++</strong> expression built from variables of a model.For example:IloNumVar x;IloNumVar y;IloExpr expr = x + y;Programming Hint: Empty Handles and Null ExpressionsThis statement creates an empty handle:IloExpr e1;<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 121


IloExprYou must initialize it before you use it. For example, if you attempt to use it in this way:e1 += 10; // BAD IDEAWithout the compiler option -DNDEBUG, that line will cause an assert statement tofail because you are attempting to use an empty handle.In contrast, the following statementIloExpr e2(env);creates a handle to a null expression. You can use this handle to build up an expression,for example, in this way:e2 += 10; // OKNormalizing Linear Expressions: Reducing the TermsNormalizing is sometimes known as reducing the terms of a linear expression.Linear expressions consist of terms made up of constants and variables related byarithmetic operations; for example, x + 3y is a linear expression of two terms consistingof two variables. In some expressions, a given variable may appear in more than oneterm, for example, x + 3y +2x. Concert Technology has more than one way of dealingwith linear expressions in this respect, and you control which way Concert Technologytreats expressions from your application.In one mode, Concert Technology analyzes linear expressions that your applicationpasses it and attempts to reduce them so that a given variable appears in only one term inthe linear expression. This is the default mode. You set this mode with the memberfunction setNormalizer(IloTrue).In the other mode, Concert Technology assumes that no variable appears in more thanone term in any of the linear expressions that your application passes to ConcertTechnology. We call this mode assume normalized linear expressions. You set this modewith the member function setNormalizer(IloFalse).Certain constructors and member functions in this class check this setting in theenvironment and behave accordingly: they assume that no variable appears in more thanone term in a linear expression. This mode may save time during computation, but itentails the risk that a linear expression may contain one or more variables, each of whichappears in one or more terms. Such a case may cause certain assertions in memberfunctions of this class to fail if you do not compile with the flag -DNDEBUG.Certain constructors and member functions in this class check this setting in theenvironment and behave accordingly: they attempt to reduce expressions. This modemay require more time during preliminary computation, but it avoids of the possibilityof a failed assertion in case of duplicates.See AlsoIloExprArray, IloModel<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 122


IloExprConstructorspublic IloExpr()This constructor creates an empty handle. You must initialize it before you use it.public IloExpr(IloNumExprI * expr)This constructor creates an expression from a pointer to the implementation class ofnumeric expressions IloNumExprI*.public IloExpr(const IloNumLinExprTerm term)This constructor creates an integer expression with linear terms using the undocumentedclass IloNumLinExprTerm.public IloExpr(const IloIntLinExprTerm term)This constructor creates an integer expression with linear terms using the undocumentedclass IloIntLinExprTerm.public IloExpr(IloNumExprArg)This constructor creates an expression using the undocumented classIloNumExprArg.public IloExpr(const IloEnv env,IloNum=0)This constructor creates an expression in the environment specified by env. It may beused to build other expressions from variables belonging to env. You must not mixvariables of different environments within an expression.Methodspublic IloNum getConstant() constThis member function returns the constant term in the invoking expression.public IloNumLinTermI * getImpl() constThis member function returns the implementation object of the invoking enumeratedvariable.public IloExpr::LinearIterator getLinearIterator() constThis methods returns a linear iterator on the invoking expression.public IloBool isNormalized() constThis member function returns IloTrue if the invoking expression has been normalizedusing normalize.public IloInt normalize() constThis member function normalizes the invoking linear expression. Normalizing issometimes known as reducing the terms of a linear expression. That is, if there is morethan one linear term using the same variable in the invoking linear expression, then this<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 123


IloExprmember function merges those linear terms into a single term expressed in that variable.The return value specifies the number of merged terms.For example, 1*x + 17*y - 3*x becomes 17*y - 2*x, and the member functionreturns 1 (one).If you attempt to use this member function on a nonlinear expression, it throws anexception.public IloExpr & operator *=(IloNum val)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x * ...public IloExpr & operator+=(const IloIntLinExprTerm term)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x + ...public IloExpr & operator+=(const IloNumLinExprTerm term)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x + ...public IloExpr & operator+=(const IloIntVar var)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x + ...public IloExpr & operator+=(const IloNumVar var)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x + ...public IloExpr & operator+=(const IloNumExprArg expr)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x + ...public IloExpr & operator+=(IloNum val)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x + ...public IloExpr & operator-=(const IloIntLinExprTerm term)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x - ...public IloExpr & operator-=(const IloNumLinExprTerm term)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x - ...public IloExpr & operator-=(const IloIntVar var)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 124


IloExprThis operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x - ...public IloExpr & operator-=(const IloNumVar var)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x - ...public IloExpr & operator-=(const IloNumExprArg expr)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x - ...public IloExpr & operator-=(IloNum val)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x - ...public IloExpr & operator/=(IloNum val)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x / ...public void remove(const IloNumVarArray vars)This member function removes all occurrences of all variables listed in the array varsfrom the invoking expression. For linear expressions, the effect of this member functionis equivalent to setting the coefficient for all the variables listed in vars to 0 (zero).public void setConstant(IloNum cst)This member function assigns cst as the constant term in the invoking expression.public void setLinearCoef(const IloNumVar var,IloNum value)This member function assigns value as the coefficient of var in the invokingexpression if the invoking expression is linear. This member function applies only tolinear expressions. In other words, you can not use this member function to change thecoefficient of a non linear expression. An attempt to do so will cause ConcertTechnology to throw an exception.public void setLinearCoefs(const IloNumVarArray vars,IloNumArray values)For each of the variables in vars, this member function assigns the correspondingvalue of values as its linear coefficient if the invoking expression is linear. Thismember function applies only to linear expressions. In other words, you can not use thismember function to change the coefficient of a nonlinear expression. An attempt to doso will cause Concert Technology to throw an exception.public void setNumConstant(IloNum constant)This member function assigns cst as the constant term in the invoking expression.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 125


IloExprArrayIloExprArrayCategoryClassInheritancePathDefinition FileSummaryilconcert/iloexpression.hIloExprArray is the array class of the expressions class.Constructor SummarypublicpublicIloExprArray(IloDefaultArrayI * i=0)IloExprArray(const IloEnv env,IloInt n=0)Method Summarypublic IloNumExprArgoperator[](IloIntExprArg anIntegerExpr) constInherited methods from IloNumExprArrayIloNumExprArray::add, IloNumExprArray::add, IloNumExprArray::add,IloNumExprArray::endElements, IloNumExprArray::operator[]Inherited methods from IloExtractableArrayIloExtractableArray::add, IloExtractableArray::add,IloExtractableArray::add, IloExtractableArray::endElements,IloExtractableArray::setNames<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 126


IloExprArrayDescriptionSee AlsoConstructorsFor each basic type, Concert Technology defines a corresponding array class.IloExprArray is the array class of the expressions class (IloExpr) for a model.Instances of IloExprArray are extensible. That is, you can add more elements tosuch an array. <strong>Reference</strong>s to an array change whenever an element is added to orremoved from the array.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.IloExprpublic IloExprArray(IloDefaultArrayI * i=0)This constructor creates an empty array of expressions for use in a model. You cannotcreate instances of the undocumented class IloDefaultArrayI. As an argument inthis default constructor, it allows you to pass 0 (zero) as a value to an optional argumentin functions and member functions that accept an array as an argument.public IloExprArray(const IloEnv env,IloInt n=0)This constructor creates an array of n elements. Initially, the n elements are emptyhandles.Methodspublic IloNumExprArg operator[](IloIntExprArg anIntegerExpr) constThis subscripting operator returns an expression argument for use in a constraint orexpression. For clarity, let's call A the invoking array. When anIntegerExpr isbound to the value i, the domain of the expression is the domain of A[i]. Moregenerally, the domain of the expression is the union of the domains of the expressionsA[i] where the i are in the domain of anIntegerExpr.This operator is also known as an element constraint.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 127


IloExpr::LinearIteratorIloExpr::LinearIteratorCategoryInner ClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary An iterator over the linear part of an expression.Method Summarypublic IloNumpublic IloNumVarpublic IloBoolpublic voidgetCoef() constgetVar() constok() constoperator++()DescriptionAn instance of the nested class IloExpr::LinearIterator is an iterator that traverses thelinear part of an expression.ExampleStart with an expression that contains both linear and non linear terms:IloExpr e = 2*x + 3*y + cos(x);Now define a linear iterator for the expression:IloExpr::LinearIterator it(e);That constructor creates a linear iterator initialized on the first linear term in e, that is,the term (2*x). Consequently, a call to the member function ok returns IloTrue.it.ok(); // returns IloTrueA call to the member function getCoef returns the coefficient of the current linearterm.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 128


IloExpr::LinearIteratorit.getCoef(); // returns 2 from the term (2*x)Likewise, the member function getVar returns the handle of the variable of the currentlinear term.it.getVar(); // returns handle of x from the term (2*x)A call to the operator++ at this point advances the iterator to the next linear term,(3*y). The iterator ignores nonlinear terms in the expression.++it; // goes to next linear term (3*y)it.ok(); // returns IloTrueit.getCoef(); // returns 3 from the term (3*y)it.getVar(); // returns handle of y from the term (3*y)++it; // goes to next linear term, if there is one in the expressionit.ok(); // returns IloFalse because there is no linear termMethodspublic IloNum getCoef() constThis member function returns the coefficient of the current term.public IloNumVar getVar() constThis member function returns the variable of the current term.public IloBool ok() constThis member function returns IloTrue if there is a current element and the iteratorpoints to it. Otherwise, it returns IloFalse.public void operator++()This operator advances the iterator to point to the next term of the linear part of theexpression.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 129


IloExtractableIloExtractableCategoryClassInheritancePathDefinition Fileilconcert/iloextractable.hSummary Base class of all extractable objects.Constructor SummarypublicIloExtractable(IloExtractableI * obj=0)Method Summarypublic IloConstraintpublic IloIntExprArgpublic IloModelpublic IloNumExprArgpublic IloObjectivepublic IloNumVarpublic voidpublic IloEnvpublic IloIntpublic IloExtractableI *public const char *IloExtractable::asConstraint() constIloExtractable::asIntExpr() constIloExtractable::asModel() constIloExtractable::asNumExpr() constIloExtractable::asObjective() constIloExtractable::asVariable() constIloExtractable::end()IloExtractable::getEnv() constIloExtractable::getId() constIloExtractable::getImpl() constIloExtractable::getName() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 130


IloExtractablepublic IloAnypublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic voidpublic voidIloExtractable::getObject() constIloExtractable::isConstraint() constIloExtractable::isIntExpr() constIloExtractable::isModel() constIloExtractable::isNumExpr() constIloExtractable::isObjective() constIloExtractable::isVariable() constIloExtractable::setName(const char * name)constIloExtractable::setObject(IloAny obj) constDescriptionThis class is the base class of all extractable objects (that is, instances of such classes asIloConstraint, IloNumVar, and so forth). Instances of subclasses of this classrepresent objects (such as constraints, constrained variables, objectives, and so forth)that can be extracted by Concert Technology from your model for use by yourapplication in Concert Technology algorithms.Not every algorithm can extract every extractable object of a model. For example, amodel may include more than one objective, but you can extract only one objective foran instance of IloCplex.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.Adding Extractable ObjectsGenerally, for an extractable object to be taken into account by one of the algorithms inConcert Technology, you must add the extractable object to a model with the memberfunction IloModel::add and extract the model for the algorithm with the memberfunction extract.Environment and Extractable ObjectsEvery extractable object in your model must belong to one instance of IloEnv. Anextractable object (that is, an instance of IloExtractable or one of its derivedsubclasses) is tied throughout its lifetime to the environment where it is created. It canbe used only with extractable objects belonging to the same environment. It can beextracted only for an algorithm attached to the same environment.NotificationWhen you change an extractable object, for example by removing it from a model,Concert Technology notifies algorithms that have extracted the model containing thisextractable object about the change. Member functions that carry out such notificationare noted in this documentation.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 131


IloExtractableSee AlsoConstructorsMethodsSee AlsoIloEnv, IloGetClone, IloModelpublic IloExtractable(IloExtractableI * obj=0)This constructor creates a handle to the implementation object.public IloConstraint asConstraint() constThis method returns the given extractable as a constraint or a null pointerSee also IloExtractableVisitor if you want to introspect an expressionIloExtractableVisitorpublic IloIntExprArg asIntExpr() constThis method returns the given extractable as an integer expression or a null pointerSee also IloExtractableVisitor if you want to introspect an expressionSee AlsoIloExtractableVisitorpublic IloModel asModel() constThis method returns the given extractable as a model or a null pointerSee also IloExtractableVisitor if you want to introspect an expressionSee AlsoIloExtractableVisitorpublic IloNumExprArg asNumExpr() constThis method returns the given extractable as a floating expression or a null pointerSee also IloExtractableVisitor if you want to introspect an expressionSee AlsoIloExtractableVisitorpublic IloObjective asObjective() constThis method returns the given extractable as an objective or a null pointerSee also IloExtractableVisitor if you want to introspect an expressionSee AlsoIloExtractableVisitorpublic IloNumVar asVariable() constThis method returns the given extractable as a variable or a null pointerSee also IloExtractableVisitor if you want to introspect an expressionSee AlsoIloExtractableVisitor<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 132


IloExtractablepublic void end()This member function first removes the invoking extractable object from all otherextractable objects where it is used (such as a model, ranges, etc.) and then deletes theinvoking extractable object. That is, it frees all the resources used by the invoking object.After a call to this member function, you can not use the invoking extractable objectagain.Note: The member function end notifies Concert Technology algorithmsabout the destruction of this invoking object.public IloEnv getEnv() constThis member function returns the environment to which the invoking extractable objectbelongs. An extractable object belongs to exactly one environment; differentenvironments can not share the same extractable object.public IloInt getId() constThis member function returns the ID of the invoking extractable object.public IloExtractableI * getImpl() constThis member function returns a pointer to the implementation object of the invokingextractable object. This member function is useful when you need to be sure that you areusing the same copy of the invoking extractable object in more than one situation.public const char * getName() constThis member function returns a character string specifying the name of the invokingobject (if there is one).public IloAny getObject() constThis member function returns the object associated with the invoking object (if there isone). Normally, an associated object contains user data pertinent to the invoking object.public IloBool isConstraint() constThis method tells you wether the given extractable is a constraint or notSee also IloExtractableVisitor if you want to introspect an expressionSee AlsoIloExtractableVisitorpublic IloBool isIntExpr() constThis method tells you wether the given extractable is an integer expression or notSee also IloExtractableVisitor if you want to introspect an expression<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 133


IloExtractableSee AlsoIloExtractableVisitorpublic IloBool isModel() constThis method tells you wether the given extractable is a model or notSee also IloExtractableVisitor if you want to introspect an expressionSee AlsoIloExtractableVisitorpublic IloBool isNumExpr() constThis method tells you wether the given extractable is a floating expression or notSee also IloExtractableVisitor if you want to introspect an expressionSee AlsoIloExtractableVisitorpublic IloBool isObjective() constThis method tells you wether the given extractable is an objective or notSee also IloExtractableVisitor if you want to introspect an expressionSee AlsoIloExtractableVisitorpublic IloBool isVariable() constThis method tells you wether the given extractable is a variable or notSee also IloExtractableVisitor if you want to introspect an expressionSee AlsoIloExtractableVisitorpublic void setName(const char * name) constThis member function assigns name to the invoking object.public void setObject(IloAny obj) constThis member function associates obj with the invoking object. The member functiongetObject accesses this associated object afterward. Normally, obj contains userdata pertinent to the invoking object.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 134


IloExtractableArrayIloExtractableArrayCategoryClassInheritancePathDefinition Fileilconcert/iloextractable.hSummary An array of extractable objects.Constructor SummarypublicpublicpublicIloExtractableArray(IloDefaultArrayI * i=0)IloExtractableArray(const IloExtractableArray& r)IloExtractableArray(const IloEnv env,IloIntn=0)Method Summarypublic voidIloExtractableArray::add(IloInt more,constIloExtractable x)public voidIloExtractableArray::add(constIloExtractable x)public voidIloExtractableArray::add(constIloExtractableArray x)public voidIloExtractableArray::endElements()public void IloExtractableArray::setNames(const char *name)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 135


IloExtractableArrayDescriptionSee AlsoConstructorsAn instance of this class is an array of extractable objects (instances of the classIloExtractable or its subclasses).Instances of IloExtractableArray are extensible. That is, you can add moreelements to such an array. <strong>Reference</strong>s to an array change whenever an element is addedto or removed from the array.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.For information on arrays, see the concept ArraysIloArray, IloExtractable, operatorpublic IloExtractableArray(IloDefaultArrayI * i=0)This constructor creates an empty array of elements. You cannot create instances of theundocumented class IloDefaultArrayI. As an argument in this defaultconstructor, it allows you to pass 0 (zero) as a value to an optional argument infunctions and member functions that accept an array as an argument.public IloExtractableArray(const IloExtractableArray & r)This copy constructor creates a handle to the array of extractable objects specified by r.public IloExtractableArray(const IloEnv env,IloInt n=0)This constructor creates an array of n elements, each of which is an empty handle.Methodspublic void add(IloInt more,const IloExtractable x)This member function appends x to the invoking array multiple times. The argumentmore specifies how many times.public void add(const IloExtractable x)This member function appends x to the invoking array.public void add(const IloExtractableArray x)This member function appends the elements in the arrayx to the invoking array.public void endElements()This member function calls IloExtractable::end for each of the elements in theinvoking array. This deletes all the extractables identified by the array, leaving thehandles in the array intact. This member function is the recommended way to delete theelements of an array.public void setNames(const char * name)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 136


IloExtractableArrayThis member function set the name for all elements of the invoking array. All elementsmust be different, otherwise raise an error.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 137


IloExtractableVisitorIloExtractableVisitorCategoryClassInheritancePathDefinition Fileilconcert/iloextractable.hSummary The class IloExtractableVisitor inspects all nodes of an expression.Constructor SummarypublicIloExtractableVisitor()Method Summarypublic virtual void beginVisit(IloExtractableI * e)public virtual void endVisit(IloExtractableI * e)public virtual void visitChildren(IloExtractableI *parent,IloExtractableArray children)public virtual void visitChildren(IloExtractableI *parent,IloExtractableI * child)DescriptionThe class IloExtractableVisitor is used to introspect a Concert object andinspect all nodes of the expression.For example, you can introspect a given expression and look for all the variables within.You can do this by specializing the visitChildren methods and calling thebeginVisit method on the extractable you want to introspect.For example, if you visit an IloDiff object, you will visit the first expression, then thesecond expression. When visiting the first or second expression, you will visit their subexpressions,and so on.Constructorspublic IloExtractableVisitor()The default constructor.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 138


IloExtractableVisitorMethods public virtual void beginVisit(IloExtractableI * e)This method begins the introspection.public virtual void endVisit(IloExtractableI * e)This method ends the inspection.public virtual void visitChildren(IloExtractableI * parent,IloExtractableArray children)This method is called when the member of the object is an array.For example, when visiting an IloAllDiff(env, [x,y,z]) , you usevisitChildren(AllDiff, [x,y,z])public virtual void visitChildren(IloExtractableI * parent,IloExtractableI * child)This method is called when visiting a sub-extractable.For example, if you want to display all the variables in your object, you use:visitChildren(IloExtractableI* parent, IloExtractableI* child){IloExtractable extr(child); if (child.isVariable()) cout


IloFastMutexIloFastMutexCategoryClassInheritancePathDefinition Fileilconcert/ilothread.hSummary Synchronization primitives adapted to the needs of Concert Technology.Constructor SummarypublicIloFastMutex()Method Summarypublic intpublic voidpublic voidisLocked()IloFastMutex::lock()IloFastMutex::unlock()DescriptionThe class IloFastMutex provides synchronization primitives adapted to the needsof Concert Technology. In particular, an instance of the class IloFastMutex is anonrecursive mutex that implements mutual exclusion from critical sections of code inmultithreaded applications. The purpose of a mutex is to guarantee that concurrent callsto a critical section of code in a multithreaded application are serialized. If a criticalsection of code is protected by a mutex, then two (or more) threads cannot execute thecritical section simultaneously. That is, an instance of this class makes it possible foryou to serialize potentially concurrent calls.Concert Technology implements a mutex by using a single resource that you lock whenyour application enters the critical section and that you unlock when you leave. Onlyone thread can own that resource at a given time.See ILOUSEMT for details about the compilation macro to use with instances of thisclass.Protection by a Mutex<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 140


IloFastMutexA critical section of code in a multithreaded application is protected by a mutex whenthat section of code is encapsulated by a pair of calls to the member functionsIloFastMutex::lock and IloFastMutex::unlock.In fact, we say that a pair of calls to the member functions lock and unlock definesa critical section. The conventional way of defining a critical section looks like this:mutex.lock();while (conditionC does not hold)condition.wait(&mutex);doTreatmentT();mutex.unlock();The class IloCondition provides synchronization primitives to express conditionsin critical sections of code.State of a MutexA mutex (an instance of IloFastMutex) has a state; the state may be locked orunlocked. You can inquire about the state of a mutex to determine whether it is locked orunlocked by using the member function isLocked. When a thread enters a criticalsection of code in a multithreaded application and then locks the mutex defining thatcritical section, we say that the thread owns that lock and that lock belongs to the threaduntil the thread unlocks the mutex.ExceptionsThe member functions IloFastMutex::lock and IloFastMutex::unlockcan throw <strong>C++</strong> exceptions when exceptions are enabled on platforms that support them.These are the possible exceptions:◆◆IloMutexDeadlock: Instances of IloFastMutex are not recursive.Consequently, if a thread locks a mutex and then attempts to lock that mutex again,the member function lock throws the exception MutexDeadlock. On platformsthat do not support exceptions, it causes the application to exit.IloMutexNotOwner: The thread that releases a given lock (that is, the thread thatunlocks a mutex) must be the same thread that locked the mutex in the first place.For example, if a thread A takes lock L and thread B attempts to unlock L, then themember function unlock throws the exception MutexNotOwner. On platformsthat do not support exceptions, it causes the application to exit.◆ IloMutexNotOwner: The member function unlock throws this exceptionwhenever a thread attempts to unlock an instance of IloFastMutex that is notalready locked. On platforms that do not support exceptions, it causes the applicationto exit.System Class: Memory Management<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 141


IloFastMutexIloFastMutex is a system class.Most Concert Technology classes are actually handle classes whose instances point toobjects of a corresponding implementation class. For example, instances of the ConcertTechnology class IloNumVar are handles pointing to instances of the implementationclass IloNumVarI. Their allocation and de-allocation in internal data structures ofConcert Technology are managed by an instance of IloEnv.However, system classes, such as IloFastMutex, differ from that pattern.IloFastMutex is an ordinary <strong>C++</strong> class. Its instances are allocated on the <strong>C++</strong> heap.Instances of IloFastMutex are not automatically de-allocated by a call toIloEnv::end. You must explicitly destroy instances of IloFastMutex by meansof a call to the delete operator (which calls the appropriate destructor) when yourapplication no longer needs instances of this class.Furthermore, you should not allocate—neither directly nor indirectly—any instance ofIloFastMutex in the Concert Technology environment because the destructor forthat instance of IloFastMutex will never be called automatically by IloEnv::endwhen it cleans up other Concert Technology objects in the Concert Technologyenvironment. In other words, allocation of any instance of IloFastMutex in theConcert Technology environment will produce memory leaks.For example, it is not a good idea to make an instance of IloFastMutex part of aconventional Concert Technology model allocated in the Concert Technologyenvironment because that instance will not automatically be de-allocated from theConcert Technology environment along with the other Concert Technology objects.De-allocating Instances of IloFastMutexInstances of IloFastMutex differ from the usual Concert Technology objectsbecause they are not allocated in the Concert Technology environment, and their deallocationis not managed automatically for you by IloEnv::end. Instead, you mustexplicitly destroy instances of IloFastMutex by calling the delete operator whenyour application no longer needs those objects.See AlsoConstructorsMethodsIloBarrier, IloCondition, ILOUSEMTpublic IloFastMutex()This constructor creates an instance of IloFastMutex and allocates it on the <strong>C++</strong>heap (not in the Concert Technology environment). This mutex contains operatingsystem-specific resources to represent a lock. You may use this mutex for purposes thatare private to a process. Its behavior is undefined for inter-process locking.public int isLocked()<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 142


IloFastMutexThis member function returns a Boolean value that shows the state of the invokingmutex. That is, it tells you whether the mutex is locked by the calling thread (0) orunlocked (1) or locked by a thread other than the calling thread (also 1).public void lock()This member function acquires a lock for the invoking mutex on behalf of the callingthread. That lock belongs to the calling thread until the member function unlock iscalled.If you call this member function and the invoking mutex has already been locked, thenthe calling thread is suspended until the first lock is released.public void unlock()This member function releases the lock on the invoking mutex, if there is such a lock.If you call this member function on a mutex that has not been locked, then this memberfunction throws an exception if <strong>C++</strong> exceptions have been enabled on a platform thatsupports exceptions. Otherwise, it causes the application to exit.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 143


IloFloatVarIloFloatVarCategorySynopsisMacroIloFloatVar()Summary An instance of this class represents a constrained floating-point variable in ConcertTechnology.DescriptionSee AlsoAn instance of this class represents a constrained floating-point variable in ConcertTechnology.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.IloFloatVarArray, IloNumVar<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 144


IloFloatVarArrayIloFloatVarArrayCategorySynopsisMacroIloFloatVarArray()Summary The array class of IloFloatVar.DescriptionSee AlsoFor each basic type, Concert Technology defines a corresponding array class.IloFloatVarArray is the array class of the floating-point variable class for a model.It is a handle class.Instances of IloFloatVarArray are extensible.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.IloFloatVar<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 145


IloFloorIloFloorCategoryDefinition FileSynopsisGlobal Functionilconcert/iloenv.hpublic IloNum IloFloor(IloNum val)Summary This function computes the largest integer value not greater.DescriptionThis function computes the largest integer value not greater than val.Examples:IloFloor(IloInfinity) is IloInfinity.IloFloor(-IloInfinity) is -IloInfinity.IloFloor(0) is 0.IloFloor(0.4) is 0.IloFloor(-0.4) is -1.IloFloor(0.5) is 0.IloFloor(-0.5) is -1.IloFloor(0.6) is 0.IloFloor(-0.6) is -1.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 146


IloGetCloneIloGetCloneCategoryDefinition FileSynopsisGlobal Functionilconcert/iloextractable.hpublic X IloGetClone(IloEnvI * env,const X x)Summary Creates a clone.Description This <strong>C++</strong> template creates a clone (that is, an exact copy) of an instance of the class X.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 147


IloHalfPiIloHalfPiCategorySynopsisMacroIloHalfPi()Summary Half pi.DescriptionConcert Technology predefines conventional trigonometric constants to conform toIEEE 754 standards for quarter pi, half pi, pi, three-halves pi, and two pi.extern const IloNum IloHalfPi; // = 1.57079632679489661923<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 148


IloIfThenIloIfThenCategoryClassInheritancePathDefinition Fileilconcert/ilomodel.hSummary This class represents a condition constraint.Constructor SummarypublicpublicpublicIloIfThen()IloIfThen(IloIfThenI * impl)IloIfThen(const IloEnv env,constIloConstraint left,const IloConstraintright,const char * name=0)Method Summarypublic IloIfThenI *getImpl() constInherited methods from IloConstraintIloConstraint::getImpl<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 149


IloIfThenInherited methods from IloIntExprArgIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionSee AlsoConstructorsAn instance of IloIfThen represents a condition constraint. Generally, a conditionconstraint is composed of an if part (the conditional statement or left side) and a thenpart (the consequence or right side).In order for a constraint to take effect, you must add it to a model with the templateIloAdd or the member function IloModel::add and extract the model for analgorithm with the member function extract.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.IloConstraintpublic IloIfThen()This constructor creates an empty handle. You must initialize it before you use it.public IloIfThen(IloIfThenI * impl)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 150


IloIfThenThis constructor creates a handle object from a pointer to an implementation object.public IloIfThen(const IloEnv env,const IloConstraint left,const IloConstraint right,const char * name=0)This constructor creates a condition constraint in the environment specified by env.The argument left specifies the if-part of the condition. The argument rightspecifies the then-part of the condition. The string name specifies the name of theconstraint; it is 0 (zero) by default. For the constraint to take effect, you must add it to amodel and extract the model for an algorithm.Methodspublic IloIfThenI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 151


IloInitMTIloInitMTCategoryDefinition FileSynopsisGlobal Functionilconcert/iloenv.hpublic void IloInitMT()public void IloInitMT(IloBaseEnvMutex *)Summary This function initializes multithreading.DescriptionThis function initializes multithreading in a Concert Technology application.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 152


IloIntIloIntCategoryDefinition FileSynopsisType Definitionilconcert/ilosys.hlong IloIntSummary Type for signed integers.DescriptionSee AlsoThis type definition represents signed integers in Concert Technology.IloBool, IloModel, IloNum<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 153


IloIntArrayIloIntArrayCategoryClassInheritancePathDefinition FileSummaryilconcert/iloenv.hIloIntArray is the array class of the basic integer class.Constructor SummarypublicpublicpublicIloIntArray(IloArrayI * i=0)IloIntArray(const IloEnv env,IloInt n=0)IloIntArray(const IloEnv env,IloInt n,IloIntv0,IloInt v1...)Method Summarypublic IloBoolpublic IloBoolpublic voidpublic voidpublic IloIntExprArgIloIntArray::contains(IloIntArray ax) constIloIntArray::contains(IloInt value) constIloIntArray::discard(IloIntArray ax)IloIntArray::discard(IloInt value)IloIntArray::operator[](IloIntExprArgintExp) constpublic IloInt & IloIntArray::operator[](IloInt i)public const IloInt &public IloNumArrayIloIntArray::operator[](IloInt i) constIloIntArray::toNumArray() constDescriptionIloIntArray is the array class of the basic integer class for a model. It is a handleclass. The implementation class for IloIntArray is the undocumented classIloIntArrayI.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 154


IloIntArrayInstances of IloIntArray are extensible. (They differ from instances ofIlcIntArray in this respect.) <strong>Reference</strong>s to an array change whenever an element isadded to or removed from the array.For each basic type, Concert Technology defines a corresponding array class. That arrayclass is a handle class. In other words, an object of that class contains a pointer toanother object allocated in a Concert Technology environment associated with a model.Exploiting handles in this way greatly simplifies the programming interface since thehandle can then be an automatic object: as a developer using handles, you do not have toworry about memory allocation.As handles, these objects should be passed by value, and they should be created asautomatic objects, where “automatic” has the usual <strong>C++</strong> meaning.Member functions of a handle class correspond to member functions of the same namein the implementation class.Assert and NDEBUGMost member functions of the class IloIntArray are inline functions that contain anassert statement. This statement checks that the handle pointer is not null. Thesestatements can be suppressed by the macro NDEBUG. This option usually reducesexecution time. The price you pay for this choice is that attempts to access through nullpointers are not trapped and usually result in memory faults.IloIntArray inherits additional methods from the template IloArray:◆◆◆◆◆◆◆◆addaddcleargetEnvgetSizeremoveoperator[]operator[]See AlsoConstructorsIloIntpublic IloIntArray(IloArrayI * i=0)This constructor creates an array of integers from an implementation object.public IloIntArray(const IloEnv env,IloInt n=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 155


IloIntArrayThis constructor creates an array of n integers for use in a model in the environmentspecified by env. By default, its elements are empty handles.public IloIntArray(const IloEnv env,IloInt n,IloInt v0,IloInt v1...)This constructor creates an array of n integers; the elements of the new array take thecorresponding values: v0, v1, ..., v(n-1).Methodspublic IloBool contains(IloIntArray ax) constThis member function checks whether all the values of ax are contained or not.public IloBool contains(IloInt value) constThis member function checks whether the value is contained or not.public void discard(IloIntArray ax)This member function removes elements from the invoking array. It removes the arrayax.public void discard(IloInt value)This member function removes elements from the invoking array. It removes theelement.public IloIntExprArg operator[](IloIntExprArg intExp) constThis subscripting operator returns an expression node for use in a constraint orexpression. For clarity, let's call A the invoking array. When intExp is bound to thevalue i, then the domain of the expression is the domain of A[i]. More generally, thedomain of the expression is the union of the domains of the expressions A[i] where thei are in the domain of intExp.This operator is also known as an element constraint.public IloInt & operator[](IloInt i)This operator returns a reference to the object located in the invoking array at theposition specified by the index i.public const IloInt & operator[](IloInt i) constThis operator returns a reference to the object located in the invoking array at theposition specified by the index i. On const arrays, Concert Technology uses theconst operator:IloArray operator[] (IloInt i) const;<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 156


IloIntArraypublic IloNumArray toNumArray() constThis constructor creates an array of integers from an array of numeric values.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 157


IloIntExprIloIntExprCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary The class of integer expressions in Concert Technology.Constructor SummarypublicpublicpublicpublicpublicIloIntExpr()IloIntExpr(IloIntExprI * impl)IloIntExpr(const IloIntExprArg arg)IloIntExpr(const IloIntLinExprTerm term)IloIntExpr(const IloEnv env,IloInt constant=0)Method Summarypublic IloIntExprI *public IloIntExpr &public IloIntExpr &public IloIntExpr &public IloIntExpr &public IloIntExpr &getImpl() constoperator *=(IloInt val)operator+=(const IloIntExprArg expr)operator+=(IloInt val)operator-=(const IloIntExprArg expr)operator-=(IloInt val)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 158


IloIntExprInherited methods from IloIntExprArgIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionConstructorsInteger expressions in Concert Technology are represented using objects of typeIloIntEpr.public IloIntExpr()This constructor creates an empty handle. You must initialize it before you use it.public IloIntExpr(IloIntExprI * impl)This constructor creates a handle object from a pointer to an implementation object.public IloIntExpr(const IloIntExprArg arg)This constructor creates an integer expression using the undocumented classIloIntExprArg.public IloIntExpr(const IloIntLinExprTerm term)This constructor creates an integer expression with linear terms using the undocumentedclass IloIntLinExprTerm.public IloIntExpr(const IloEnv env,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 159


IloIntExprIloInt constant=0)This constructor creates a constant integer expression with the value constant thatthe user can modify subsequently with the operators +=, -=, ?= in the environmentenv.Methodspublic IloIntExprI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public IloIntExpr & operator *=(IloInt val)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x * ... .public IloIntExpr & operator+=(const IloIntExprArg expr)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x + ... .public IloIntExpr & operator+=(IloInt val)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x + ... .public IloIntExpr & operator-=(const IloIntExprArg expr)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x - ... .public IloIntExpr & operator-=(IloInt val)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x - ... .<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 160


IloIntExprArgIloIntExprArgCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary A class used internally in Concert Technology.Constructor SummarypublicpublicIloIntExprArg()IloIntExprArg(IloIntExprI * impl)Method Summarypublic IloIntExprI *IloIntExprArg::getImpl() constInherited methods from IloNumExprArgIloNumExprArg::getImpl<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 161


IloIntExprArgInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionConstructorsConcert Technology uses instances of these classes internally as temporary objects whenit is parsing a <strong>C++</strong> expression in order to build an instance of IloIntExpr. As aConcert Technology user, you will not need this class yourself; in fact, you should notuse them directly. They are documented here because the return value of certainfunctions, such as IloSum or IloScalProd, can be an instance of this class.public IloIntExprArg()This constructor creates an empty handle. You must initialize it before you use it.public IloIntExprArg(IloIntExprI * impl)This constructor creates a handle object from a pointer to an implementation object.Methodspublic IloIntExprI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 162


IloIntExprArrayIloIntExprArrayCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary The array class of IloIntExpr.Constructor SummarypublicpublicIloIntExprArray(IloDefaultArrayI * i=0)IloIntExprArray(const IloEnv env,IloInt n=0)Method Summarypublic voidIloIntExprArray::add(IloInt more,constIloIntExpr x)public void IloIntExprArray::add(const IloIntExpr x)public voidpublic voidpublic IloIntExprArgpublic IloIntExprIloIntExprArray::add(const IloIntExprArrayarray)IloIntExprArray::endElements()IloIntExprArray::operator[](IloIntExprArganIntegerExpr) constIloIntExprArray::operator[](IloInt i) constpublic IloIntExpr & IloIntExprArray::operator[](IloInt i)Inherited methods from IloExtractableArray<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 163


IloIntExprArrayIloExtractableArray::add, IloExtractableArray::add,IloExtractableArray::add, IloExtractableArray::endElements,IloExtractableArray::setNamesDescriptionConstructorsFor each basic type, Concert Technology defines a corresponding array class.IloIntExprArray is the array class of the integer expressions class(IloIntExpr) for a model.Instances of IloIntExprArray are extensible. That is, you can add more elementsto such an array. <strong>Reference</strong>s to an array change whenever an element is added to orremoved from the array.public IloIntExprArray(IloDefaultArrayI * i=0)This constructor creates an empty array of elements. You cannot create instances of theundocumented class IloDefaultArrayI. As an argument in this defaultconstructor, it allows you to pass 0 (zero) as a value to an optional argument infunctions and member functions that accept an array as an argument.public IloIntExprArray(const IloEnv env,IloInt n=0)This constructor creates an array of n elements. Initially, the n elements are emptyhandles.Methodspublic void add(IloInt more,const IloIntExpr x)This member function appends x to the invoking array multiple times. The argumentmore specifies how many times.public void add(const IloIntExpr x)This member function appends x to the invoking array.public void add(const IloIntExprArray array)This member function appends the elements in array to the invoking array.public void endElements()This member function calls IloExtractable::end for each of the elements in theinvoking array. This deletes all the extractables identified by the array, leaving thehandles in the array intact. This member function is the recommended way to delete theelements of an array.public IloIntExprArg operator[](IloIntExprArg anIntegerExpr) constThis subscripting operator returns an expression argument for use in a constraint orexpression. For clarity, let's call A the invoking array. When anIntegerExpr is<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 164


IloIntExprArraybound to the value i, the domain of the expression is the domain of A[i]. Moregenerally, the domain of the expression is the union of the domains of the expressionsA[i] where the i are in the domain of anIntegerExpr.This operator is also known as an element constraint.public IloIntExpr operator[](IloInt i) constThis operator returns a reference to the extractable object located in the invoking array atthe position specified by the index i. On const arrays, Concert Technology uses theconst operator:IloIntExpr operator[] (IloInt i) const;public IloIntExpr & operator[](IloInt i)This operator returns a reference to the extractable object located in the invoking array atthe position specified by the index i.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 165


IloIntSetIloIntSetCategoryClassInheritancePathDefinition Fileilconcert/iloset.hSummary An instance of this class offers a convenient way to represent a set of integer values.Constructor SummarypublicpublicpublicpublicIloIntSet(const IloEnv env,const IloIntArrayarray,IloBool withIndex=IloFalse)IloIntSet(const IloEnv env,const IloNumArrayarray,IloBool withIndex=IloFalse)IloIntSet(const IloEnv env,IloBoolwithIndex=IloFalse)IloIntSet(IloIntSetI * impl=0)Method Summarypublic voidpublic voidpublic IloBoolpublic IloBoolpublic voidpublic IloIntpublic IloIntSetI *public IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntadd(IloIntSet set)add(IloInt elt)contains(IloIntSet set) constcontains(IloInt elt) constempty()getFirst() constgetImpl() constgetLast() constgetNext(IloInt value,IloInt offset=1) constgetNextC(IloInt value,IloInt offset=1) constgetPrevious(IloInt value,IloInt offset=1)constgetPreviousC(IloInt value,IloInt offset=1)constgetSize() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 166


IloIntSetpublic IloBoolpublic voidpublic voidpublic voidpublic voidintersects(IloIntSet set) constremove(IloIntSet set)remove(IloInt elt)setIntersection(IloIntSet set)setIntersection(IloInt elt)Inner ClassIloIntSet::IloIntSet::IteratorThis class is an iterator that traverses theelements of a finite set of numeric values.DescriptionAn instance of this class offers a convenient way to represent a set of integer values as aconstrained variable in Concert Technology.An instance of this class represents a set of enumerated values. The same enumeratedvalue will not appear more than once in a set. The elements of a set are not ordered. Theclass IloIntSet::Iterator offers you a way to traverse the elements of such aset.If you are considering modeling issues where you want to represent repeated elementsor where you want to exploit an indexed order among the elements, then you might wantto look at the class IloAnyArray instead of this class for sets.See AlsoConstructorsIloCard, IloEqIntersection, IloEqUnion, IloExtractable, IloMember, IloModel,IloNotMember, IloNullIntersect, IloIntSetVarArray, IloSubset, IloSubsetEqpublic IloIntSet(const IloEnv env,const IloIntArray array,IloBool withIndex=IloFalse)This constructor creates a set of integer values in the environment env from theelements in array. The optional flag withIndex corresponds to the activation or notof internal Hash Tables to improve speed of add/getIndex methods.public IloIntSet(const IloEnv env,const IloNumArray array,IloBool withIndex=IloFalse)This constructor creates a set of numeric values in the environment env from theelements in array. The optional flag withIndex corresponds to the activation or notof internal Hash Tables to improve speed of add/getIndex methods.public IloIntSet(const IloEnv env,IloBool withIndex=IloFalse)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 167


IloIntSetThis constructor creates an empty set (no elements) in the environment env. You mustuse the member function IloIntSet::add to fill this set with elements. Theoptional flag withIndex corresponds to the activation or not of internal Hash Tablesto improve speed of add/getIndex methods.public IloIntSet(IloIntSetI * impl=0)This constructor creates a handle to a set of integer values from its implementationobject.Methodspublic void add(IloIntSet set)This member function adds set to the invoking set. Here, "adds" means that theinvoking set becomes the union of its former elements and the elements of set.To calculate the arithmetic sum of values in an array, use the function IloSum.public void add(IloInt elt)This member function adds elt to the invoking set. Here, "adds" means that theinvoking set becomes the union of its former elements and the new elt.public IloBool contains(IloIntSet set) constThis member function returns a Boolean value (zero or one) that specifies whether setcontains the invoking set. The value one specifies that the invoking set contains all theelements of set, and that the intersection of the invoking set with set is preciselyset. The value zero specifies that the intersection of the invoking set and set is notprecisely set.public IloBool contains(IloInt elt) constThis member function returns a Boolean value (zero or one) that specifies whether eltis an element of the invoking set. The value one specifies that the invoking set containselt; the value zero specifies that the invoking set does not contain elt.public void empty()This member function removes the elements from the invoking set. In other words, theinvoking set becomes the empty set.public IloInt getFirst() constReturns the first item of the collection.Returns : Returns the first item of the collection.public IloIntSetI * getImpl() constThis member function returns a pointer to the implementation object of the invoking set.public IloInt getLast() constReturns the last item of the collection.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 168


IloIntSetReturns : Returns the last item of the collection.public IloInt getNext(IloInt value,IloInt offset=1) constThis method returns the value next to the given argument in the set.If the given value does not exist, it throws an exceptionIf no value follows (that is, you are at the end of the set), it throws an exception.See also getNextC, getPreviousC for circular search.S = {1,2,3,4}S.next(2,1) will return 3Parameters :valueValue used as an index.offsetThe offset to apply for the computation. An offset of 0 returns the same object.S = {1,2,3,4}S.next(2,1) will return 3public IloInt getNextC(IloInt value,IloInt offset=1) constThis method returns the value next to the given argument in the set.If the given value does not exist, it throws an exception.If no value follows (that is, you are at the end of the set), it will give you the first value(circular search).See also getNext, getPrevious.See AlsoParameters :getNextvalueValue used as an index.offsetThe offset to apply for the computation. An offset of 0 returns the same object.public IloInt getPrevious(IloInt value,IloInt offset=1) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 169


IloIntSetThis method returns the value previous to the given argument in the set.If the given value does not exist, it throws an exceptionIf no value is previous (that is, you are at the beginning of the set), it throws anexception.See also getNextC, getPreviousC for circular search.See AlsoParameters :getNextvalueValue used as an index.offsetThe offset to apply for the computation. An offset of 0 returns the same object.public IloInt getPreviousC(IloInt value,IloInt offset=1) constThis method returns the value previous to the given argument in the set.If the given value does not exist, it throws an exception.If no value is previous (that is, you are at the beginning of the set), it will give you thelast value (circular search).See also getNext, getPrevious.See AlsoParameters :getNextvalueValue used as an index.offsetThe offset to apply for the computation. An offset of 0 returns the same object.public IloInt getSize() constThis member function returns an integer specifying the size of the invoking set (that is,how many elements it contains).public IloBool intersects(IloIntSet set) constThis member function returns a Boolean value (zero or one) that specifies whether setintersects the invoking set. The value one specifies that the intersection of set and theinvoking set is not empty (at least one element in common); the value zero specifiesthat the intersection of set and the invoking set is empty (no elements in common).public void remove(IloIntSet set)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 170


IloIntSetThis member function removes all the elements of set from the invoking set.public void remove(IloInt elt)This member function removes elt from the invoking set.public void setIntersection(IloIntSet set)This member function changes the invoking set so that it includes only the elements ofset. In other words, the invoking set becomes the intersection of its former elementswith the elements of set.public void setIntersection(IloInt elt)This member function changes the invoking set so that it includes only the elementspecified by elt. In other words, the invoking set becomes the intersection of itsformer elements with elt.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 171


IloIntSet::IteratorIloIntSet::IteratorCategoryInner ClassInheritancePathDefinition Fileilconcert/iloset.hSummary This class is an iterator that traverses the elements of a finite set of numeric values.Constructor SummarypublicIterator(const IloIntSet coll)Method Summarypublic IloBoolok() constpublic IloInt operator *()public voidoperator++()DescriptionSee AlsoConstructorsAn instance of the nested class IloIntSet::Iterator is an iterator that traversesthe elements of a finite set of numeric values (an instance of IloIntSet).IloIntSetpublic Iterator(const IloIntSet coll)Creates an iterator over the given set.Methodspublic IloBool ok() constThis member function returns IloTrue if there is a current element and the invokingiterator points to it. Otherwise, it returns IloFalse.To traverse the elements of a finite set of pointers, use the following code:for(IloIntSet::Iterator iter(set); iter.ok(); ++iter){IloInt val = *iter;// do something with val}<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 172


IloIntSet::Iteratorpublic IloInt operator *()This operator returns the current value.public void operator++()This operator advances the iterator to point to the next value in the dataset.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 173


IloIntSetVarIloIntSetVarCategoryClassInheritancePathDefinition Fileilconcert/iloset.hSummary The class IloIntSetVar represents a set of integer values.Constructor SummarypublicpublicpublicpublicpublicpublicpublicpublicpublicpublicIloIntSetVar()IloIntSetVar(IloIntSetVarI * impl)IloIntSetVar(const IloEnv env,constIloIntArray array,const char * name=0)IloIntSetVar(const IloEnv env,constIloIntArray possible,const IloIntArrayrequired,const char * name=0)IloIntSetVar(const IloEnv env,constIloNumArray array,const char * name=0)IloIntSetVar(const IloEnv env,constIloNumArray possible,const IloNumArrayrequired,const char * name=0)IloIntSetVar(const IloIntCollectionpossible,const char * name=0)IloIntSetVar(const IloIntCollectionpossible,const IloIntCollection required,constchar * name=0)IloIntSetVar(const IloNumCollectionpossible,const char * name=0)IloIntSetVar(const IloNumCollectionpossible,const IloNumCollection required,constchar * name=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 174


IloIntSetVarMethod Summarypublic voidpublic voidpublic IloIntSetVarI *public voidpublic IloIntSetpublic voidpublic IloIntSetpublic voidpublic voidaddPossible(IloInt elt) constaddRequired(IloInt elt) constgetImpl() constgetPossibleSet(IloIntSet set) constgetPossibleSet() constgetRequiredSet(IloIntSet set) constgetRequiredSet() constremovePossible(IloInt elt) constremoveRequired(IloInt elt) constInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionAn instance of this class represents a set of integer values. The same integer value willnot appear more than once in a set. The elements of a set are not ordered.A constrained variable representing a set of integer values (that is, an instance ofIloIntSetVar) is defined in terms of two other sets: its required elements and itspossible elements. Its required elements are those that must be in the set. Its possibleelements are those that may be in the set. This class offers member functions foraccessing the required and possible elements of a set of integer values.The function IloCard offers you a way to constrain the number of elements in a setvariable. That is, IloCard constrains the cardinality of a set variable.Constructorspublic IloIntSetVar()This constructor creates an empty handle. You must initialize it before you use it.public IloIntSetVar(IloIntSetVarI * impl)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 175


IloIntSetVarThis constructor creates a handle object from a pointer to an implementation object.public IloIntSetVar(const IloEnv env,const IloIntArray array,const char * name=0)This constructor creates a constrained set variable and makes it part of the environmentenv, where the set consists of integer values. By default, its name is the empty string,but you can specify a name of your choice.public IloIntSetVar(const IloEnv env,const IloIntArray possible,const IloIntArray required,const char * name=0)This constructor creates a constrained set variable and makes it part of the environmentenv, where the set consists of integer values. The array possible specifies the set ofpossible elements of the set variable; the array required specifies the set of requiredelements of the set variable. By default, its name is the empty string, but you canspecify a name of your choice.public IloIntSetVar(const IloEnv env,const IloNumArray array,const char * name=0)This constructor creates a constrained set variable and makes it part of the environmentenv, where the set consists of integer values. By default, its name is the empty string,but you can specify a name of your choice.public IloIntSetVar(const IloEnv env,const IloNumArray possible,const IloNumArray required,const char * name=0)This constructor creates a constrained set variable and makes it part of the environmentenv, where the set consists of integer values. The numeric array possible specifiesthe set of possible elements of the set variable; the numeric array required specifiesthe set of required elements of the set variable. By default, its name is the empty string,but you can specify a name of your choice.public IloIntSetVar(const IloIntCollection possible,const char * name=0)This constructor creates a constrained set variable and makes it part of the environmentenv, where the set consists of integer values.public IloIntSetVar(const IloIntCollection possible,const IloIntCollection required,const char * name=0)This constructor creates a constrained set variable and makes it part of the environmentenv, where the set consists of integer values.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 176


IloIntSetVarpublic IloIntSetVar(const IloNumCollection possible,const char * name=0)This constructor creates a constrained set variable and makes it part of the environmentenv, where the set consists of integer values.public IloIntSetVar(const IloNumCollection possible,const IloNumCollection required,const char * name=0)This constructor creates a constrained set variable and makes it part of the environmentenv, where the set consists of integer values.Methodspublic void addPossible(IloInt elt) constThis member function adds elt to the set of possible elements of the invoking setvariable.Note: The member function addPossible notifies Concert Technologyalgorithms about this change of this invoking object.public void addRequired(IloInt elt) constThis member function adds elt to the set of required elements of the invoking setvariable.Note: The member function addRequired notifies Concert Technologyalgorithms about this change of this invoking object.public IloIntSetVarI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public void getPossibleSet(IloIntSet set) constThis member function accesses the possible elements of the invoking set variable andputs those elements into its argument set.public IloIntSet getPossibleSet() constThis member function returns the possible elements of the invoking set variable.public void getRequiredSet(IloIntSet set) constThis member function accesses the possible elements of the invoking set variable andputs those elements into its argument set.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 177


IloIntSetVarpublic IloIntSet getRequiredSet() constThis member function returns the required elements of the invoking set variable.public void removePossible(IloInt elt) constThis member function removes elt as a possible element of the invoking set variable.Note: The member function removePossible notifies ConcertTechnology algorithms about this change of this invoking object.public void removeRequired(IloInt elt) constThis member function removes elt as a required element of the invoking set variable.Note: The member function removeRequired notifies ConcertTechnology algorithms about this change of this invoking object.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 178


IloIntSetVarArrayIloIntSetVarArrayCategoryClassInheritancePathDefinition Fileilconcert/iloset.hSummary The array class of the set variable class for integer values.Constructor SummarypublicpublicIloIntSetVarArray(IloDefaultArrayI * i=0)IloIntSetVarArray(const IloEnv env,IloIntn=0)Method Summarypublic void add(IloInt more,const IloIntSetVar x)public void add(const IloIntSetVar x)public voidadd(const IloIntSetVarArray array)public IloIntSetVaroperator[](IloInt i) constpublic IloIntSetVar & operator[](IloInt i)Inherited methods from IloExtractableArrayIloExtractableArray::add, IloExtractableArray::add,IloExtractableArray::add, IloExtractableArray::endElements,IloExtractableArray::setNames<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 179


IloIntSetVarArrayDescriptionConstructorsFor each basic type, Concert Technology defines a corresponding array class.IloIntSetVarArray is the array class of the set variable class for integer values(IloIntSetVar) in a model.Instances of IloIntSetVarArray are extensible. That is, you can add moreelements to such an array. <strong>Reference</strong>s to an array change whenever an element is addedor removed from the array.public IloIntSetVarArray(IloDefaultArrayI * i=0)This constructor creates an empty extensible array of set variables. You cannot createinstances of the undocumented class IloDefaultArrayI. As an argument in thisdefault constructor, it allows you to pass 0 (zero) as a value to an optional argument infunctions and member functions that accept an array as an argument.public IloIntSetVarArray(const IloEnv env,IloInt n=0)This constructor creates an extensible array of n set variables, where each set is a set ofinteger values.Methodspublic void add(IloInt more,const IloIntSetVar x)This member function appends x to the invoking array multiple times. The argumentmore specifies how many times.public void add(const IloIntSetVar x)This member function appends x to the invoking array.public void add(const IloIntSetVarArray array)This member function appends the elements in array to the invoking array.public IloIntSetVar operator[](IloInt i) constThis operator returns a reference to the object located in the invoking array at theposition specified by the index i. On const arrays, Concert Technology uses theconst operator:IloIntSetVar operator[] (IloInt i) const;public IloIntSetVar & operator[](IloInt i)This operator returns a reference to the object located in the invoking array at theposition specified by the index i.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 180


IloIntTupleSetIloIntTupleSetCategoryClassInheritancePathDefinition Fileilconcert/ilotupleset.hSummary Ordered set of values represented by an array.Constructor SummarypublicIloIntTupleSet(const IloEnv env,const IloIntarity)Method Summarypublic IloBoolpublic voidpublic IloIntpublic IloIntpublic IloIntTupleSetI *public IloBoolpublic IloBooladd(const IloIntArray tuple) constend()getArity() constgetCardinality() constgetImpl() constisIn(const IloIntArray tuple) constremove(const IloIntArray tuple) constDescriptionA tuple is an ordered set of values represented by an array. A set of enumerated tuples ina model is represented by an instance of IloIntTupleSet. That is, the elements of atuple set are tuples of enumerated values (such as pointers). The number of values in atuple is known as the arity of the tuple, and the arity of the tuples in a set is called thearity of the set. (In contrast, the number of tuples in the set is known as the cardinality ofthe set.)As a handle class, IloIntTupleSet manages certain set operations efficiently. Inparticular, elements can be added to such a set. It is also possible to search a given setwith the member function isIn to see whether or not the set contains a given element.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 181


IloIntTupleSetIn addition, a set of tuples can represent a constraint defined on a constrained variable,either as the set of allowed combinations of values of the constrained variable on whichthe constraint is defined, or as the set of forbidden combinations of values.There are a few conventions governing tuple sets:◆ When you create the set, you must specify the arity of the tuple-elements it contains.◆ You use the member function IloIntTupleSet::add to add tuples to the set.You can add tuples to the set in a model; you cannot add tuples to an instance of thisclass during a search, nor inside a constraint, nor inside a goal.Concert Technology will throw an exception if you attempt:◆ to add a tuple with a different number of variables from the arity of the set;◆ to search for a tuple with an arity different from the set arity.See AlsoConstructorsMethodsIloIntTupleSetIterator, IloExtractablepublic IloIntTupleSet(const IloEnv env,const IloInt arity)This constructor creates a set of tuples (an instance of the class IloIntTupleSet)with the arity specified by arity.public IloBool add(const IloIntArray tuple) constThis member function adds a tuple represented by the array tuple to the invoking set.If you attempt to add an element that is already in the set, that element will not be addedagain. Added elements are not copied; that is, there is no memory duplication. ConcertTechnology will throw an exception if the size of the array is not equal to the arity of theinvoking set. You may use this member function to add tuples to the invoking set in amodel; you may not add tuples in this way during a search, inside a constraint, or insidea goal. For those purposes, see IlcIntTupleSet, documented in the <strong>ILOG</strong> CPOptimizer <strong>Reference</strong> <strong>Manual</strong> and the <strong>ILOG</strong> Solver <strong>Reference</strong> <strong>Manual</strong>.public void end()This member function deletes the invoking set. That is, it frees all the resources used bythe invoking object. After a call to this member function, you cannot use the invokingextractable object again.public IloInt getArity() constThis member function returns the arity of the tupleset.public IloInt getCardinality() constThis member function returns the cardinality of the tupleset.public IloIntTupleSetI * getImpl() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 182


IloIntTupleSetThis member function returns a pointer to the implementation object of the invokingextractable object. This member function is useful when you need to be sure that youare using the same copy of the invoking extractable object in more than one situation.public IloBool isIn(const IloIntArray tuple) constThis member function returns IloTrue if tuple belongs to the invoking set.Otherwise, it returns IloFalse. Concert Technology will throw an exception if thesize of the array is not equal to the arity of the invoking set.public IloBool remove(const IloIntArray tuple) constThis member function removes tuple from the invoking set in a model. You may usethis member function to remove tuples from the invoking set in a model; you may notremove tuples in this way during a search, inside a constraint, or inside a goal.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 183


IloIntTupleSetIteratorIloIntTupleSetIteratorCategoryClassInheritancePathDefinition Fileilconcert/ilotupleset.hSummary Class of iterators to traverse enumerated values of a tuple-set.Constructor SummarypublicIloIntTupleSetIterator(const IloEnvenv,IloIntTupleSet tset)Method Summarypublic IloIntArrayoperator *() constDescriptionConstructorsMethodsAn instance of the class IloIntTupleSetIterator is an iterator that traverses theelements of a finite set of tuples of enumerated values (instance ofIloIntTupleSet).See Also the classes IlcIntTupleSet in the <strong>ILOG</strong> CP Optimizer <strong>Reference</strong> <strong>Manual</strong>and the <strong>ILOG</strong> Solver <strong>Reference</strong> <strong>Manual</strong>.public IloIntTupleSetIterator(const IloEnv env,IloIntTupleSet tset)This constructor creates an iterator associated with tSet to traverse its elements.public IloIntArray operator *() constThis operator returns the current element, the one to which the invoking iterator points.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 184


IloIntVarIloIntVarCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary An instance of this class represents a constrained integer variable in a ConcertTechnology model.Constructor SummarypublicpublicpublicpublicpublicpublicpublicIloIntVar()IloIntVar(IloNumVarI * impl)IloIntVar(IloEnv env,IloInt vmin=0,IloIntvmax=IloIntMax,const char * name=0)IloIntVar(const IloAddNumVar & var,IloIntlowerBound=0,IloInt upperBound=IloIntMax,constchar * name=0)IloIntVar(const IloEnv env,const IloIntArrayvalues,const char * name=0)IloIntVar(const IloAddNumVar & var,constIloIntArray values,const char * name=0)IloIntVar(const IloNumVar var)public IloIntVar(const IloIntRange coll,const char *name=0)Method Summary<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 185


IloIntVarpublic IloNumVarI *public IloNumpublic IloIntpublic IloIntpublic IloNumpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidIloIntVar::getImpl() constIloIntVar::getLB() constIloIntVar::getMax() constIloIntVar::getMin() constIloIntVar::getUB() constIloIntVar::setBounds(IloInt lb,IloInt ub)constIloIntVar::setLB(IloNum min) constIloIntVar::setMax(IloInt max) constIloIntVar::setMin(IloInt min) constIloIntVar::setPossibleValues(constIloIntArray values) constIloIntVar::setUB(IloNum max) constInherited methods from IloIntExprArgIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionAn instance of this class represents a constrained integer variable in a ConcertTechnology model. If you are looking for a class of numeric variables that may assumeinteger values and may be relaxed to assume floating-point values, then consider the<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 186


IloIntVarclass IloNumVar. If you are looking for a class of binary decision variables (that is,variables that assume only the values 0 (zero) or 1 (one), then consider the classIloBoolVar.Bounds of an Integer VariableThe lower and upper bound of an instance of this class is an integer.What Is ExtractedAn instance of IloIntVar is extracted by IloCP or IloSolver as an instance ofIlcIntVar.An instance of IloIntVar is extracted by IloCplex as a column representing anumeric variable of type Int with bounds as specified by IloIntVar.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.Note:When numeric bounds are given to an integer variable (an instance ofIloIntVar or IloNumVar with Type = Int) in the constructors or via amodifier (such as setUB, setLB, setBounds), they are inwardly roundedto an integer value. LB is rounded down and UB is rounded up.See AlsoConstructorsIloBoolVar, IloNumVarpublic IloIntVar()This constructor creates an empty handle. You must initialize it before you use it.public IloIntVar(IloNumVarI * impl)This constructor creates a handle object from a pointer to an implementation object.public IloIntVar(IloEnv env,IloInt vmin=0,IloInt vmax=IloIntMax,const char * name=0)This constructor creates an instance of IloIntVar like this:IloNumVar(env, vmin, vmax, ILOINT, name);public IloIntVar(const IloAddNumVar & var,IloInt lowerBound=0,IloInt upperBound=IloIntMax,const char * name=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 187


IloIntVarThis constructor creates an instance of IloIntVar like this:IloNumVar(column, lowerBound, upperBound, ILOINT, name);public IloIntVar(const IloEnv env,const IloIntArray values,const char * name=0)This constructor calls upon its corresponding IloNumVar constructor.public IloIntVar(const IloAddNumVar & var,const IloIntArray values,const char * name=0)This constructor calls upon its corresponding IloNumVar constructor.public IloIntVar(const IloNumVar var)This constructor creates a new handle on var if it is of type ILOINT. Otherwise, anexception is thrown.public IloIntVar(const IloIntRange coll,const char * name=0)This constructor creates an instance of IloIntVar from the given collection*Methodspublic IloNumVarI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public IloNum getLB() constThis member function returns the lower bound of the invoking variable.public IloInt getMax() constThis member function returns the maximal value of the invoking variable.public IloInt getMin() constThis member function returns the minimal value of the invoking variable.public IloNum getUB() constThis member function returns the upper bound of the invoking variable.public void setBounds(IloInt lb,IloInt ub) constThis member function sets lb as the lower bound and ub as the upper bound of theinvoking numeric variable.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 188


IloIntVarNote:The member function setBounds notifies Concert Technologyalgorithms about the change of bounds in this numeric variable.public void setLB(IloNum min) constThis member function sets min as the lower bound of the invoking variable.Note:The member function setLB notifies Concert Technology algorithmsabout the change of bounds in this numeric variable.public void setMax(IloInt max) constThis member function returns the minimal value of the invoking variable to max.Note:The member function setMax notifies Concert Technologyalgorithms about the change of bounds in this numeric variable.public void setMin(IloInt min) constThis member function returns the minimal value of the invoking variable to min.Note:The member function setMin notifies Concert Technologyalgorithms about the change of bounds in this numeric variable.public void setPossibleValues(const IloIntArray values) constThis member function sets values as the domain of the invoking integer variable.Note:The member function setPossibleValues notifies ConcertTechnology algorithms about the change of bounds in this numeric variable.public void setUB(IloNum max) constThis member function sets max as the upper bound of the invoking variable.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 189


IloIntVarNote:The member function setUB notifies Concert Technology algorithmsabout the change of bounds in this numeric variable.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 190


IloIntVarArrayIloIntVarArrayCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary The array class of IloIntVar.Constructor SummarypublicpublicpublicpublicpublicpublicpublicpublicIloIntVarArray(IloDefaultArrayI * i=0)IloIntVarArray(const IloEnv env,IloInt n=0)IloIntVarArray(const IloEnv env,constIloIntArray lb,const IloIntArray ub)IloIntVarArray(const IloEnv env,IloIntlb,const IloIntArray ub)IloIntVarArray(const IloEnv env,constIloIntArray lb,IloInt ub)IloIntVarArray(const IloEnv env,IloIntn,IloInt lb,IloInt ub)IloIntVarArray(const IloEnv env,constIloNumColumnArray columnarray)IloIntVarArray(const IloEnv env,constIloNumColumnArray columnarray,constIloNumArray lb,const IloNumArray ub)Method Summarypublic voidIloIntVarArray::add(IloInt more,constIloIntVar x)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 191


IloIntVarArraypublic void IloIntVarArray::add(const IloIntVar x)public void IloIntVarArray::add(const IloIntVarArray x)public voidpublic IloIntVarIloIntVarArray::endElements()IloIntVarArray::operator[](IloInt i) constpublic IloIntVar & IloIntVarArray::operator[](IloInt i)public IloIntExprArgpublic IloNumVarArrayIloIntVarArray::operator[](IloIntExprArganIntegerExpr) constIloIntVarArray::toNumVarArray() constInherited methods from IloIntExprArrayIloIntExprArray::add, IloIntExprArray::add, IloIntExprArray::add,IloIntExprArray::endElements, IloIntExprArray::operator[],IloIntExprArray::operator[], IloIntExprArray::operator[]Inherited methods from IloExtractableArrayIloExtractableArray::add, IloExtractableArray::add,IloExtractableArray::add, IloExtractableArray::endElements,IloExtractableArray::setNamesDescriptionFor each basic type, Concert Technology defines a corresponding array class.IloIntVarArray is the array class of the integer variable class for a model. It is ahandle class.Instances of IloIntVarArray are extensible.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.See AlsoConstructorsIloIntVarpublic IloIntVarArray(IloDefaultArrayI * i=0)This constructor creates an empty extensible array of integer variables.public IloIntVarArray(const IloEnv env,IloInt n=0)This constructor creates an extensible array of n integer variables.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 192


IloIntVarArraypublic IloIntVarArray(const IloEnv env,const IloIntArray lb,const IloIntArray ub)This constructor creates an extensible array of integer variables with lower and upperbounds as specified.public IloIntVarArray(const IloEnv env,IloInt lb,const IloIntArray ub)This constructor creates an extensible array of integer variables with a lower bound andan array of upper bounds as specified.public IloIntVarArray(const IloEnv env,const IloIntArray lb,IloInt ub)This constructor creates an extensible array of integer variables with an array of lowerbounds and an upper bound as specified.public IloIntVarArray(const IloEnv env,IloInt n,IloInt lb,IloInt ub)This constructor creates an extensible array of n integer variables, with a lower and anupper bound as specified.public IloIntVarArray(const IloEnv env,const IloNumColumnArray columnarray)This constructor creates an extensible array of integer variables from a column array.public IloIntVarArray(const IloEnv env,const IloNumColumnArray columnarray,const IloNumArray lb,const IloNumArray ub)This constructor creates an extensible array of integer variables with lower and upperbounds as specified from a column array.Methodspublic void add(IloInt more,const IloIntVar x)This member function appends x to the invoking array of integer variables; it appends xmore times.public void add(const IloIntVar x)This member function appends the value x to the invoking array.public void add(const IloIntVarArray x)This member function appends the variables in the array x to the invoking array.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 193


IloIntVarArraypublic void endElements()This member function calls IloExtractable::end for each of the elements in theinvoking array. This deletes all the extractables identified by the array, leaving thehandles in the array intact. This member function is the recommended way to delete theelements of an array.public IloIntVar operator[](IloInt i) constThis operator returns a reference to the object located in the invoking array at theposition specified by the index i. On const arrays, Concert Technology uses theconst operatorIloIntVar operator[] (IloInt i) const;public IloIntVar & operator[](IloInt i)This operator returns a reference to the extractable object located in the invoking array atthe position specified by the index i.public IloIntExprArg operator[](IloIntExprArg anIntegerExpr) constThis subscripting operator returns an expression argument for use in a constraint orexpression. For clarity, let's call A the invoking array. When anIntegerExpr isbound to the value i, the domain of the expression is the domain of A[i]. Moregenerally, the domain of the expression is the union of the domains of the expressionsA[i] where the i are in the domain of anIntegerExpr.This operator is also known as an element constraint.public IloNumVarArray toNumVarArray() constThis member function copies the invoking array into a new IloNumVarArray.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 194


IloIsNANIloIsNANCategoryDefinition FileSynopsisGlobal Functionilconcert/ilosys.hpublic int IloIsNAN(double)Summary Tests whether a double value is a NaN.DescriptionThis function tests whether a double value is a NaN (Not a number).<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 195


IloIteratorIloIteratorCategoryClassInheritancePathDefinition Fileilconcert/iloiterator.hSummary A template to create iterators for a class of extractable objects.Constructor SummarypublicIloIterator(const IloEnv env,IloBoolwithSubClasses=IloTrue)Method Summarypublic IloBoolpublic voidok()operator++()DescriptionThis template creates iterators for a given class of extractable objects (denoted by E inthe template) within an instance of IloEnv.By default, an iterator created in this way will traverse instances of E and of itssubclasses. You can prevent the iterator from traversing instances of subclasses of E(that is, you can limit its effect) by setting the argument withSubClasses toIloFalse in the constructor of the iterator.While an iterator created in this way is working, you must not create nor destroy anyextractable objects in the instance of IloEnv where it is working. In other words, aniterator created in this way works only in a stable environment.An iterator created with this template differs from an instance ofIloModel::Iterator. An instance of IloModel::Iterator works only onextractable objects (instances of IloExtractable or its subclasses) that haveexplicitly been added to a model (an instance of IloModel). In contrast, an iteratorcreated with this template will work on all extractable objects within a givenenvironment, whether or not they have been explicitly added to a model.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 196


IloIteratorSee AlsoConstructorsIloEnv, IloExtractable, IloModel, IloModel::Iteratorpublic IloIterator(const IloEnv env,IloBool withSubClasses=IloTrue)This template constructor creates an iterator for instances of the class E. When theargument withSubClasses is IloTrue (its default value), the iterator will alsowork on instances of the subclasses of E. When withSubClasses is IloFalse,the iterator works only on instances of E.ExampleHere is an example of an iterator created by this template for the class IloNumVar.typedef IloIterator IloNumVarIterator;void displayAllVars(IloEnv env) {for (IloNumVarIterator it(env); it.ok(); ++it) {IloNumVar ext = *it;cout


IloLexicographicIloLexicographicCategoryDefinition FileSynopsisDescriptionGlobal Functionilconcert/ilomodel.hpublic IloConstraint IloLexicographic(IloEnv env,IloIntExprArray x,IloIntExprArray y,const char *=0)The IloLexicographic function returns a constraint which maintains two arrays tobe lexicographically ordered.More specifically, IloLexicographic(x, y) maintains that x is less than or equalto y in the lexicographical sense of the term. This means that either both arrays areequal or that there exists i < size(x) such that for all j < i, x[j] = y[j] andx[i] < y[i].Note that the size of the two arrays must be the same.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 198


IloLogIloLogCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloNumExprArg IloLog(const IloNumExprArg arg)public IloNum IloLog(IloNum val)Summary Returns the natural logarithm of its argument.DescriptionConcert Technology offers predefined functions that return an expression from analgebraic function on expressions. These predefined functions also return a numericvalue from an algebraic function on numeric values as well.IloLog returns the natural logarithm of its argument. In order to conform to IEEE 754standards for floating-point arithmetic, you should use this function in your ConcertTechnology applications, rather than the standard <strong>C++</strong> log.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 199


IloMaxIloMaxCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloNum IloMax(const IloNumArray vals)public IloNum IloMax(IloNum val1,IloNum val2)public IloInt IloMax(const IloIntArray vals)public IloNumExprArg IloMax(const IloNumExprArray exprs)public IloIntExprArg IloMax(const IloIntExprArray exprs)public IloNumExprArg IloMax(const IloNumExprArg x,const IloNumExprArg y)public IloNumExprArg IloMax(const IloNumExprArg x,IloNum y)public IloNumExprArg IloMax(IloNum x,const IloNumExprArg y)public IloIntExprArg IloMax(const IloIntExprArg x,const IloIntExprArg y)public IloIntExprArg IloMax(const IloIntExprArg x,IloInt y)public IloNumExprArg IloMax(const IloIntExprArg x,IloNum y)public IloIntExprArg IloMax(const IloIntExprArg x,int y)public IloIntExprArg IloMax(IloInt x,const IloIntExprArg y)public IloNumExprArg IloMax(IloNum x,const IloIntExprArg y)public IloIntExprArg IloMax(int x,const IloIntExprArg y)Summary Returns a numeric value representing the max of numeric values.DescriptionThese functions compare their arguments and return the greatest value.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 200


IloMaximizeIloMaximizeCategoryDefinition FileSynopsisGlobal Functionilconcert/ilolinear.hpublic IloObjective IloMaximize(const IloEnv env,IloNum constant=0.0,const char * name=0)public IloObjective IloMaximize(const IloEnv env,const IloNumExprArg expr,const char * name=0)Summary This function defines a maximization objective in a model.DescriptionThis function defines a maximization objective in a model. In other words, it simplyoffers a convenient way to create an instance of IloObjective with its sense definedas Maximize. However, an instance of IloObjective created by IloMaximizemay not necessarily maintain its sense throughout the lifetime of the instance. Theoptional argument name is set to 0 by default.You may define more than one objective in a model. However, algorithmsconventionally take into account only one objective at a time.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 201


IloMinIloMinCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloNum IloMin(const IloNumArray vals)public IloNum IloMin(IloNum val1,IloNum val2)public IloInt IloMin(const IloIntArray vals)public IloNumExprArg IloMin(const IloNumExprArray exprs)public IloIntExprArg IloMin(const IloIntExprArray exprs)public IloNumExprArg IloMin(const IloNumExprArg x,const IloNumExprArg y)public IloNumExprArg IloMin(const IloNumExprArg x,IloNum y)public IloNumExprArg IloMin(IloNum x,const IloNumExprArg y)public IloIntExprArg IloMin(const IloIntExprArg x,const IloIntExprArg y)public IloIntExprArg IloMin(const IloIntExprArg x,IloInt y)public IloNumExprArg IloMin(const IloIntExprArg x,IloNum y)public IloIntExprArg IloMin(const IloIntExprArg x,int y)public IloIntExprArg IloMin(IloInt x,const IloIntExprArg y)public IloNumExprArg IloMin(IloNum x,const IloIntExprArg y)public IloIntExprArg IloMin(int x,const IloIntExprArg y)Summary Returns a numeric value representing the min of numeric values.DescriptionThese functions compare their arguments and return the least value. When its argumentis an array, the function compares the elements of that array and returns the least value.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 202


IloMinimizeIloMinimizeCategoryDefinition FileSynopsisGlobal Functionilconcert/ilolinear.hpublic IloObjective IloMinimize(const IloEnv env,IloNum constant=0.0,const char * name=0)public IloObjective IloMinimize(const IloEnv env,const IloNumExprArg expr,const char * name=0)Summary This function defines a minimization objective in a model.DescriptionThis function defines a minimization objective in a model. In other words, it simplyoffers a convenient way to create an instance of IloObjective with its sense definedas Minimize. However, an instance of IloObjective created by IloMinimizemay not necessarily maintain its sense throughout the lifetime of the instance. Theoptional argument name is set to 0 by default.You may define more than one objective in a model. However, algorithmsconventionally take into account only one objective at a time.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 203


IloModelIloModelCategoryClassInheritancePathDefinition Fileilconcert/ilomodel.hSummary Class for models.Constructor SummarypublicpublicpublicIloModel()IloModel(IloModelI * impl)IloModel(const IloEnv env,const char * name=0)Method Summarypublic constIloExtractableArray &public IloExtractablepublic IloModelI *public voidpublic voidIloModel::add(const IloExtractableArray & x)constadd(const IloExtractable x) constgetImpl() constremove(const IloExtractableArray x) constremove(const IloExtractable x) constInherited methods from IloExtractable<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 204


IloModelIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectInner ClassIloModel::IloModel::Iterator Nested class of iterators to traverse theextractable objects in a model.DescriptionAn instance of this class represents a model. A model consists of the extractable objectssuch as constraints, constrained variables, objectives, and possibly other modelingobjects, that represent a problem. Concert Technology extracts information from amodel and passes the information in an appropriate form to algorithms that solve theproblem. (For information about extracting objects into algorithms, see the memberfunction extract and the template IloAdd.)Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.Models and SubmodelsWith Concert Technology, you may create more than one model in a given environment(an instance of IloEnv). In fact, you can create submodels. That is, you can add onemodel to another model within the same environment.What Is Extracted from a ModelAll the extractable objects (that is, instances of IloExtractable or one of itssubclasses) that have been added to a model (an instance of IloModel) and that havenot been removed from it will be extracted when an algorithm extracts the model. Aninstance of the nested class IloModel::Iterator accesses those extractableobjects.See AlsoConstructorsIloEnv, IloExtractable, IloModel::Iteratorpublic IloModel()<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 205


IloModelThis constructor creates an empty handle. You must initialize it before you use it.public IloModel(IloModelI * impl)This constructor creates a handle object from a pointer to an implementation object.public IloModel(const IloEnv env,const char * name=0)This constructor creates a model. By default, the name of the model is the empty string,but you can attribute a name to the model at its creation.Methodspublic const IloExtractableArray & add(const IloExtractableArray & x) constThis member function adds the array of extractable objects to the invoking model.Note: The member function add notifies Concert Technology algorithmsabout this addition to the model.public IloExtractable add(const IloExtractable x) constThis member function adds the extractable object to the invoking model.Note: The member function add notifies Concert Technology algorithmsabout this addition to the model.public IloModelI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public void remove(const IloExtractableArray x) constThis member function removes the array of extractable objects from the invoking model.Note: The member function remove notifies Concert Technologyalgorithms about this removal from the model.public void remove(const IloExtractable x) constThis member function removes the extractable object from the invoking model.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 206


IloModelNote: The member function remove notifies Concert Technologyalgorithms about this removal from the model.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 207


IloModel::IteratorIloModel::IteratorCategoryInner ClassInheritancePathDefinition Fileilconcert/ilomodel.hSummary Nested class of iterators to traverse the extractable objects in a model.Constructor SummarypublicIterator(const IloModel model)Method Summarypublic IloBoolok() constpublic IloExtractable operator *()public voidoperator++()DescriptionAn instance of this nested class is an iterator capable of traversing the extractable objectsin a model.An iterator of this class differs from one created by the template IloIterator.Instances of IloIterator traverse all the extractable objects of a given class(specified by E in the template) within a given environment (an instance of IloEnv),whether or not those extractable objects have been explicitly added to a model. Instancesof IloModel::Iterator traverse only those extractable objects that haveexplicitly been added to a given model (an instance of IloModel).See AlsoConstructorsIloIterator, IloModelpublic Iterator(const IloModel model)This constructor creates an iterator to traverse the extractable objects in the modelspecified by model.Methodspublic IloBool ok() constThis member function returns IloTrue if there is a current element and the iteratorpoints to it. Otherwise, it returns IloFalse.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 208


IloModel::Iteratorpublic IloExtractable operator *()This operator returns the current extractable object, the one to which the invokingiterator points.public void operator++()This operator advances the iterator to point to the next extractable object in the model.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 209


IloMutexDeadlockIloMutexDeadlockCategoryClassInheritancePathDefinition Fileilconcert/ilothread.hSummary The class of exceptions thrown due to mutex deadlock.DescriptionThis is the class of exceptions thrown if two or more threads become deadlocked waitingfor a mutex owned by the other(s).<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 210


IloMutexNotOwnerIloMutexNotOwnerCategoryClassInheritancePathDefinition Fileilconcert/ilothread.hSummary The class of exceptions thrown.DescriptionThe class of exceptions thrown if a thread attempts to unlock a mutex that it does notown.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 211


IloMutexProblemIloMutexProblemCategoryClassInheritancePathDefinition Fileilconcert/ilothread.hSummary Exception.Constructor SummarypublicIloMutexProblem(const char * msg)DescriptionThe class IloMutexProblem is part of the hierarchy of classes representingexceptions in Concert Technology. Concert Technology uses instances of this classwhen an error occurs with respect to a mutex, an instance of IloFastMutex.An exception is thrown; it is not allocated in a Concert Technology environment; it isnot allocated on the <strong>C++</strong> heap. It is not necessary for you as a programmer to delete anexception explicitly. Instead, the system calls the constructor of the exception to createit, and the system calls the destructor of the exception to delete it.When exceptions are enabled on a platform that supports <strong>C++</strong> exceptions, an instance ofIloMutexProblem makes it possible for Concert Technology to throw an exceptionin case of error. On platforms that do not support <strong>C++</strong> exceptions, an instance of thisclass makes it possible for Concert Technology to exit in case of error.Throwing and Catching ExceptionsExceptions are thrown by value. They are not allocated on the <strong>C++</strong> heap, nor in aConcert Technology environment. The correct way to catch an exception is to catch areference to the error (specified by the ampersand &), like this:catch(IloMutexProblem& error);<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 212


IloMutexProblemSee AlsoConstructorsIloException, IloFastMutexpublic IloMutexProblem(const char * msg)This constructor creates an instance of IloMutexProblem to represent an exception incase of an error involving a mutex. This instance is not allocated on <strong>C++</strong> heap; it is notallocated in a Concert Technology environment either.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 213


IloNotIloNotCategoryClassInheritancePathDefinition Fileilconcert/ilomodel.hSummary Negation of its argument.Constructor SummarypublicpublicIloNot()IloNot(IloNotI * impl)Method Summarypublic IloNotI *getImpl() constInherited methods from IloConstraintIloConstraint::getImplInherited methods from IloIntExprArg<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 214


IloNotIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionSee AlsoConstructorsThe class IloNot represents a constraint that is the negation of its argument. In orderto be taken into account, this constraint must be added to a model and extracted by analgorithm, such as IloCplex or IloSolver.operator!public IloNot()This constructor creates an empty handle. You must initialize it before you use it.public IloNot(IloNotI * impl)This constructor creates a handle object from a pointer to an implementation object.Methodspublic IloNotI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 215


IloNumIloNumCategoryDefinition FileSynopsisType Definitionilconcert/ilosys.hdouble IloNumSummary Type for numeric values as floating-point numbers.DescriptionSee AlsoThis type definition represents numeric values as floating-point numbers in ConcertTechnology.IloModel, IloInt<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 216


IloNumArrayIloNumArrayCategoryClassInheritancePathDefinition FileSummaryilconcert/iloenv.hIloNumArray is the array class of the basic floating-point class.Constructor SummarypublicpublicpublicpublicIloNumArray(IloArrayI * i=0)IloNumArray(const IloNumArray & cpy)IloNumArray(const IloEnv env,IloInt n=0)IloNumArray(const IloEnv env,IloInt n,IloNumf0,IloNum f1,...)Method Summarypublic IloBoolcontains(IloNum value) constpublic IloNum & operator[](IloInt i)public const IloNum &operator[](IloInt i) constpublic IloNumExprArgoperator[](IloIntExprArg intExp) constpublic IloIntArraytoIntArray() constDescriptionFor each basic type, Concert Technology defines a corresponding array class.IloNumArray is the array class of the basic floating-point class (IloNum) for amodel.Instances of IloNumArray are extensible. That is, you can add more elements to suchan array. <strong>Reference</strong>s to an array change whenever an element is added to or removedfrom the array.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 217


IloNumArrayIloNumArray inherits additional methods from the template IloArray:◆ add◆ add◆ add◆ clear◆ getEnv◆ getSize◆ remove◆ operator[]◆ operator[]See AlsoConstructorsIloNum, operator>>, operatorpublic IloNumArray(IloArrayI * i=0)This constructor creates an empty array of floating-point numbers for use in a model.You cannot create instances of the undocumented class IloDefaultArrayI. As anargument in this default constructor, it allows you to pass 0 (zero) as a value to anoptional argument in functions and member functions that accept an array as anargument.public IloNumArray(const IloNumArray & cpy)This copy constructor creates a handle to the array of floating-point objects specified bycpy.public IloNumArray(const IloEnv env,IloInt n=0)This constructor creates an array of n elements. Initially, the n elements are emptyhandles.public IloNumArray(const IloEnv env,IloInt n,IloNum f0,IloNum f1,...)This constructor creates an array of n floating-point objects for use in a model.Methodspublic IloBool contains(IloNum value) constThis member function checks whether the value is contained or not.public IloNum & operator[](IloInt i)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 218


IloNumArrayThis operator returns a reference to the object located in the invoking array at theposition specified by the index i.public const IloNum & operator[](IloInt i) constThis operator returns a reference to the object located in the invoking array at theposition specified by the index i. On const arrays, Concert Technology uses theconst operator:IloArray operator[] (IloInt i) const;public IloNumExprArg operator[](IloIntExprArg intExp) constThis subscripting operator returns an expression node for use in a constraint orexpression. For clarity, let's call A the invoking array. When intExp is bound to thevalue i, then the domain of the expression is the domain of A[i]. More generally, thedomain of the expression is the union of the domains of the expressions A[i] where thei are in the domain of intExp.This operator is also known as an element constraint.public IloIntArray toIntArray() constThis member function copies the invoking numeric array to a new instance ofIloIntArray, checking the type of the values during the copy.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 219


IloNumExprIloNumExprCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary The class of numeric expressions in a Concert model.Constructor SummarypublicpublicpublicpublicpublicpublicpublicIloNumExpr()IloNumExpr(IloNumExprI * impl)IloNumExpr(const IloNumExprArg expr)IloNumExpr(const IloEnv env,IloNum=0)IloNumExpr(const IloNumLinExprTerm term)IloNumExpr(const IloIntLinExprTerm term)IloNumExpr(const IloExpr & expr)Method Summarypublic IloNumExprI *public IloNumExpr &public IloNumExpr &public IloNumExpr &public IloNumExpr &public IloNumExpr &public IloNumExpr &IloNumExpr::getImpl() constIloNumExpr::operator *=(IloNum val)IloNumExpr::operator+=(const IloNumExprArgexpr)IloNumExpr::operator+=(IloNum val)IloNumExpr::operator-=(const IloNumExprArgexpr)IloNumExpr::operator-=(IloNum val)IloNumExpr::operator/=(IloNum val)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 220


IloNumExprInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectInner ClassIloNumExpr::IloNumExpr::NonLinearExpressionThe class of exceptions thrown if a numericconstant of a nonlinear expression is set orqueried.DescriptionConstructorsNumeric expressions in Concert Technology are represented using the classIloNumExpr.public IloNumExpr()This constructor creates an empty handle. You must initialize it before you use it.public IloNumExpr(IloNumExprI * impl)This constructor creates a handle object from a pointer to an implementation object.public IloNumExpr(const IloNumExprArg expr)This constructor creates a numeric expression using the undocumented classIloNumExprArg.public IloNumExpr(const IloEnv env,IloNum=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 221


IloNumExprThis constructor creates a constant numeric expression with the value n that the user canmodify subsequently with the operators +=, -=, ?= in the environment specified byenv. It may be used to build other expressions from variables belonging to env.public IloNumExpr(const IloNumLinExprTerm term)This constructor creates a numeric expression using the undocumented classIloNumLinExprTerm.public IloNumExpr(const IloIntLinExprTerm term)This constructor creates a numeric expression using the undocumented classIloIntLinExprTerm.public IloNumExpr(const IloExpr & expr)This is the copy constructor for this class.Methodspublic IloNumExprI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public IloNumExpr & operator *=(IloNum val)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x * ...public IloNumExpr & operator+=(const IloNumExprArg expr)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x + ...public IloNumExpr & operator+=(IloNum val)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x + ...public IloNumExpr & operator-=(const IloNumExprArg expr)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x - ...public IloNumExpr & operator-=(IloNum val)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x - ...public IloNumExpr & operator/=(IloNum val)This operator is recommended for building a Concert Technology expression in a loop.It is more efficient than x = x / ...<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 222


IloNumExprArgIloNumExprArgCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary A class used internally in Concert Technology.Constructor SummarypublicpublicIloNumExprArg()IloNumExprArg(IloNumExprI * impl)Method Summarypublic IloNumExprI *IloNumExprArg::getImpl() constInherited methods from IloExtractable<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 223


IloNumExprArgIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionConstructorsMethodsConcert Technology uses instances of this class internally as temporary objects when itis parsing a <strong>C++</strong> expression in order to build an instance of IloNumExpr. As a ConcertTechnology user, you will not need this class yourself; in fact, you should not use themdirectly. They are documented here because the return value of certain functions, such asIloSum or IloScalProd, can be an instance of this class.public IloNumExprArg()This constructor creates an empty handle. You must initialize it before you use it.public IloNumExprArg(IloNumExprI * impl)This constructor creates a handle object from a pointer to an implementation object.public IloNumExprI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 224


IloNumExprArrayIloNumExprArrayCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary The class IloNumExprArray.Constructor SummarypublicpublicIloNumExprArray(IloDefaultArrayI * i=0)IloNumExprArray(const IloEnv env,IloInt n=0)Method Summarypublic voidIloNumExprArray::add(IloInt more,constIloNumExpr x)public void IloNumExprArray::add(const IloNumExpr x)public voidpublic voidpublic IloNumExprArgIloNumExprArray::add(const IloNumExprArrayarray)IloNumExprArray::endElements()IloNumExprArray::operator[](IloIntExprArganIntegerExpr) constInherited methods from IloExtractableArray<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 225


IloNumExprArrayIloExtractableArray::add, IloExtractableArray::add,IloExtractableArray::add, IloExtractableArray::endElements,IloExtractableArray::setNamesDescriptionConstructorsFor each basic type, Concert Technology defines a corresponding array class.IloNumExprArray is the array class of the numeric expressions class(IloNumExpr) for a model.Instances of IloNumExprArray are extensible. That is, you can add more elementsto such an array. <strong>Reference</strong>s to an array change whenever an element is added to orremoved from the array.public IloNumExprArray(IloDefaultArrayI * i=0)This constructor creates an empty array of numeric expressions for use in a model. Youcannot create instances of the undocumented class IloDefaultArrayI. As anargument in this default constructor, it allows you to pass 0 (zero) as a value to anoptional argument in functions and member functions that accept an array as anargument.public IloNumExprArray(const IloEnv env,IloInt n=0)This constructor creates an array of n elements. Initially, the n elements are emptyhandles.Methodspublic void add(IloInt more,const IloNumExpr x)This member function appends x to the invoking array. The argument more specifieshow many times.public void add(const IloNumExpr x)This member function appends x to the invoking array.public void add(const IloNumExprArray array)This member function appends the elements in array to the invoking array.public void endElements()This member function calls IloExtractable::end for each of the elements in theinvoking array. This deletes all the extractables identified by the array, leaving thehandles in the array intact. This member function is the recommended way to delete theelements of an array.public IloNumExprArg operator[](IloIntExprArg anIntegerExpr) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 226


IloNumExprArrayThis subscripting operator returns an expression argument for use in a constraint orexpression. For clarity, let's call A the invoking array. When anIntegerExpr isbound to the value i, the domain of the expression is the domain of A[i]. Moregenerally, the domain of the expression is the union of the domains of the expressionsA[i] where the i are in the domain of anIntegerExpr.This operator is also known as an element constraint.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 227


IloNumExpr::NonLinearExpressionIloNumExpr::NonLinearExpressionCategoryInner ClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary The class of exceptions thrown if a numeric constant of a nonlinear expression is set orqueried.Method Summarypublic const IloNumExprArggetExpression() constInherited methods from IloExceptionIloException::end, IloException::getMessageDescriptionMethods public const IloNumExprArg getExpression() constThe member function getExprUsed returns the expression involved in the exception.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 228


IloNumVarIloNumVarCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary An instance of this class represents a numeric variable in a model.Constructor SummarypublicpublicpublicpublicpublicpublicpublicIloNumVar()IloNumVar(IloNumVarI * impl)IloNumVar(const IloEnv env,IloNum lb=0,IloNumub=IloInfinity,IloNumVar::Typetype=Float,const char * name=0)IloNumVar(const IloEnv env,IloNumlowerBound,IloNum upperBound,const char * name)IloNumVar(const IloAddNumVar & var,IloNumlowerBound=0.0,IloNumupperBound=IloInfinity,IloNumVar::Typetype=Float,const char * name=0)IloNumVar(const IloEnv env,const IloNumArrayvalues,IloNumVar::Type type=Float,const char *name=0)IloNumVar(const IloAddNumVar & var,constIloNumArray values,IloNumVar::Typetype=Float,const char * name=0)publicIloNumVar(const IloConstraint constraint)public IloNumVar(const IloNumRange coll,const char *name=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 229


IloNumVarMethod Summarypublic IloNumVarI *public IloNumpublic voidpublic IloNumVar::Typepublic IloNumpublic voidpublic voidpublic voidpublic voidgetImpl() constgetLB() constgetPossibleValues(IloNumArray values) constgetType() constgetUB() constsetBounds(IloNum lb,IloNum ub) constsetLB(IloNum num) constsetPossibleValues(const IloNumArray values)constsetUB(IloNum num) constInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectInner EnumerationIloNumVar::Type nested enumeration.DescriptionAn instance of this class represents a numeric variable in a model. A numeric variablemay be either an integer variable or a floating-point variable; that is, a numeric variable<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 230


IloNumVarhas a type, a value of the nested enumeration IloNumVar::Type. By default, its typeis Float. It also has a lower and upper bound. A numeric variable cannot assumevalues less than its lower bound, nor greater than its upper bound.If you are looking for a class of variables that can assume only constrained integervalues, consider the class IloIntVar. If you are looking for a class of binary decisionvariables that can assume only the values 0 (zero) or 1 (one), then consider the classIloBoolVar.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.Programming HintFor each enumerated value in the nested enumeration IloNumVar::Type, ConcertTechnology offers an equivalent predefined <strong>C++</strong> #define to make programmingeasier. For example, in your applications, you may write either statement:IloNumVar x(env, 0, 17, IloNumVar::Int); // using the enumerationIloNumVar x(env, 0, 17, ILOINT);// using the #defineNote:When numeric bounds are given to an integer variable (an instance ofIloIntVar or IloNumVar with Type = Int) in the constructors or via amodifier (setUB, setLB, setBounds), they are inwardly rounded to aninteger value. LB is rounded down and UB is rounded up.See AlsoConstructorsIloBoolVar, IloIntVar, IloModel, IloNumVarArray,IloNumVar::Typepublic IloNumVar()This constructor creates an empty handle. You must initialize it before you use it.public IloNumVar(IloNumVarI * impl)This constructor creates a handle object from a pointer to an implementation object.public IloNumVar(const IloEnv env,IloNum lb=0,IloNum ub=IloInfinity,IloNumVar::Type type=Float,const char * name=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 231


IloNumVarThis constructor creates a constrained numeric variable and makes it part of theenvironment env. By default, the numeric variable ranges from 0.0 (zero) to thesymbolic constant IloInfinity, but you can specify other upper and lower boundsyourself. By default, the numeric variable assumes floating-point values. However, youcan constrain it to be an integer by setting its type = Int. By default, its name is theempty string, but you can specify a name of your own choice.public IloNumVar(const IloEnv env,IloNum lowerBound,IloNum upperBound,const char * name)This constructor creates a constrained numeric variable and makes it part of theenvironment env. The bounds of the variable are set by lowerBound andupperBound. By default, its name is the empty string, but you can specify a name ofyour own choice.public IloNumVar(const IloAddNumVar & var,IloNum lowerBound=0.0,IloNum upperBound=IloInfinity,IloNumVar::Type type=Float,const char * name=0)This constructor creates a constrained numeric variable in column format. For moreinformation on adding columns to a model, refer to the concept Column-Wise Modeling.public IloNumVar(const IloEnv env,const IloNumArray values,IloNumVar::Type type=Float,const char * name=0)This constructor creates a constrained discrete numeric variable and makes it part of theenvironment env. The new discrete variable will be limited to values in the set specifiedby the array values. By default, its name is the empty string, but you can specify aname of your own choice. You can use the member function setPossibleValueswith instances created by this constructor.public IloNumVar(const IloAddNumVar & var,const IloNumArray values,IloNumVar::Type type=Float,const char * name=0)This constructor creates a constrained discrete numeric variable from var by limitingits domain to the values specified in the array values. You may use the memberfunction setPossibleValues with instances created by this constructor.public IloNumVar(const IloConstraint constraint)This constructor creates a constrained numeric variable which is equal to the truth valueof constraint. The truth value of constraint is either 0 for IloFalse or 1 forIloTrue. You can use this constructor to cast a constraint to a constrained numericvariable. That constrained numeric variable can then be used like any other constrained<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 232


IloNumVarnumeric variable. It is thus possible to express sums of constraints, for example. Thefollowing line expresses the idea that all three variables cannot be equal:model.add((x != y) + (y != z) + (z != x) >= 2);public IloNumVar(const IloNumRange coll,const char * name=0)This constructor creates a constrained discrete numeric variable from the givencollectionMethodspublic IloNumVarI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public IloNum getLB() constThis member function returns the lower bound of the invoking numeric variable.public void getPossibleValues(IloNumArray values) constThis member function accesses the possible values of the invoking numeric variable andputs them in the array values.public IloNumVar::Type getType() constThis member function returns the type of the invoking numeric variable, specifyingwhether it is integer (Int) or floating-point (Float).public IloNum getUB() constThis member function returns the upper bound of the invoking numeric variable.public void setBounds(IloNum lb,IloNum ub) constThis member function sets lb as the lower bound and ub as the upper bound of theinvoking numeric variable.Note:The member function setBounds notifies Concert Technologyalgorithms about this change of bounds in this numeric variable.public void setLB(IloNum num) constThis member function sets num as the lower bound of the invoking numeric variable.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 233


IloNumVarNote:The member function setLB notifies Concert Technology algorithmsabout this change of bound in this numeric variable.public void setPossibleValues(const IloNumArray values) constThis member function sets values as the domain of the invoking discrete numericvariable. This member function can be called only on instances of IloNumVar thathave been created with one of the two discrete constructors; that is, instances ofIloNumVar which have been defined by an explicit array of discrete values.Note: The member function setPossibleValues notifies ConcertTechnology algorithms about this change of domain in this discrete numericvariable.public void setUB(IloNum num) constThis member function sets num as the upper bound of the invoking numeric variable.Note: The member function setUB notifies Concert Technology algorithmsabout this change of bound in this numeric variable.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 234


IloNumVarArrayIloNumVarArrayCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary The array class of IloNumVar.Constructor SummarypublicpublicpublicpublicpublicpublicpublicpublicIloNumVarArray(IloDefaultArrayI * i=0)IloNumVarArray(const IloEnv env,IloInt n=0)IloNumVarArray(const IloEnv env,constIloNumArray lb,const IloNumArrayub,IloNumVar::Type type=ILOFLOAT)IloNumVarArray(const IloEnv env,IloNumlb,const IloNumArray ub,IloNumVar::Typetype=ILOFLOAT)IloNumVarArray(const IloEnv env,constIloNumArray lb,IloNum ub,IloNumVar::Typetype=ILOFLOAT)IloNumVarArray(const IloEnv env,IloIntn,IloNum lb,IloNum ub,IloNumVar::Typetype=ILOFLOAT)IloNumVarArray(const IloEnv env,constIloNumColumnArraycolumnarray,IloNumVar::Type type=ILOFLOAT)IloNumVarArray(const IloEnv env,constIloNumColumnArray columnarray,constIloNumArray lb,const IloNumArrayub,IloNumVar::Type type=ILOFLOAT)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 235


IloNumVarArrayMethod Summarypublic void add(IloInt more,const IloNumVar x)public void add(const IloNumVar x)public voidpublic voidpublic IloNumExprArgpublic voidpublic IloIntExprArraypublic IloIntVarArraypublic IloNumExprArrayadd(const IloNumVarArray array)endElements()operator[](IloIntExprArg anIntegerExpr) constsetBounds(const IloNumArray lb,constIloNumArray ub)toIntExprArray() consttoIntVarArray() consttoNumExprArray() constInherited methods from IloNumExprArrayIloNumExprArray::add, IloNumExprArray::add, IloNumExprArray::add,IloNumExprArray::endElements, IloNumExprArray::operator[]Inherited methods from IloExtractableArrayIloExtractableArray::add, IloExtractableArray::add,IloExtractableArray::add, IloExtractableArray::endElements,IloExtractableArray::setNamesDescriptionFor each basic type, Concert Technology defines a corresponding array class.IloNumVarArray is the array class of the numeric variable class for a model.Instances of IloNumVarArray are extensible. That is, you can add more elements tosuch an array. <strong>Reference</strong>s to an array change whenever an element is added to orremoved from the array.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.See AlsoConstructorsIloAllDiff, IloModel, IloNumVar, operator>>, operatorpublic IloNumVarArray(IloDefaultArrayI * i=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 236


IloNumVarArrayThis constructor creates an empty extensible array of numeric variables. You cannotcreate instances of the undocumented class IloDefaultArrayI. As an argument inthis default constructor, it allows you to pass 0 (zero) optionally or to use 0 (zero) as adefault value of an argument in a constructor.public IloNumVarArray(const IloEnv env,IloInt n=0)This constructor creates an extensible array of n numeric variables in env. Initially, then elements are empty handles.public IloNumVarArray(const IloEnv env,const IloNumArray lb,const IloNumArray ub,IloNumVar::Type type=ILOFLOAT)This constructor creates an extensible array of numeric variables in env with lower andupper bounds and type as specified. The instances of IloNumVar to fill this array areconstructed at the same time. The length of the array lb must be the same as the lengthof the array ub. In other words, lb.getSize == ub.getSize. This constructorwill construct an array with the number of elements in the array ub.public IloNumVarArray(const IloEnv env,IloNum lb,const IloNumArray ub,IloNumVar::Type type=ILOFLOAT)This constructor creates an extensible array of numeric variables in env with lower andupper bounds and type as specified. The instances of IloNumVar to fill this array areconstructed at the same time. The length of the new array will be the same as the lengthof the array ub.public IloNumVarArray(const IloEnv env,const IloNumArray lb,IloNum ub,IloNumVar::Type type=ILOFLOAT)This constructor creates an extensible array of numeric variables in env with lower andupper bounds and type as specified. The instances of IloNumVar to fill this array areconstructed at the same time.public IloNumVarArray(const IloEnv env,IloInt n,IloNum lb,IloNum ub,IloNumVar::Type type=ILOFLOAT)This constructor creates an extensible array of n numeric variables in env with lowerand upper bounds and type as specified. The instances of IloNumVar to fill this arrayare constructed at the same time.public IloNumVarArray(const IloEnv env,const IloNumColumnArray columnarray,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 237


IloNumVarArrayIloNumVar::Type type=ILOFLOAT)This constructor creates an extensible array of numeric variables with type as specified.The instances of IloNumVar to fill this array are constructed at the same time.public IloNumVarArray(const IloEnv env,const IloNumColumnArray columnarray,const IloNumArray lb,const IloNumArray ub,IloNumVar::Type type=ILOFLOAT)This constructor creates an extensible array of numeric variables with lower and upperbounds and type as specified. The instances of IloNumVar to fill this array areconstructed at the same time.Methodspublic void add(IloInt more,const IloNumVar x)This member function appends x to the invoking array multiple times. The argumentmore specifies how many times.public void add(const IloNumVar x)This member function appends x to the invoking array.public void add(const IloNumVarArray array)This member function appends the elements in array to the invoking array.public void endElements()This member function calls IloExtractable::end for each of the elements in theinvoking array. This deletes all the extractables identified by the array, leaving thehandles in the array intact. This member function is the recommended way to delete theelements of an array.public IloNumExprArg operator[](IloIntExprArg anIntegerExpr) constThis subscripting operator returns an expression argument for use in a constraint orexpression. For clarity, let's call A the invoking array. When anIntegerExpr isbound to the value i, the domain of the expression is the domain of A[i]. Moregenerally, the domain of the expression is the union of the domains of the expressionsA[i] where the i are in the domain of anIntegerExpr.This operator is also known as an element constraint.public void setBounds(const IloNumArray lb,const IloNumArray ub)For each element in the invoking array, this member function sets lb as the lower boundand ub as the upper bound of the corresponding numeric variable in the invoking array.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 238


IloNumVarArrayNote: The member function setBounds notifies Concert Technologyalgorithms about this change of bounds in this array of numeric variables.public IloIntExprArray toIntExprArray() constThis member function copies the invoking array to a new IloIntExprArray,checking the type of the variables during the copy.public IloIntVarArray toIntVarArray() constThis member function copies the invoking array to a new IloIntVarArray,checking the type of the variables during the copy.public IloNumExprArray toNumExprArray() constThis member function copies the invoking array to a new IloNumExprArray,checking the type of the variables during the copy.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 239


IloNumVar::TypeIloNumVar::TypeCategoryDefinition FileSynopsisInner Enumerationilconcert/iloexpression.hType{Int,Float,Bool};Summary nested enumeration.DescriptionSee AlsoFieldsThis nested enumeration enables you to specify whether an instance of IloNumVar isof type integer (Int), Boolean (Bool), or floating-point (Float).Programming HintFor each enumerated value in IloNumVar::Type, there is a predefined equivalent<strong>C++</strong> #define in the Concert Technology include files to make programming easier.For example, instead of writing IloNumVar::Int in your application, you can writeILOINT. Likewise, ILOFLOAT is defined for IloNumVar::Float and ILOBOOLfor IloNumVar::Bool.IloNumVarIntFloatBool<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 240


IloObjectiveIloObjectiveCategoryClassInheritancePathDefinition Fileilconcert/ilolinear.hSummary An instance of this class is an objective in a model.Constructor SummarypublicpublicpublicpublicIloObjective()IloObjective(IloObjectiveI * impl)IloObjective(const IloEnv env,IloNumconstant=0.0,IloObjective::Sensesense=Minimize,const char * name=0)IloObjective(const IloEnv env,constIloNumExprArg expr,IloObjective::Sensesense=Minimize,const char * name=0)Method Summarypublic IloNumpublic IloNumExprArgpublic IloObjectiveI *public IloObjective::Sensepublic IloAddValueToObjpublic IloAddValueToObjpublic voidpublic voidpublic voidpublic voidgetConstant() constgetExpr() constgetImpl() constgetSense() constoperator()(IloNum value)operator()()setConstant(IloNum constant)setExpr(const IloNumExprArg)setLinearCoef(const IloNumVar var,IloNumvalue)setLinearCoefs(const IloNumVarArrayvars,const IloNumArray values)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 241


IloObjectivepublic voidsetSense(IloObjective::Sense sense)Inherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectInner EnumerationIloObjective::Sense Specifies objective as minimization ormaximization.DescriptionAn instance of this class is an objective in a model. An objective consists of its sense(specifying whether it is a minimization or maximization) and an expression. Theexpression may be a constant.An objective belongs to the environment that the variables in its expression belong to.Generally, you will create an objective, add it to a model, and extract the model for analgorithm.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.What Is ExtractedAll the variables (that is, instances of IloNumVar or one of its subclasses) in theobjective (an instance of IloObjective) will be extracted when an algorithm such asIloCplex, documented in the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong> <strong>Manual</strong>, extracts theobjective.Multiple Objectives<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 242


IloObjectiveYou may create more than one objective in a model, for example, by creating more thanone group. However, certain algorithms, such as an instance of IloCplex, will throwan exception (on a platform that supports <strong>C++</strong> exceptions, when exceptions areenabled) if you attempt to extract more than one objective at a time.Also see the functions IloMaximize and IloMinimize for “short cuts” to createobjectives.Normalizing Linear Expressions: Reducing the TermsNormalizing is sometimes known as reducing the terms of a linear expression.Linear expressions consist of terms made up of constants and variables related byarithmetic operations; for example, x + 3y is a linear expression of two terms consistingof two variables. In some linear expressions, a given variable may appear in more thanone term, for example, x + 3y +2x. Concert Technology has more than one way ofdealing with linear expressions in this respect, and you control which way ConcertTechnology treats linear expressions from your application.In one mode (the default mode), Concert Technology analyzes expressions that yourapplication passes it and attempts to reduce them so that a given variable appears inonly one term in the expression. You set this mode with the member functionsetNormalizer.Certain constructors and member functions in this class check this setting in the modeland behave accordingly: they attempt to reduce expressions. This mode may requiremore time during preliminary computation, but it avoids the possibility of an assertionfailing for certain member functions of this class in case of duplicates.In the other mode, Concert Technology assumes that no variable appears in more thanone term in any of the linear expressions that your application passes to ConcertTechnology. We call this mode assume no duplicates. You set this mode with themember function setNormalizer.Certain constructors and member functions in this class check this setting in the modeland behave accordingly: they assume that no variable appears in more than one term inan expression. This mode may save time during computation, but it entails the risk thatan expression may contain one or more variables, each of which appears in one or moreterms. This situation will cause certain assert statements in Concert Technology tofail if you do not compile with the flag -DNDEBUG.See AlsoConstructorsIloMaximize, IloMinimize, IloModel, IloObjective::Sensepublic IloObjective()This constructor creates an empty handle. You must initialize it before you use it.public IloObjective(IloObjectiveI * impl)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 243


IloObjectiveThis constructor creates a handle object from a pointer to an implementation object.public IloObjective(const IloEnv env,IloNum constant=0.0,IloObjective::Sense sense=Minimize,const char * name=0)This constructor creates an objective consisting of a constant and belonging to env.The sense of the objective (whether it is a minimization or maximization) is specified bysense; by default, it is a minimization. You may supply a name for the objective; bydefault, its name is the empty string. This constructor is useful when you want tocreate an empty objective and fill it later by column-wise modeling.public IloObjective(const IloEnv env,const IloNumExprArg expr,IloObjective::Sense sense=Minimize,const char * name=0)This constructor creates an objective to add to a model from expr.After you create an objective from an expression with this constructor, you must use themember function add explicitly to add your objective to your model or to a group inorder for the objective to be taken into account.Note: When it accepts an expression as an argument, this constructorchecks the setting of setNormalizer to determine whether to assumethe expression has already been reduced or to reduce the expressionbefore using it.Methodspublic IloNum getConstant() constThis member function returns the constant term from the expression of the invokingobjective.public IloNumExprArg getExpr() constThis member function returns the expression of the invoking IloObjective object.public IloObjectiveI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public IloObjective::Sense getSense() constThis member function returns the sense of the invoking objective, specifying whetherthe objective is a minimization (Minimize) or a maximization (Maximize).public IloAddValueToObj operator()(IloNum value)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 244


IloObjectiveThis casting operator uses a floating-point value to create an instance ofIloAddNumVar or one of its subclasses and to add that value to that instance. Seethe concept Column-Wise Modeling for an explanation of how to use this operator incolumn-wise modeling.public IloAddValueToObj operator()()This casting operator uses a floating-point value to create an instance ofIloAddNumVar or one of its subclasses and to add that value to that instance. If noargument is given, it assumes 1.0. See the concept Column-Wise Modeling for anexplanation of how to use this operator in column-wise modeling.public void setConstant(IloNum constant)This member function sets constant as the constant term in the invoking objective,and it creates the appropriate instance of the undocumented class IloChange to notifyalgorithms about this change of an extractable object in the model.Note: The member function setConstant notifies Concert Technologyalgorithms about this change of this invoking object.public void setExpr(const IloNumExprArg)This member function sets the expression of the invoking IloObjective object.public void setLinearCoef(const IloNumVar var,IloNum value)This member function sets value as the linear coefficient of the variable var in theinvoking objective, and it creates the appropriate instance of the undocumented classIloChange to notify algorithms about this change of an extractable object in themodel.Note: The member function setLinearCoef notifies Concert Technologyalgorithms about this change of this invoking object.If you attempt to use setLinearCoef on a nonlinear expression, it will throw anexception on platforms that support <strong>C++</strong> exceptions when exceptions are enabled.public void setLinearCoefs(const IloNumVarArray vars,const IloNumArray values)For each of the variables in vars, this member function sets the corresponding value ofvalues (whether integer or floating-point) as its linear coefficient in the invokingobjective, and it creates the appropriate instance of the undocumented class<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 245


IloObjectiveIloChange to notify algorithms about this change of an extractable object in themodel.Note: The member function setLinearCoefs notifies ConcertTechnology algorithms about this change of this invoking object.If you attempt to use setLinearCoef on a non linear expression, ConcertTechnology will throw an exception on platforms that support <strong>C++</strong> exceptions whenexceptions are enabled.public void setSense(IloObjective::Sense sense)This member function sets sense to specify whether the invoking objective is amaximization (Maximize) or minimization (Minimize), and it creates theappropriate instance of the undocumented class IloChange to notify algorithmsabout this change of an extractable object in the model.Note: The member function setSense notifies Concert Technologyalgorithms about this change of this invoking object.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 246


IloObjective::SenseIloObjective::SenseCategoryDefinition FileSynopsisInner Enumerationilconcert/ilolinear.hSense{Minimize,Maximize};Summary Specifies objective as minimization or maximization.DescriptionSee AlsoFieldsAn instance of the class IloObjective represents an objective in a model. Thisnested enumeration is limited in scope to that class, and its values specify the sense of anobjective; that is, whether it is a minimization (Minimize) or a maximization(Maximize).IloObjectiveMinimizeMaximize<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 247


IloOrIloOrCategoryClassInheritancePathDefinition Fileilconcert/ilomodel.hSummary Represents a disjunctive constraint.Constructor SummarypublicpublicpublicIloOr()IloOr(IloOrI * impl)IloOr(const IloEnv env,const char * name=0)Method Summarypublic voidpublic voidpublic IloOrI *public voidpublic voidadd(const IloConstraintArray cons) constadd(const IloConstraint con) constgetImpl() constremove(const IloConstraintArray cons) constremove(const IloConstraint con) constInherited methods from IloConstraintIloConstraint::getImpl<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 248


IloOrInherited methods from IloIntExprArgIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionAn instance of IloOr represents a disjunctive constraint. In other words, it defines adisjunctive-OR among any number of constraints. Since an instance of IloOr is aconstraint itself, you can build up extensive disjunctions by adding constraints to aninstance of IloOr by means of the member function add. You can also removeconstraints from an instance of IloOr by means of the member function remove.The elements of a disjunctive constraint must be in the same environment.In order for the constraint to take effect, you must add it to a model with the templateIloAdd or the member function IloModel::add and extract the model for analgorithm with the member function extract.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.Disjunctive Goals<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 249


IloOrIf you would like to represent a disjunctive-OR as a goal (rather than a constraint), thenyou should consider the function IloOrGoal, documented in the <strong>ILOG</strong> Solver<strong>Reference</strong> <strong>Manual</strong>.What Is ExtractedAll the constraints (that is, instances of IloConstraint or one of its subclasses) thathave been added to a disjunctive constraint (an instance of IloOr) and that have notbeen removed from it will be extracted when an algorithm such as IloCplex, IloCP,or IloSolver extracts the constraint.ExampleFor example, you may write:IloOr myor(env);myor.add(constraint1);myor.add(constraint2);myor.add(constraint3);Those lines are equivalent to :IloOr or = constraint1 || constraint2 || constraint3;See AlsoConstructorsIloAnd, IloConstraint, operator||public IloOr()This constructor creates an empty handle. You must initialize it before you use it.public IloOr(IloOrI * impl)This constructor creates a handle object from a pointer to an implementation object.public IloOr(const IloEnv env,const char * name=0)This constructor creates a disjunctive constraint for use in env. The optional argumentname is set to 0 by default.Methodspublic void add(const IloConstraintArray cons) constThis member function makes all the elements in array elements of the invokingdisjunctive constraint. In other words, it applies the invoking disjunctive constraint to allthe elements of array.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 250


IloOrNote: The member function add notifies Concert Technology algorithmsabout this change of this invoking object.public void add(const IloConstraint con) constThis member function makes constraint one of the elements of the invokingdisjunctive constraint. In other words, it applies the invoking disjunctive constraint toconstraint.Note: The member function add notifies Concert Technology algorithmsabout this change of this invoking object.public IloOrI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public void remove(const IloConstraintArray cons) constThis member function removes all the elements of array from the invoking disjunctiveconstraint so that the invoking disjunctive constraint no longer applies to any of thoseelements.Note: The member function remove notifies Concert Technologyalgorithms about this change of this invoking object.public void remove(const IloConstraint con) constThis member function removes constraint from the invoking disjunctive constraintso that the invoking disjunctive constraint no longer applies to constraint.Note: The member function remove notifies Concert Technologyalgorithms about this change of this invoking object.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 251


IloPiIloPiCategorySynopsisMacroIloPi()Summary Pi.DescriptionConcert Technology predefines conventional trigonometric constants to conform toIEEE 754 standards for quarter pi, half pi, pi, three-halves pi, and two pi.extern const IloNum IloPi; // = 3.14159265358979323846<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 252


IloPiecewiseLinearIloPiecewiseLinearCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloNumExprArg IloPiecewiseLinear(const IloNumExprArg node,const IloNumArray point,const IloNumArray slope,IloNum a,IloNum fa)public IloNumExprArg IloPiecewiseLinear(const IloNumExprArg node,IloNum firstSlope,const IloNumArray point,const IloNumArray value,IloNum lastSlope)Summary Represents a continuous or discontinuous piecewise linear function.DescriptionThe function IloPiecewiseLinear creates an expression node to represent acontinuous or discontinuous piecewise linear function f of the variable x. The arraypoint contains the n breakpoints of the function such that point [i-1]


IloPowerIloPowerCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloNumExprArg IloPower(const IloNumExprArg base,const IloNumExprArg exponent)public IloNumExprArg IloPower(const IloNumExprArg base,IloNum exponent)public IloNumExprArg IloPower(IloNum base,const IloNumExprArg exponent)Summary Returns the power of its arguments.DescriptionConcert Technology offers predefined functions that return an expression from analgebraic function over expressions. These predefined functions also return a numericvalue from an algebraic function over numeric values as well.IloPower returns the result of raising its base argument to the power of itsexponent argument, that is, base**exponent. Ifbase is a floating-point value orvariable, then exponent must be greater than or equal to 0 (zero).What Is ExtractedAn instance of IloCplex can extract only quadratic terms that are positive semidefinitewhen they appear in an objective function or in constraints of a model.An instance of IloSolver or an instance of IloCP extracts the object returned byIloPower.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 254


IloQuarterPiIloQuarterPiCategorySynopsisMacroIloQuarterPi()Summary Quarter pi.DescriptionConcert Technology predefines conventional trigonometric constants to conform toIEEE 754 standards for quarter pi, half pi, pi, three-halves pi, and two pi.extern const IloNum IloQuarterPi; // = 0.78539816339744830962<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 255


IloRandomIloRandomCategoryClassInheritancePathDefinition Fileilconcert/ilorandom.hSummary This handle class produces streams of pseudo-random numbers.Constructor SummarypublicpublicpublicpublicIloRandom()IloRandom(const IloEnv env,IloInt seed=0)IloRandom(IloRandomI * impl)IloRandom(const IloRandom & rand)Method Summarypublic voidpublic IloEnvpublic IloNumpublic IloRandomI *public IloIntpublic const char *public IloAnypublic voidpublic voidpublic voidend()getEnv() constgetFloat() constgetImpl() constgetInt(IloInt n) constgetName() constgetObject() constreSeed(IloInt seed)setName(const char * name) constsetObject(IloAny obj) constDescriptionThis handle class produces streams of pseudo-random numbers. You can use objects ofthis class to create a search with a random element. You can create any number ofinstances of this class; these instances insure reproducible results in multithreadedapplications, where the use of a single source for random numbers creates problems.See Also the class IloRandomize in the<strong>ILOG</strong> Solver <strong>Reference</strong> <strong>Manual</strong>.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 256


IloRandomConstructorspublic IloRandom()This constructor creates a random number generator; it is initially an empty handle. Youmust assign this handle before you use its member functions.public IloRandom(const IloEnv env,IloInt seed=0)This constructor creates an object that generates random numbers. You can seed thegenerator by supplying a value for the integer argument seed.public IloRandom(IloRandomI * impl)This constructor creates a handle object (an instance of the class IloRandom) from apointer to an implementation object (an instance of the class IloRandomI).public IloRandom(const IloRandom & rand)This constructor creates a handle object from a reference to a random number generator.After execution, both the newly constructed handle and rand point to the sameimplementation object.Methodspublic void end()This member function releases all memory used by the random number generator. Aftera call to this member function, you should not use the generator again.public IloEnv getEnv() constThis member function returns the environment associated with the implementation classof the invoking generator.public IloNum getFloat() constThis member function returns a floating-point number drawn uniformly from theinterval [0..1).public IloRandomI * getImpl() constThis member function returns the implementation object of the invoking handle.public IloInt getInt(IloInt n) constThis member function returns an integer drawn uniformly from the interval [0..n).public const char * getName() constThis member function returns a character string specifying the name of the invokingobject (if there is one).public IloAny getObject() constThis member function returns the object associated with the invoking object (if there isone). Normally, an associated object contains user data pertinent to the invoking object.public void reSeed(IloInt seed)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 257


IloRandomThis member function re-seeds the random number generator with seed.public void setName(const char * name) constThis member function assigns name to the invoking object.public void setObject(IloAny obj) constThis member function associates obj with the invoking object. The member functiongetObject accesses this associated object afterward. Normally, obj contains userdata pertinent to the invoking object.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 258


IloRangeIloRangeCategoryClassInheritancePathDefinition Fileilconcert/ilolinear.hSummary An instance of this class is a range in a model.Constructor SummarypublicpublicpublicpublicpublicIloRange()IloRange(IloRangeI * impl)IloRange(const IloEnv env,IloNum lb,IloNumub,const char * name=0)IloRange(const IloEnv env,IloNum lhs,constIloNumExprArg expr,IloNumrhs=IloInfinity,const char * name=0)IloRange(const IloEnv env,const IloNumExprArgexpr,IloNum rhs=IloInfinity,const char * name=0)Method Summarypublic IloNumExprArgpublic IloRangeI *public IloNumpublic IloNumpublic IloAddValueToRangepublic voidgetExpr() constgetImpl() constgetLB() constgetUB() constoperator()(IloNum value) constsetBounds(IloNum lb,IloNum ub)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 259


IloRangepublic voidpublic voidpublic voidpublic voidpublic voidsetExpr(const IloNumExprArg expr)setLB(IloNum lb)setLinearCoef(const IloNumVar var,IloNumvalue)setLinearCoefs(const IloNumVarArrayvars,const IloNumArray values)setUB(IloNum ub)Inherited methods from IloConstraintIloConstraint::getImplInherited methods from IloIntExprArgIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionAn instance of this class is a range in a model, that is, a constraint of the form:<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 260


IloRangelowerBound


IloRangeTechnology. We call this mode assume normalized linear expressions. You set this modewith the member function setNormalizer(IloFalse).Certain constructors and member functions in this class check this setting in the modeland behave accordingly: they assume that no variable appears in more than one term inan expression. This mode may save time during computation, but it entails the risk thatan expression may contain one or more variables, each of which appears in one or moreterms. This situation will cause certain assert statements in Concert Technology tofail if you do not compile with the flag -DNDEBUG.See AlsoConstructorsIloConstraint, IloRangeArraypublic IloRange()This constructor creates an empty handle. You must initialize it before you use it.public IloRange(IloRangeI * impl)This constructor creates a handle object from a pointer to an implementation object.public IloRange(const IloEnv env,IloNum lb,IloNum ub,const char * name=0)This constructor creates an empty range constraint. Before you use this constraint, youmust fill the range. The optional argument name is set to 0 by default.After you create a range constraint, you must explicitly add it to a model in order for itto be taken into account. To do so, use the member function IloModel::add.public IloRange(const IloEnv env,IloNum lhs,const IloNumExprArg expr,IloNum rhs=IloInfinity,const char * name=0)This constructor creates a range constraint from an expression (an instance of the classIloNumExprArg) and its upper bound (rhs). The default bound for rhs is thesymbolic constant IloInfinity. The optional argument name is set to 0 by default.Note:When it accepts an expression as an argument, this constructorchecks the setting of setNormalizer to determine whether to assumethe expression has already been reduced or to reduce the expressionbefore using it.public IloRange(const IloEnv env,const IloNumExprArg expr,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 262


IloRangeIloNum rhs=IloInfinity,const char * name=0)This constructor creates a range constraint from an expression (an instance of the classIloNumExprArg) and its upper bound (rhs). Its lower bound (lhs) will be -IloInfinity. The default bound for rhs is IloInfinity. The optional argumentname is set to 0 by default.Note:When it accepts an expression as an argument, this constructorchecks the setting of setNormalizer to determine whether to assumethe expression has already been reduced or to reduce the expressionbefore using it.Methodspublic IloNumExprArg getExpr() constThis member function returns the expression of the invoking IloRange object.public IloRangeI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public IloNum getLB() constThis member function returns the lower bound of the invoking range.public IloNum getUB() constThis member function returns the upper bound of the invoking range.public IloAddValueToRange operator()(IloNum value) constThis operator creates the objects needed internally to represent a range in column-wisemodeling. See the concept Column-Wise Modeling for an explanation of how to use thisoperator in column-wise modeling.public void setBounds(IloNum lb,IloNum ub)This member function sets lb as the lower bound and ub as the upper bound of theinvoking range, and it creates the appropriate instance of the undocumented classIloChange to notify algorithms about this change of an extractable object in themodel.Note: The member function setBounds notifies Concert Technologyalgorithms about this change of this invoking object.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 263


IloRangepublic void setExpr(const IloNumExprArg expr)This member function sets expr as the invoking range, and it creates the appropriateinstance of the undocumented class IloChange to notify algorithms about this changeof an extractable object in the model.Note: The member function setExpr notifies Concert Technologyalgorithms about this change of this invoking object.public void setLB(IloNum lb)This member function sets lb as the lower bound of the invoking range, and it createsthe appropriate instance of the undocumented class IloChange to notify algorithmsabout this change of an extractable object in the model.Note: The member function setLB notifies Concert Technology algorithmsabout this change of this invoking object.public void setLinearCoef(const IloNumVar var,IloNum value)This member function sets value as the linear coefficient of the variable var in theinvoking range, and it creates the appropriate instance of the undocumented classIloChange to notify algorithms about this change of an extractable object in themodel.Note: The member function setLinearCoef notifies Concert Technologyalgorithms about this change of this invoking object.If you attempt to use setLinearCoef on a non linear expression, it will throw anexception on platforms that support <strong>C++</strong> exceptions when exceptions are enabled.public void setLinearCoefs(const IloNumVarArray vars,const IloNumArray values)For each of the variables in vars, this member function sets the corresponding value ofvalues (whether integer or floating-point) as its linear coefficient in the invokingrange, and it creates the appropriate instance of the undocumented class IloChange tonotify algorithms about this change of an extractable object in the model.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 264


IloRangeNote: The member function setLinearCoefs notifies ConcertTechnology algorithms about this change of this invoking object.If you attempt to use setLinearCoef on a non linear expression, it will throw anexception on platforms that support <strong>C++</strong> exceptions when exceptions are enabled.public void setUB(IloNum ub)This member function sets ub as the upper bound of the invoking range, and it createsthe appropriate instance of the undocumented class IloChange to notify algorithmsabout this change of an extractable object in the model.Note: The member function setUB notifies Concert Technology algorithmsabout this change of this invoking object.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 265


IloRangeArrayIloRangeArrayCategoryClassInheritancePathDefinition FileSummaryilconcert/ilolinear.hIloRangeArray is the array class of ranges for a model.Constructor SummarypublicpublicpublicpublicpublicpublicpublicpublicpublicpublicIloRangeArray(IloDefaultArrayI * i=0)IloRangeArray(const IloEnv env,IloInt n=0)IloRangeArray(const IloEnv env,IloIntn,IloNum lb,IloNum ub)IloRangeArray(const IloEnv env,constIloNumArray lbs,const IloNumExprArrayrows,const IloNumArray ubs)IloRangeArray(const IloEnv env,IloNumlb,const IloNumExprArray rows,constIloNumArray ubs)IloRangeArray(const IloEnv env,constIloNumArray lbs,const IloNumExprArrayrows,IloNum ub)IloRangeArray(const IloEnv env,IloNumlb,const IloNumExprArray rows,IloNum ub)IloRangeArray(const IloEnv env,constIloIntArray lbs,const IloNumExprArrayrows,const IloIntArray ubs)IloRangeArray(const IloEnv env,IloNumlb,const IloNumExprArray rows,constIloIntArray ubs)IloRangeArray(const IloEnv env,constIloIntArray lbs,const IloNumExprArrayrows,IloNum ub)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 266


IloRangeArraypublicpublicpublicpublicpublicpublicIloRangeArray(const IloEnv env,constIloNumArray lbs,const IloNumArray ubs)IloRangeArray(const IloEnv env,constIloIntArray lbs,const IloIntArray ubs)IloRangeArray(const IloEnv env,IloNumlb,const IloNumArray ubs)IloRangeArray(const IloEnv env,constIloNumArray lbs,IloNum ub)IloRangeArray(const IloEnv env,IloNumlb,const IloIntArray ubs)IloRangeArray(const IloEnv env,constIloIntArray lbs,IloNum ub)Method Summarypublic voidpublic voidpublic voidpublic IloNumColumnpublic IloNumColumnpublic IloRangeadd(IloInt more,const IloRange range)add(const IloRange range)add(const IloRangeArray array)operator()(const IloNumArray vals)operator()(const IloIntArray vals)operator[](IloInt i) constpublic IloRange & operator[](IloInt i)public voidpublic voidsetBounds(const IloIntArray lbs,constIloIntArray ubs)setBounds(const IloNumArray lbs,constIloNumArray ubs)Inherited methods from IloConstraintArrayadd, add, add, operator[], operator[]Inherited methods from IloExtractableArrayIloExtractableArray::add, IloExtractableArray::add,IloExtractableArray::add, IloExtractableArray::endElements,IloExtractableArray::setNames<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 267


IloRangeArrayDescriptionFor each basic type, Concert Technology defines a corresponding array class.IloRangeArray is the array class of ranges for a model.Instances of IloRangeArray are extensible. That is, you can add more elements tosuch an array. <strong>Reference</strong>s to an array change whenever an element is added to orremoved from the array.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.For information on arrays, see the concept ArraysNote:IloRangeArray has access to member functions defined in theIloArray template.See AlsoConstructorsIloRange, operator>>, operatorpublic IloRangeArray(IloDefaultArrayI * i=0)This default constructor creates an empty range array. You cannot create instances ofthe undocumented class IloDefaultArrayI. As an argument in this defaultconstructor, it allows you to pass 0 (zero) as a value to an optional argument in functionsand member functions that accept an array as an argument.public IloRangeArray(const IloEnv env,IloInt n=0)This constructor creates an array of n elements, each of which is an empty handle.public IloRangeArray(const IloEnv env,IloInt n,IloNum lb,IloNum ub)This constructor creates an array of n elements, each with the lower bound lb and theupper bound ub.public IloRangeArray(const IloEnv env,const IloNumArray lbs,const IloNumExprArray rows,const IloNumArray ubs)This constructor creates an array of ranges from rows, an array of expressions. It usesthe corresponding elements of the arrays lbs and ubs to set the lower and upperbounds of elements in the new array. The length of rows must equal the length of lbsand ubs.public IloRangeArray(const IloEnv env,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 268


IloRangeArrayIloNum lb,const IloNumExprArray rows,const IloNumArray ubs)This constructor creates an array of ranges from rows, an array of expressions. Thelower bound of every element in the new array will be lb. The upper bound of eachelement of the new array will be the corresponding element of the array ubs. The lengthof rows must equal the length of ubs.public IloRangeArray(const IloEnv env,const IloNumArray lbs,const IloNumExprArray rows,IloNum ub)This constructor creates an array of ranges from rows, an array of expressions. Theupper bound of every element in the new array will be ub. The lower bound of eachelement of the new array will be the corresponding element of the array lbs. The lengthof rows must equal the length of lbs.public IloRangeArray(const IloEnv env,IloNum lb,const IloNumExprArray rows,IloNum ub)This constructor creates an array of ranges from rows, an array of expressions. Thelower bound of every element in the new array will be lb. The upper bound of everyelement in the new array will be ub.public IloRangeArray(const IloEnv env,const IloIntArray lbs,const IloNumExprArray rows,const IloIntArray ubs)This constructor creates an array of ranges from rows, an array of expressions. It usesthe corresponding elements of the arrays lbs and ubs to set the lower and upperbounds of elements in the new array. The length of rows must equal the length of lbsand ubs.public IloRangeArray(const IloEnv env,IloNum lb,const IloNumExprArray rows,const IloIntArray ubs)This constructor creates an array of ranges from rows, an array of expressions. Thelower bound of every element in the new array will be lb. The upper bound of eachelement of the new array will be the corresponding element of the array ubs. The lengthof rows must equal the length of ubs.public IloRangeArray(const IloEnv env,const IloIntArray lbs,const IloNumExprArray rows,IloNum ub)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 269


IloRangeArrayThis constructor creates an array of ranges from rows, an array of expressions. Theupper bound of every element in the new array will be ub. The lower bound of eachelement of the new array will be the corresponding element of the array lbs. The lengthof rows must equal the length of lbs.public IloRangeArray(const IloEnv env,const IloNumArray lbs,const IloNumArray ubs)This constructor creates an array of ranges. The number of elements in the new arraywill be equal to the number of elements in the arrays lbs (or ubs). The number ofelements in lbs must be equal to the number of elements in ubs. The lower bound ofeach element in the new array will be equal to the corresponding element in the arraylbs. The upper bound of each element in the new array will be equal to thecorresponding element in the array ubs.public IloRangeArray(const IloEnv env,const IloIntArray lbs,const IloIntArray ubs)This constructor creates an array of ranges. The number of elements in the new arraywill be equal to the number of elements in the arrays lbs (or ubs). The number ofelements in lbs must be equal to the number of elements in ubs. The lower bound ofeach element in the new array will be equal to the corresponding element in the arraylbs. The upper bound of each element in the new array will be equal to thecorresponding element in the array ubs.public IloRangeArray(const IloEnv env,IloNum lb,const IloNumArray ubs)This constructor creates an array of ranges. The number of elements in the new arraywill be equal to the number of elements in the array ubs. The lower bound of everyelement in the new array will be equal to lb. The upper bound of each element in thenew array will be equal to the corresponding element in the array ubs.public IloRangeArray(const IloEnv env,const IloNumArray lbs,IloNum ub)This constructor creates an array of ranges. The number of elements in the new arraywill be equal to the number of elements in the array ubs. The lower bound of everyelement in the new array will be equal to lb. The upper bound of each element in thenew array will be equal to the corresponding element in the array ubs.public IloRangeArray(const IloEnv env,IloNum lb,const IloIntArray ubs)This constructor creates an array of ranges. The number of elements in the new arraywill be equal to the number of elements in the array ubs. The lower bound of every<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 270


IloRangeArrayelement in the new array will be equal to lb. The upper bound of each element in thenew array will be equal to the corresponding element in the array ubs.public IloRangeArray(const IloEnv env,const IloIntArray lbs,IloNum ub)This constructor creates an array of ranges. The number of elements in the new arraywill be equal to the number of elements in the array ubs. The lower bound of everyelement in the new array will be equal to lb. The upper bound of each element in thenew array will be equal to the corresponding element in the array ubs.Methodspublic void add(IloInt more,const IloRange range)This member function appends range to the invoking array multiple times. Theargument more specifies how many times.public void add(const IloRange range)This member function appends range to the invoking array.public void add(const IloRangeArray array)This member function appends the elements in array to the invoking array.public IloNumColumn operator()(const IloNumArray vals)This operator constructs ranges in column representation. That is, it creates an instanceof IloNumColumn that will add a newly created variable to all the ranged constraintsin the invoking object, each as a linear term with the corresponding value specified in thearray values.public IloNumColumn operator()(const IloIntArray vals)This operator constructs ranges in column representation. That is, it creates an instanceof IloNumColumn that will add a newly created variable to all the ranged constraintsin the invoking object, each as a linear term with the corresponding value specified in thearray values.public IloRange operator[](IloInt i) constThis operator returns a reference to the object located in the invoking array at theposition specified by the index i. On const arrays, Concert Technology uses theconst operator:IloRange operator[] (IloInt i) const;public IloRange & operator[](IloInt i)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 271


IloRangeArrayThis operator returns a reference to the object located in the invoking array at theposition specified by the index i.public void setBounds(const IloIntArray lbs,const IloIntArray ubs)This member function does not change the array itself; instead, it changes the bounds ofall the ranged constraints that are elements of the invoking array. At the same time, italso creates an instance of the undocumented class IloChange to notify ConcertTechnology algorithms about this change in an extractable object of the model. Theelements of the arrays lbs and ubs may be integer or floating-point values. The size ofthe invoking array must be equal to the size of lbs and the size of ubs.Note: The member function setBounds notifies Concert Technologyalgorithms about this change of bounds for all the elements in this invokingarray.public void setBounds(const IloNumArray lbs,const IloNumArray ubs)This member function does not change the array itself; instead, it changes the bounds ofall the ranged constraints that are elements of the invoking array. At the same time, italso creates an instance of the undocumented class IloChange to notify ConcertTechnology algorithms about this change in an extractable object of the model. Theelements of the arrays lbs and ubs may be integer or floating-point values. The size ofthe invoking array must be equal to the size of lbs and the size of ubs.Note: The member function setBounds notifies Concert Technologyalgorithms about this change of bounds for all the elements in this invokingarray.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 272


IloRoundIloRoundCategoryDefinition FileSynopsisGlobal Functionilconcert/iloenv.hpublic IloNum IloRound(IloNum val)Summary This function computes the nearest integer value.DescriptionThis function computes the nearest integer value to val. Halfway cases are rounded tothe larger in magnitude.Examples:IloRound(IloInfinity) is IloInfinity.IloRound(-IloInfinity) is -IloInfinity.IloRound(0) is 0.IloRound(0.4) is 0.IloRound(-0.4) is 0.IloRound(0.5) is 1.IloRound(-0.5) is -1.IloRound(0.6) is 1.IloRound(-0.6) is -1.IloRound(1e300) is 1e300.IloRound(1.0000001e6) is 1e6.IloRound(1.0000005e6) is 1.000001e6.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 273


IloScalProdIloScalProdCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloNumExprArg IloScalProd(const IloNumArray values,const IloNumVarArray vars)public IloNumExprArg IloScalProd(const IloNumVarArray vars,const IloNumArray values)public IloNumExprArg IloScalProd(const IloNumArray values,const IloIntVarArray vars)public IloNumExprArg IloScalProd(const IloIntVarArray vars,const IloNumArray values)public IloNumExprArg IloScalProd(const IloIntArray values,const IloNumVarArray vars)public IloNumExprArg IloScalProd(const IloNumVarArray vars,const IloIntArray values)public IloNumExprArg IloScalProd(const IloNumExprArray leftExprs,const IloNumExprArray rightExprs)Summary Represents the scalar product.DescriptionThis function returns an instance of IloNumExprArg, the internal building block ofan expression, representing the scalar product of the variables in the arrays vars andvalues or the arrays leftExprs and rightExprs.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 274


IloScalProdIloScalProdCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloIntExprArg IloScalProd(const IloIntArray values,const IloIntVarArray vars)public IloIntExprArg IloScalProd(const IloIntVarArray vars,const IloIntArray values)public IloIntExprArg IloScalProd(const IloIntExprArray leftExprs,const IloIntExprArray rightExprs)Summary Represents the scalar product.DescriptionThis function returns an instance of IloIntExprArg, the internal building block of aninteger expression, representing the scalar product of the variables in the arrays varsand values or the arrays leftExprs and rightExprs.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 275


IloScalProdIloScalProdCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloNum IloScalProd(const IloNumArray vals1,const IloNumArray vals2)public IloNum IloScalProd(const IloIntArray vals1,const IloNumArray vals2)public IloNum IloScalProd(const IloNumArray vals1,const IloIntArray vals2)Summary Represents the scalar product.DescriptionThis function returns a numeric value representing the scalar product of numeric valuesin the arrays vals1 and vals2.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 276


IloScalProdIloScalProdCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloInt IloScalProd(const IloIntArray vals1,const IloIntArray vals2)Summary Represents the scalar product.DescriptionThis function returns an integer value representing the scalar product of integer values inthe arrays vals1 and vals2.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 277


IloSemaphoreIloSemaphoreCategoryClassInheritancePathDefinition Fileilconcert/ilothread.hSummary Provides synchronization primitives.Constructor SummarypublicIloSemaphore(int value=0)Method Summarypublic voidpublic intpublic voidpost()tryWait()wait()DescriptionThe class IloSemaphore provides synchronization primitives adapted to ConcertTechnology. This class supports inter-thread communication in multithread applications.An instance of this class, a semaphore, is a counter; its value is always positive. Thiscounter can be incremented or decremented. You can always increment a semaphore,and incrementing is not a blocking operation. However, the value of the counter cannotbe negative, so any thread that attempts to decrement a semaphore whose counter isalready equal to 0 (zero) is blocked until another thread increments the semaphore.See ILOUSEMT for details about the compilation macro to use with instances of thisclass.System ClassIloSemaphore is a system class.Most Concert Technology classes are actually handle classes whose instances point toobjects of a corresponding implementation class. For example, instances of the ConcertTechnology class IloNumVar are handles pointing to instances of the implementation<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 278


IloSemaphoreclass IloNumVarI. Their allocation and de-allocation in a Concert Technologyenvironment are managed by an instance of IloEnv.However, system classes, such as IloSemaphore, differ from that pattern.IloSemaphore is an ordinary <strong>C++</strong> class. Its instances are allocated on the <strong>C++</strong> heap.Instances of IloSemaphore are not automatically de-allocated by a call to themember function IloEnv::end. You must explicitly destroy instances ofIloSemaphore by means of a call to the delete operator (which calls the appropriatedestructor) when your application no longer needs instances of this class.Furthermore, you should not allocate—neither directly nor indirectly—any instance ofIloSemaphore in a Concert Technology environment because the destructor for thatinstance of IloSemaphore will never be called automatically by IloEnv::endwhen it cleans up other Concert Technology objects in that Concert Technologyenvironment.For example, it is not a good idea to make an instance of IloSemaphore part of aconventional Concert Technology model allocated in a Concert Technologyenvironment because that instance will not automatically be de-allocated from theConcert Technology environment along with the other Concert Technology objects.De-allocating Instances of IloSemaphoreInstances of IloSemaphore differ from the usual Concert Technology objectsbecause they are not allocated in a Concert Technology environment, and their deallocationis not managed automatically for you by IloEnv::end. Instead, you mustexplicitly destroy instances of IloSemaphore by calling the delete operator whenyour application no longer needs those objects.See AlsoConstructorsMethodsIloBarrier, IloCondition, ILOUSEMTpublic IloSemaphore(int value=0)This constructor creates an instance of IloSemaphore, initializes it to value, andallocates it on the <strong>C++</strong> heap (not in a Concert Technology environment). If you do notpass a value argument, the constructor initializes the semaphore at 0 (zero).public void post()This member function increments the invoking semaphore by 1 (one). If there arethreads blocked at this semaphore, then this member function wakes one of them.public int tryWait()This member function attempts to decrement the invoking semaphore by 1 (one). If thisdecrement leaves the counter positive, then the call succeeds and returns 1 (one). If thedecrement would make the counter strictly negative, then the decrement does not occur,the call fails, and the member function returns 0 (zero).<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 279


IloSemaphorepublic void wait()This member function decrements the invoking semaphore by 1 (one).If this decrement would make the semaphore strictly negative, then this memberfunction blocks the calling thread. The thread wakes up when the member function cansafely decrement the semaphore without causing the counter to become negative (forexample, if another entity increments the semaphore). If this member function cannotdecrement the invoking semaphore, then it leads to deadlock.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 280


IloSolutionIloSolutionCategoryClassInheritancePathDefinition Fileilconcert/ilosolution.hSummary Instances of this class store solutions to problems.Constructor SummarypublicpublicpublicpublicIloSolution()IloSolution(IloSolutionI * impl)IloSolution(const IloSolution & solution)IloSolution(IloEnv mem,const char * name=0)Method Summarypublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic IloBoolpublic voidpublic voidpublic voidpublic IloEnvpublic IloSolutionI *public IloNumpublic IloNumpublic const char *add(IloAnySetVarArray a) constadd(IloAnySetVar var) constadd(IloAnyVarArray a) constadd(IloAnyVar var) constadd(IloNumVarArray a) constadd(IloNumVar var) constadd(IloObjective objective) constcontains(IloExtractable extr) constcopy(IloExtractable extr,IloSolution solution)constcopy(IloSolution solution) constend()getEnv() constgetImpl() constgetMax(IloNumVar var) constgetMin(IloNumVar var) constgetName() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 281


IloSolutionpublic IloAnypublic IloObjectivepublic IloNumpublic IloNumVarpublic IloAnySetpublic IloAnySetpublic IloAnypublic IloNumpublic IloNumpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic IloSolutionpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidgetObject() constgetObjective() constgetObjectiveValue() constgetObjectiveVar() constgetPossibleSet(IloAnySetVar var) constgetRequiredSet(IloAnySetVar var) constgetValue(IloAnyVar var) constgetValue(IloNumVar var) constgetValue(IloObjective obj) constisBetterThan(IloSolution solution) constisBound(IloAnySetVar var) constisBound(IloNumVar var) constisEquivalent(IloExtractable extr,IloSolutionsolution) constisEquivalent(IloSolution solution) constisFixed(IloIntVar var) constisObjectiveSet() constisRestorable(IloExtractable extr) constisWorseThan(IloSolution solution) constmakeClone(IloEnv env) constoperator=(const IloSolution & solution)remove(IloExtractableArray extr) constremove(IloExtractable extr) constrestore(IloExtractable extr,IloAlgorithmalgorithm) constrestore(IloAlgorithm algorithm) constsetFalse(IloBoolVar var) constsetMax(IloNumVar var,IloNum max) constsetMin(IloNumVar var,IloNum min) constsetName(const char * name) constsetNonRestorable(IloExtractableArray array)constsetNonRestorable(IloExtractable extr) constsetObject(IloAny obj) constsetObjective(IloObjective objective) constsetPossibleSet(IloAnySetVar var,IloAnySetpossible) constsetRequiredSet(IloAnySetVar var,IloAnySetrequired) constsetRestorable(IloExtractableArray array)constsetRestorable(IloExtractable ex) constsetTrue(IloBoolVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 282


IloSolutionpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidsetValue(IloAnyVar var,IloAny value) constsetValue(IloNumVar var,IloNum value) constsetValue(IloObjective objective,IloNum value)conststore(IloExtractable extr,IloAlgorithmalgorithm) conststore(IloAlgorithm algorithm) constunsetObjective() constInner ClassIloSolution::IloSolution::IteratorIt allows you to traverse the variables in asolution.DescriptionInstances of this class store solutions to problems. The fundamental property ofIloSolution is its ability to transfer stored values from or to the active objectsassociated with it. In particular, the member function store stores the values fromalgorithm variables while the member function restore instantiates the actualvariables with stored values. Variables in the solution may be selectively restored. Thisclass also offers member functions to copy and to compare solutions.Information about these classes of variables can be stored in an instance ofIloSolution:◆◆◆◆◆◆IloAnySet: the required and possible sets are stored; when the variable is bound,the required and possible sets are equivalent.IloAnyVar: the value of the variable is stored.IloBoolVar: the value (true or false) of the variable is stored. Some of themember functions for IloBoolVar are covered by the member function forIloNumVar,asIloBoolVar is a subclass of IloNumVar. For example, there isno explicit member function to add objects of type IloBoolVar.IloIntSetVar: the required and possible sets are stored; when the variable isbound, the required and possible sets are equivalent.IloNumVar: the lower and upper bounds are stored; when the variable is bound,the current lower and upper bound are equivalent.IloObjective: the value of the objective is stored. Objectives are never restored;operations such as setRestorable cannot change this. More than one instance ofIloObjective can be added to a solution,. In such cases, there is the idea of anactive objective, which is returned by IloSolution::getObjective. The<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 283


IloSolutionactive objective typically specifies the optimization criterion for the problem towhich the solution object is a solution. For example, the <strong>ILOG</strong> Solver classIloImprove uses the idea of an active objective.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.Objects of type IloSolution have a scope, comprising the set of variables that havetheir values stored in the solution. The scope is given before the basic operations ofstoring and restoring are performed, via add and remove methods. For example,IloNumVar var(env);IloSolution soln(env);solution.add(var);creates a numeric variable and a solution and adds the variable to the solution. Arraysof variables can also be added to the solution. For example,IloNumVarArray arr(env, 10, 0, 1);soln.add(arr);adds 10 variables with range [0...1]. When an array of variables is added to thesolution, the array object itself is not present in the scope of the solution; only theelements are present. If the solution is then stored by means ofsoln.store(algorithm), the values of variable var and arr[0] to arr[9]are saved. Any attempt to add a variable that is already present in a solution throws anexception, an instance of IloException.Accessors allow access to the stored values of the variables, regardless of the state (orexistence) of the algorithm they were stored from. For example,cout


IloSolutionremoves var from the scope of the solution; andsoln.remove(arr);removes arr[0] to arr[9] from the solution.Any attempt to remove a variable that is not present in the solution throws an instance ofIloException.See Also the classes IloStoreSolution and IloRestoreSolution in the<strong>ILOG</strong> Solver <strong>Reference</strong> <strong>Manual</strong>.See AlsoConstructorsIloAnySetVar, IloAnyVar, IloNumVar, IloIntSetVar, IloObjectivepublic IloSolution()This constructor creates a solution whose implementation pointer is 0 (zero). The handlemust be assigned before its methods can be used.public IloSolution(IloSolutionI * impl)This constructor creates a handle object (an instance of the class IloSolution) froma pointer to an implementation object (an instance of the class IloSolutionI).public IloSolution(const IloSolution & solution)This constructor creates a handle object from a reference to a solution. After execution,both the newly constructed handle and solution point to the same implementationobject.public IloSolution(IloEnv mem,const char * name=0)This constructor creates an instance of the IloSolution class. The optional argumentname, if supplied, becomes the name of the created object.Methodspublic void add(IloAnySetVarArray a) constThis member function adds each element of array to the invoking solution.public void add(IloAnySetVar var) constThis member function adds the set variable var to the invoking solution.public void add(IloAnyVarArray a) constThis member function adds each element of array to the invoking solution.public void add(IloAnyVar var) constThis member function adds the variable var to the invoking solution.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 285


IloSolutionpublic void add(IloNumVarArray a) constThis member function adds each element of array to the invoking solution.public void add(IloNumVar var) constThis member function adds the variable var to the invoking solution.public void add(IloObjective objective) constThis member function adds objective to the invoking solution. If the solution has noactive objective, then objective becomes the active objective. Otherwise, the activeobjective remains unchanged.public IloBool contains(IloExtractable extr) constThis member function returns IloTrue if extr is present in the invoking object.Otherwise, it returns IloFalse.public void copy(IloExtractable extr,IloSolution solution) constThis member function copies the saved value of extr from solution to the invokingsolution. If extr does not exist in either solution or the invoking object, thismember function throws an instance of IloException. The restorable status ofextr is not copied.public void copy(IloSolution solution) constFor each variable that has been added to solution, this member function copies itssaved data to the invoking solution. If a particular extractable does not already exist inthe invoking solution, it is automatically added first. If variables were added to theinvoking solution, their restorable status is the same as in solution. Otherwise, theirstatus remains unchanged in the invoking solution.public void end()This member function deallocates the memory used to store the solution. If you nolonger need a solution, calling this member function can reduce memory consumption.public IloEnv getEnv() constThis member function returns the environment specified when the invoking object wasconstructed.public IloSolutionI * getImpl() constThis member function returns a pointer to the implementation object corresponding tothe invoking solution.public IloNum getMax(IloNumVar var) constThis member function returns the maximal value of the variable var in the invokingsolution.public IloNum getMin(IloNumVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 286


IloSolutionThis member function returns the minimal value of the variable var in the invokingsolution.public const char * getName() constThis member function returns a character string specifying the name of the invokingobject (if there is one).public IloAny getObject() constThis member function returns the object associated with the invoking object (if there isone). Normally, an associated object contains user data pertinent to the invoking object.public IloObjective getObjective() constThis member function returns the active objective as set via a previous call to add orsetObjective(IloObjective). If there is no active objective, an empty handleis returned.public IloNum getObjectiveValue() constThis member function returns the saved value of the current active objective. It can beseen as performing the action getValue(getObjective()).public IloNumVar getObjectiveVar() constIf the active objective corresponds to a simple IloNumVar, this member functionreturns that variable. If there is no active objective or if the objective is not a simplevariable, an empty handle is returned.public IloAnySet getPossibleSet(IloAnySetVar var) constThis member function returns the set of possible values for the variable var, as stored inthe invoking solution.public IloAnySet getRequiredSet(IloAnySetVar var) constThis member function returns the set of required values for the variable var, as storedin the invoking solution.public IloAny getValue(IloAnyVar var) constThis member function returns the value of the variable var in the invoking solution.public IloNum getValue(IloNumVar var) constThis member function returns the value of the variable var in the invoking solution. Ifthe saved minimum and maximum of the variable are not equal, this member functionthrows an instance of IloException.public IloNum getValue(IloObjective obj) constThis member function returns the saved value of objective objective in the invokingsolution.public IloBool isBetterThan(IloSolution solution) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 287


IloSolutionThis member function returns IloTrue if the invoking solution and solution havethe same objective and if the invoking solution has a strictly higher quality objectivevalue (according to the sense of the objective). In all other situations, it returnsIloFalse.public IloBool isBound(IloAnySetVar var) constThe method isBound has been deprecated. Consider the method isFixed instead.This member function returns IloTrue if the stored required and possible sets for theset variable var are equal in the invoking solution. Otherwise, it returns IloFalse.See AlsoisFixedpublic IloBool isBound(IloNumVar var) constThe method isBound has been deprecated. Consider the method isFixed instead.This member function returns IloTrue if var takes a single value in the invokingsolution. Otherwise, it returns IloFalse.See AlsoisFixedpublic IloBool isEquivalent(IloExtractable extr,IloSolution solution) constThis member function returns IloTrue if the saved value of extr is the same in theinvoking solution and solution. Otherwise, it returns IloFalse. If extr does notexist in either solution or the invoking object, the member function throws aninstance of IloException.public IloBool isEquivalent(IloSolution solution) constThis member function returns IloTrue if the invoking object and solution containthe same variables with the same saved values. Otherwise, it returns IloFalse.public IloBool isFixed(IloIntVar var) constThis member function returns IloTrue if var takes a single value in the invokingsolution. Otherwise, it returns IloFalse.public IloBool isObjectiveSet() constThis member function returns IloTrue if the invoking solution has an active objective.Otherwise, it returns IloFalse.public IloBool isRestorable(IloExtractable extr) constThis member function returns IloFalse if setNonRestorable(extr) wascalled more recently than setRestorable(extr). Otherwise, it returns IloTrue.This member function always returns IloFalse when it is passed anIloObjective object.public IloBool isWorseThan(IloSolution solution) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 288


IloSolutionThis member function returns IloTrue if the invoking solution and solution havethe same objective and if the invoking solution has a strictly lower quality objectivevalue (according to the sense of the objective). In all other situations, it returnsIloFalse.public IloSolution makeClone(IloEnv env) constThis member function allocates a new solution on env and adds to it all variables thatwere added to the invoking object. The “restorable” status of all variables in the clone isthe same as that in the invoking solution. Likewise, the active objective in the clone isthe same as that in the invoking solution. The newly created solution is returned.public void operator=(const IloSolution & solution)This operator assigns an address to the handle pointer of the invoking solution. Thataddress is the location of the implementation object of solution. After the executionof this operator, the invoking solution and solution both point to the sameimplementation object.public void remove(IloExtractableArray extr) constThis member function removes each element of array from the invoking solution. Ifthe invoking solution does not contain all elements of array, the member functionthrows an instance of IloException.public void remove(IloExtractable extr) constThis member function removes extractable extr from the invoking solution. If theinvoking solution does not contain extr, the member function throws an instance ofIloException.public void restore(IloExtractable extr,IloAlgorithm algorithm) constThis member function restores the value of the extractable corresponding to extr byreference to algorithm. The use of this member function depends on the state ofalgorithm. If algorithm is an instance of the <strong>ILOG</strong> Solver class IloSolver,this member function can only be used during search. If extr does not exist in theinvoking solution, the member function throws an instance of IloException.public void restore(IloAlgorithm algorithm) constThis member function uses algorithm to instantiate the variables in the invokingsolution with their saved values. The value of any objective added to the solution is notrestored. The use of this member function depends on the state of algorithm. Ifalgorithm is an instance of the <strong>ILOG</strong> Solver class IloSolver, this memberfunction can only be used during search.public void setFalse(IloBoolVar var) constThis member function sets the stored value of var to IloFalse in the invokingsolution.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 289


IloSolutionpublic void setMax(IloNumVar var,IloNum max) constThis member function sets the maximal value of the variable var in the invokingsolution to max.public void setMin(IloNumVar var,IloNum min) constThis member function sets the minimal value of the variable var in the invokingsolution to min.public void setName(const char * name) constThis member function assigns name to the invoking object.public void setNonRestorable(IloExtractableArray array) constThis member function specifies to the invoking solution that when the solution isrestored by means of restore(IloAlgorithm) orrestore(IloExtractable, IloAlgorithm), no elements of array will berestored. When an array of variables is added to a solution, each variable is added in a“restorable” state.public void setNonRestorable(IloExtractable extr) constThis member function specifies to the invoking solution that when the solution isrestored by means of restore(IloAlgorithm) orrestore(IloExtractable, IloAlgorithm), extr will not be restored.When a variable is added to a solution, it is added in a “restorable” state.public void setObject(IloAny obj) constThis member function associates obj with the invoking object. The member functiongetObject accesses this associated object afterward. Normally, obj contains userdata pertinent to the invoking object.public void setObjective(IloObjective objective) constThis member function adds objective to the invoking solution, if it is not alreadypresent, and sets the active objective to objective.public void setPossibleSet(IloAnySetVar var,IloAnySet possible) constThis member function sets the stored possible values for var as possible in theinvoking solution.public void setRequiredSet(IloAnySetVar var,IloAnySet required) constThis member function sets the stored required values for var as required in theinvoking solution.public void setRestorable(IloExtractableArray array) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 290


IloSolutionThis member function specifies to the invoking solution that when the solution isrestored by means of restore(IloAlgorithm) orrestore(IloExtractable, IloAlgorithm), the appropriate element(s) ofarray will be restored. When an array of variables is added to a solution, eachvariable is added in a “restorable” state. This call has no effect on objects of typeIloObjective; objects of this type are never restored.public void setRestorable(IloExtractable ex) constThis member function specifies to the invoking solution that when the solution isrestored by means of restore(IloAlgorithm) orrestore(IloExtractable, IloAlgorithm), extr will be restored. Whena variable is added to a solution, it is added in a “restorable” state. This call has noeffect on objects of type IloObjective; objects of that type are never restored.public void setTrue(IloBoolVar var) constThis member function sets the stored value of var to IloTrue in the invokingsolution.public void setValue(IloAnyVar var,IloAny value) constThis member function sets the value of the variable var to value in the invokingsolution.public void setValue(IloNumVar var,IloNum value) constThis member function sets the value (both minimum and maximum) of the variable varto value in the invoking solution.public void setValue(IloObjective objective,IloNum value) constThis member function sets the value of objective as stored in the invoking solutionto value. This member function should be used with care and only when the objectivevalue of the solution is known exactly.public void store(IloExtractable extr,IloAlgorithm algorithm) constThis member function stores the value of the extractable corresponding to extr byreference to algorithm. If extr does not exist in the invoking solution, the memberfunction throws an instance of IloException.public void store(IloAlgorithm algorithm) constThis member function stores the values of the objects added to the solution by referenceto algorithm.public void unsetObjective() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 291


IloSolutionThis member function asserts that there should be no active objective in the invokingsolution, although the previous active object is still present. A new active objective canbe set via add or setObjective.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 292


IloSolutionArrayIloSolutionArrayCategoryDefinition FileSynopsisType Definitionilconcert/ilosolution.hIloSimpleArray< IloSolution > IloSolutionArraySummary This type definition represents arrays of instances of IloSolution.DescriptionSee AlsoThis type definition represents arrays of instances of IloSolution.Instances of IloSolutionArray are extensible. That is, you can add more elementsto such an array. <strong>Reference</strong>s to an array change whenever an element is added orremoved from the array.IloSolution<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 293


IloSolutionIteratorIloSolutionIteratorCategoryClassInheritancePathDefinition Fileilconcert/ilosolution.hSummary This template class creates a typed iterator over solutions.Constructor Summarypublic IloSolutionIterator(IloSolution s)Method Summarypublic Epublic voidoperator *() constoperator++()DescriptionThis template class creates a typed iterator over solutions. You can use this iterator todiscover all extractable objects added to a solution and of a particular type. The type isdenoted by E in the template.This iterator is not robust. If the variable at the current position is deleted from thesolution being iterated over, the behavior of this iterator afterward is undefined.An iterator created with this template differs from an instance ofIloSolution::Iterator. An instance of IloSolution::Iterator workson all extractable objects within a given solution (an instance of IloSolution). Incontrast, an iterator created with this template only iterates over extractable objects ofthe specified type.See AlsoIloSolution, IloSolution::IteratorConstructors public IloSolutionIterator(IloSolution s)This constructor creates an iterator for instances of the class E.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 294


IloSolutionIteratorMethodspublic E operator *() constThis operator returns the current element, the one to which the invoking iterator points.This current element is a handle to an extractable object (not a pointer to theimplementation object).public void operator++()This operator advances the iterator by one position.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 295


IloSolution::IteratorIloSolution::IteratorCategoryInner ClassInheritancePathDefinition Fileilconcert/ilosolution.hSummary It allows you to traverse the variables in a solution.Constructor SummarypublicIterator(IloSolution solution)Method Summarypublic IloBoolpublic IloExtractablepublic Iterator &ok() constoperator *() constoperator++()DescriptionIterator is a class nested in the class IloSolution. It allows you to traverse thevariables in a solution. The iterator scans the objects in the same order as they wereadded to the solution.This iterator is not robust. If the variable at the current position is deleted from thesolution being iterated over, the behavior of this iterator afterward is undefined.◆iter can be safely used after the following code has executed:IloExtractable elem = *iter;++iter;solution.remove(elem);◆iter cannot be safely used after the following code has executed:solution.remove(*iter); // bad idea++iter;<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 296


IloSolution::IteratorSee AlsoConstructorsMethodsIloIterator, IloSolutionpublic Iterator(IloSolution solution)This constructor creates an iterator to traverse the variables of solution. The iteratortraverses variables in the same order they were added to solution.public IloBool ok() constThis member function returns IloTrue if the current position of the iterator is a validone. It returns IloFalse if all variables have been scanned by the iterator.public IloExtractable operator *() constThis operator returns the extractable object corresponding to the variable located at thecurrent iterator position. If all variables have been scanned, this operator returns anempty handle.public Iterator & operator++()This operator moves the iterator to the next variable in the solution.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 297


IloSolutionManipIloSolutionManipCategoryClassInheritancePathDefinition Fileilconcert/ilosolution.hSummary An instance of this class accesses a specific part of a solution.Constructor SummarypublicIloSolutionManip(IloSolutionsolution,IloExtractable extr)DescriptionSee AlsoConstructorsAn instance of this class accesses a specific part of a solution so that you can display it.You construct the class IloSolutionManip from a solution and an extractableobject. You use the operator


IloSquareIloSquareCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloNumExprArg IloSquare(const IloNumExprArg arg)public IloNum IloSquare(IloNum val)public IloInt IloSquare(IloInt val)public IloInt IloSquare(int val)public IloIntExprArg IloSquare(const IloIntExprArg arg)Summary Returns the square of its argument.DescriptionConcert Technology offers predefined functions that return an expression from analgebraic function over expressions. These predefined functions also return a numericvalue from an algebraic function over numeric values as well.IloSquare returns the square of its argument (that is, val*val or expr*expr).What Is ExtractedIloSquare is extracted by an instance of IloCplex as a quadratic term. If thequadratic term is positive semi-definite, it may appear in an objective function orconstraint.IloSquare is extracted by an instance of IloCP or IloSolver as an instance ofIlcSquare.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 299


IloSumIloSumCategoryDefinition FileSynopsisGlobal Functionilconcert/iloexpression.hpublic IloNumExprArg IloSum(const IloNumExprArray exprs)public IloIntExprArg IloSum(const IloIntExprArray exprs)public IloNum IloSum(const IloNumArray values)public IloInt IloSum(const IloIntArray values)Summary For constraint programming: returns a numeric value representing the sum of numericvalues.DescriptionThese functions return a numeric value representing the sum of numeric values in thearray vals, or an instance of IloNumExprArg, the internal building block of anexpression, representing the sum of the variables in the arrays exprs or values.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 300


IloThreeHalfPiIloThreeHalfPiCategorySynopsisMacroIloThreeHalfPi()Summary Three half-pi.DescriptionConcert Technology predefines conventional trigonometric constants to conform toIEEE 754 standards for quarter pi, half pi, pi, three-halves pi, and two pi.extern const IloNum IloThreeHalfPi; // = 4.71238898038468985769<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 301


IloTimerIloTimerCategoryClassInheritancePathDefinition Fileilconcert/iloenv.hSummary Represents a timer.Constructor SummarypublicIloTimer(const IloEnv env)Method Summarypublic IloEnvpublic IloNumpublic voidpublic IloNumpublic IloNumpublic IloNumgetEnv() constgetTime() constreset()restart()start()stop()DescriptionSee AlsoConstructorsAn instance of IloTimer represents a timer in a Concert Technology model. It workslike a stop watch. The timer report the CPU time. On multi threaded environment, wesummed the CPU time used by each thread.IloEnvpublic IloTimer(const IloEnv env)This constructor creates a timer.Methodspublic IloEnv getEnv() constThis member function returns the environment in which the invoking timer wasconstructed.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 302


IloTimerpublic IloNum getTime() constThis member function returns the accumulated time, in seconds, since one of theseconditions:◆◆◆the first call of the member function start after construction of the invoking timer;the most recent call to the member function restart;a call to reset.public void reset()This member function sets the elapsed time of the invoking timer to 0.0. It also stops theclock.public IloNum restart()This member function returns the accumulated time, resets the invoking timer to 0.0,and starts the timer again. In other words, the member function restart is equivalentto the member function reset followed by start.public IloNum start()This member function makes the invoking timer resume accumulating time. It returnsthe time accumulated so far.public IloNum stop()This member function stops the invoking timer so that it no longer accumulates time.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 303


IloTwoPiIloTwoPiCategorySynopsisMacroIloTwoPi()Summary Two pi.DescriptionConcert Technology predefines conventional trigonometric constants to conform toIEEE 754 standards for quarter pi, half pi, pi, three-halves pi, and two pi.extern const IloNum IloTwoPi; // = 6.28318530717958647692<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 304


operator &&operator &&CategoryDefinition FileSynopsisGlobal Functionilconcert/ilomodel.hpublic IloAnd operator &&(const IloConstraint constraint1,const IloConstraint constraint2)Summary Overloaded <strong>C++</strong> operator for conjunctive constraints.DescriptionThis overloaded <strong>C++</strong> operator creates a conjunctive constraint that represents theconjunction of its two arguments. The constraint can represent a conjunction of twoconstraints; of a constraint and another conjunction; or of two conjunctions. In order tobe taken into account, this constraint must be added to a model and extracted by analgorithm, such as IloCplex or IloSolver.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 305


operator *operator *CategoryDefinition FileGlobal Functionilconcert/iloexpression.hSynopsis public IloNumLinExprTerm operator *(const IloNumVar x,IloInt num)public IloNumLinExprTerm operator *(IloInt num,const IloNumVar x)public IloNumLinExprTerm operator *(const IloIntVar x,IloNum num)public IloNumLinExprTerm operator *(IloNum num,const IloIntVar x)public IloIntLinExprTerm operator *(const IloIntVar x,IloInt num)public IloNumExprArg operator *(const IloNumExprArg x,const IloNumExprArg y)public IloNumExprArg operator *(const IloNumExprArg x,IloNum y)public IloNumExprArg operator *(IloNum x,const IloNumExprArg y)public IloIntExprArg operator *(const IloIntExprArg x,const IloIntExprArg y)public IloIntExprArg operator *(const IloIntExprArg x,IloInt y)Summary Returns an expression equal to the product of its arguments.DescriptionThis overloaded <strong>C++</strong> operator returns an expression equal to the product of itsarguments. Its arguments may be numeric values, numeric variables, or otherexpressions.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 306


operator newoperator newCategoryDefinition FileSynopsisGlobal Functionilconcert/iloenv.hpublic void * operator new(size_t sz,const IloEnv & env)Summary Overloaded <strong>C++</strong> new operator.Description<strong>ILOG</strong> Concert Technology offers this overloaded <strong>C++</strong> new operator. This operator isoverloaded to allocate data on internal data structures associated with an invokingenvironment (an instance of IloEnv). The memory used by objects allocated with thisoverloaded operator is automatically reclaimed when you call the member functionIloEnv::end. As a developer, you must not delete objects allocated with thisoperator because of this automatic freeing of memory.In other words, you must not use the delete operator for objects allocated with thisoverloaded new operator.The use of this overloaded new operator is not obligatory in Concert Technologyapplications. You will see examples of its use in the user's manuals that accompany the<strong>ILOG</strong> optimization products.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 307


operator!operator!CategoryDefinition FileSynopsisGlobal Functionilconcert/ilomodel.hpublic IloConstraint operator!(const IloConstraint constraint)Summary Overloaded <strong>C++</strong> operator for negation.DescriptionThis overloaded <strong>C++</strong> operator returns a constraint that is the negation of its argument.In order to be taken into account, this constraint must be added to a model and extractedby an algorithm, such as IloCplex or IloSolver.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 308


operator!=operator!=CategoryDefinition FileSynopsisGlobal Functionilconcert/iloany.hpublic IloConstraint operator!=(const IloAnyVar var1,const IloAnyVar var2)public IloConstraint operator!=(const IloAnyVar var1,IloAny val)public IloConstraint operator!=(IloAny val,const IloAnyVar var1)public IloConstraint operator!=(const IloAnySetVar var1,const IloAnySetVar var2)public IloConstraint operator!=(const IloAnySetVar var1,const IloAnySet set)public IloConstraint operator!=(const IloAnySet set,const IloAnySetVar var1)public IloDiff operator!=(IloNumExprArg arg1,IloNumExprArg arg2)public IloDiff operator!=(IloNumExprArg arg,IloNum val)public IloDiff operator!=(IloNum val,IloNumExprArg arg)public IloConstraint operator!=(const IloIntSetVar var1,const IloIntSetVar var2)public IloConstraint operator!=(const IloIntSetVar var,const IloIntSet set)public IloConstraint operator!=(const IloIntSet set,const IloIntSetVar var)Summary overloaded <strong>C++</strong> operator.DescriptionThis overloaded <strong>C++</strong> operator constrains its two arguments to be unequal (that is,different from each other). In order to be taken into account, this constraint must beadded to a model and extracted for an algorithm.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 309


operator%operator%CategoryDefinition FileGlobal Functionilconcert/iloexpression.hSynopsis public IloIntExprArg operator%(const IloIntExprArg x,IloInt y)Summary Returns an expression equal to the modulo of its arguments.DescriptionThis operator returns an instance of IloIntExprArg, the internal building block ofan expression, representing the modulo of the expression x and the integer value y.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 310


operator%operator%CategoryDefinition FileGlobal Functionilconcert/iloexpression.hSynopsis public IloIntExprArg operator%(IloInt x,const IloIntExprArg y)Summary Returns an expression equal to the modulo of its arguments.DescriptionThis operator returns an instance of IloIntExprArg, the internal building block ofan expression, representing the modulo of the integer value x and the expression y.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 311


operator+operator+CategoryDefinition FileGlobal Functionilconcert/iloexpression.hSynopsis public IloNumExprArg operator+(const IloNumExprArg x,const IloNumExprArg y)public IloNumExprArg operator+(const IloNumExprArg x,IloNum y)public IloNumExprArg operator+(IloNum x,const IloNumExprArg y)public IloIntExprArg operator+(const IloIntExprArg x,const IloIntExprArg y)public IloIntExprArg operator+(const IloIntExprArg x,IloInt y)public IloIntExprArg operator+(IloInt x,const IloIntExprArg y)Summary Returns an expression equal to the sum of its arguments.DescriptionThis overloaded <strong>C++</strong> operator returns an expression equal to the sum of its arguments.Its arguments may be numeric values, numeric variables, or other expressions.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 312


operator-operator-CategoryDefinition FileGlobal Functionilconcert/iloexpression.hSynopsis public IloNumExprArg operator-(const IloNumExprArg x,const IloNumExprArg y)public IloNumExprArg operator-(const IloNumExprArg x,IloNum y)public IloNumExprArg operator-(IloNum x,const IloNumExprArg y)public IloIntExprArg operator-(const IloIntExprArg x,const IloIntExprArg y)public IloIntExprArg operator-(const IloIntExprArg x,IloInt y)public IloIntExprArg operator-(IloInt x,const IloIntExprArg y)Summary Returns an expression equal to the difference of its arguments.DescriptionThis overloaded <strong>C++</strong> operator returns an expression equal to the difference of itsarguments. Its arguments may be numeric values, numeric variables, or otherexpressions.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 313


operator/operator/CategoryDefinition FileGlobal Functionilconcert/iloexpression.hSynopsis public IloNumExprArg operator/(const IloNumExprArg x,const IloNumExprArg y)public IloNumExprArg operator/(const IloNumExprArg x,IloNum y)public IloNumExprArg operator/(IloNum x,const IloNumExprArg y)Summary Returns an expression equal to the quotient of its arguments.DescriptionThis overloaded <strong>C++</strong> operator returns an expression equal to the quotient of itsarguments. Its arguments may be numeric values or numeric variables. For integerdivision, use IloDiv.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 314


operator


operator


operator


operator


operator==operator==CategoryDefinition FileSynopsisDescriptionGlobal Functionilconcert/iloany.hpublic IloConstraint operator==(const IloAnyVar var1,const IloAnyVar var2)public IloConstraint operator==(const IloAnyVar var1,IloAny val)public IloConstraint operator==(IloAny val,const IloAnyVar var1)public IloConstraint operator==(const IloAnySetVar var1,const IloAnySetVar var2)public IloConstraint operator==(const IloAnySetVar var1,const IloAnySet set)public IloConstraint operator==(const IloAnySet set,const IloAnySetVar var1)public IloConstraint operator==(const IloIntSetVar var1,const IloIntSetVar var2)public IloConstraint operator==(const IloIntSetVar var1,const IloIntSet set)public IloConstraint operator==(const IloIntSet set,const IloIntSetVar var)This overloaded <strong>C++</strong> operator constrains its two arguments to be equal. In order to betaken into account, this constraint must be added to a model and extracted for analgorithm.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 319


operator>operator>CategoryDefinition FileSynopsisGlobal Functionilconcert/ilolinear.hpublic IloConstraint operator>(IloNumExprArg base,IloNumExprArg base2)public IloConstraint operator>(IloNumExprArg base,IloNum val)public IloConstraint operator>(IloNum val,IloNumExprArg eb)public IloConstraint operator>(IloIntExprArg base,IloIntExprArg base2)public IloConstraint operator>(IloIntExprArg base,IloInt val)public IloConstraint operator>(IloInt val,IloIntExprArg eb)Summary overloaded <strong>C++</strong> operator.DescriptionThis overloaded <strong>C++</strong> operator constrains its first argument to be strictly greater than itssecond argument. In order to be taken into account, this constraint must be added to amodel and extracted for an algorithm.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 320


operator>=operator>=CategoryDefinition FileSynopsisGlobal Functionilconcert/ilolinear.hpublic IloConstraint operator>=(IloNumExprArg base,IloNumExprArg base2)public IloRange operator>=(IloNumExprArg expr,IloNum val)public IloRange operator>=(IloNum val,IloNumExprArg eb)Summary overloaded <strong>C++</strong> operator.DescriptionThis overloaded <strong>C++</strong> operator constrains its first argument to be greater than or equal toits second argument. In order to be taken into account, this constraint must be added to amodel and extracted for an algorithm.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 321


operator>>operator>>CategoryDefinition FileSynopsisGlobal Functionilconcert/iloenv.hpublic istream & operator>>(istream & in,IloNumArray & a)public istream & operator>>(istream & in,IloIntArray & a)Summary Overloaded <strong>C++</strong> operator redirects input.DescriptionThis overloaded <strong>C++</strong> operator directs input to an input stream.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 322


operator||operator||CategoryDefinition FileSynopsisGlobal Functionilconcert/ilomodel.hpublic IloOr operator||(const IloConstraint constraint1,const IloConstraint constraint2)Summary Overloaded <strong>C++</strong> operator for a disjunctive constraint.DescriptionThis overloaded <strong>C++</strong> operator creates a disjunctive constraint that represents thedisjunction of its two arguments. The constraint can represent a disjunction of twoconstraints; of a constraint and another disjunction; or of two disjunctions. In order tobe taken into account, this constraint must be added to a model and extracted by analgorithm, such as IloCplex or IloSolver.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 323


operator||Group optim.concert.cplexThe <strong>ILOG</strong> Concert <strong>API</strong> specific to <strong>CPLEX</strong>.Classes SummaryIloConversion For <strong>ILOG</strong> <strong>CPLEX</strong>: a means tochange the type of a numericvariable.IloNumColumn For <strong>ILOG</strong> <strong>CPLEX</strong>: helps you designa model through columnrepresentation.IloNumColumnArray For <strong>ILOG</strong> <strong>CPLEX</strong>: array class of thecolumn representation class for amodel.IloSOS1For <strong>ILOG</strong> <strong>CPLEX</strong>: represents specialordered sets of type 1 (SOS1).IloSOS1Array For <strong>ILOG</strong> <strong>CPLEX</strong>: the array class ofspecial ordered sets of type 1(SOS1).IloSOS2For <strong>ILOG</strong> <strong>CPLEX</strong>: represents specialordered sets of type 2 (SOS2).IloSOS2Array For <strong>ILOG</strong> <strong>CPLEX</strong>: the array class ofspecial ordered sets of type 2(SOS2).IloSemiContVar For <strong>ILOG</strong> <strong>CPLEX</strong>: instancerepresents a constrainedsemicontinuous variable.IloSemiContVarArray For <strong>ILOG</strong> <strong>CPLEX</strong>: is the array classof the semicontinuous numericvariable class for a model.DescriptionThis group contains <strong>ILOG</strong> Concert classes and functions specific to <strong>ILOG</strong> <strong>CPLEX</strong>.(Other classes and functions of <strong>CPLEX</strong> are available in the groupoptim.cplex.cpp.)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 324


IloConversionIloConversionCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary For <strong>ILOG</strong> <strong>CPLEX</strong>: a means to change the type of a numeric variable.Constructor SummarypublicpublicpublicpublicpublicIloConversion()IloConversion(IloConversionI * impl)IloConversion(const IloEnv env,constIloNumVar var,IloNumVar::Type t,const char *name=0)IloConversion(const IloEnv env,constIloNumVarArray vars,IloNumVar::Type t,constchar * name=0)IloConversion(const IloEnv env,constIloIntVarArray vars,IloNumVar::Type t,constchar * name=0)Method Summarypublic IloConversionI *getImpl() constInherited methods from IloExtractable<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 325


IloConversionIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionAn instance of this class offers you a means to change the type of a numeric variable.For example, in a model (an instance of IloModel) extracted for an algorithm (such asan instance of the class IloCplex), you may want to convert the type of a givennumeric variable (an instance of IloNumVar) from ILOFLOAT to ILOINT or toILOBOOL (or from IloNumVar::Float to IloNumVar::Int or toIloNumVar::Bool). Such a change is known as a conversion.After you create a conversion, you must explicitly add it to the model in order for it to betaken into account. To do so, use the member function IloModel::add or thetemplate IloAdd. Then extract the model for an algorithm (such as an instance ofIloCplex) with the member function extract.Multiple Type Conversions of the Same VariableYou can convert the type of a numeric variable in a model. To do so, create an instanceof IloConversion and add it to the model. You can also convert the type of anumeric variable after the model has been extracted for an algorithm (such as aninstance of IloCplex, documented in the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong> <strong>Manual</strong>).An instance of IloCplex will not accept more than one type conversion of the samevariable. That is, you can change the type once, but not twice, in a single instance ofIloCplex. Attempts to convert the type of the same variable more than once willthrow the exception IloCplex::MultipleConversionException,documented in the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong> <strong>Manual</strong>.In situations where you want to change the type of a numeric variable more than once(for example, from Boolean to integer to floating-point), there are these possibilities:◆◆You can remove a prior conversion of a given variable in a given model. To do so,use its member function IloExtractable::end to delete it and optionally add anew conversion.You can apply different conversions to a given variable in more than one model, likethis:IloNumVar x(env, 0, 10, ILOBOOL);IloRange rng = (x


IloConversionIloModel mdl1(env);mdl1.add(rng);mdl1.add(IloConversion(env, x, ILOINT));IloCplex cplex1(mdl1);IloModel mdl2(env);mdl2.add(rng);mdl2.add(IloConversion(env, x, ILOFLOAT));IloCplex cplex2(mdl2);Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.See Also the class IloCplex in the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong> <strong>Manual</strong>.See AlsoConstructorsIloModelpublic IloConversion()This constructor creates an empty handle. You must initialize it before you use it.public IloConversion(IloConversionI * impl)This constructor creates a handle object from a pointer to an implementation object.public IloConversion(const IloEnv env,const IloNumVar var,IloNumVar::Type t,const char * name=0)This constructor accepts a numeric variable and a type; it creates a handle to a typeconversion to change the type of the variable var to the type specified by t. You mayuse the argument name to name the type conversion so that you can refer to it by astring identifier.public IloConversion(const IloEnv env,const IloNumVarArray vars,IloNumVar::Type t,const char * name=0)This constructor accepts an array of numeric variables and a type; it creates a handle to atype conversion to change the type of each variable in the array vars to the typespecified by t. You may use the argument name to name the type conversion so thatyou can refer to it by a string identifier.public IloConversion(const IloEnv env,const IloIntVarArray vars,IloNumVar::Type t,const char * name=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 327


IloConversionThis constructor accepts an array of integer variables and a type; it creates a handle to atype conversion to change the type of each variable in the array vars to the typespecified by t. You may use the argument name to name the type conversion so thatyou can refer to it by a string identifier.Methodspublic IloConversionI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 328


IloNumColumnIloNumColumnCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary For <strong>ILOG</strong> <strong>CPLEX</strong>: helps you design a model through column representation.Constructor SummarypublicpublicIloNumColumn(const IloEnv env)IloNumColumn(const IloAddNumVar & var)Method Summarypublic voidpublicpublic IloNumColumn &public IloNumColumn &public IloNumColumn &clear() constoperator const IloAddNumVar &() constoperator+=(const IloAddValueToRange & rhs)operator+=(const IloAddNumVar & rhs)operator+=(const IloNumColumn & rhs)DescriptionAn instance of this class helps you design a model through column representation. Inother words, you can create a model by defining each of its columns as an instance ofthis class. In particular, an instance of IloNumColumn enables you to build a columnfor a numeric variable (an instance of IloNumVar) with information about theextractable objects (such as objectives, constraints, etc.) where that numeric variablemay eventually appear, even if the numeric variable has not yet been created.Usually you populate a column (an instance of this class) with objects returned by theoperator() of the class (such as operator()) where you want to install the newlycreated variable, as in the examples below.An instance of IloNumColumn keeps a list of those objects returned byoperator(). In other words, an instance of IloNumColumn knows the extractableobjects where a numeric variable will be added when it is created.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 329


IloNumColumnWhen you create a new instance of IloNumVar with an instance of IloNumColumnas an argument, then Concert Technology adds the newly created numeric variable to allthe extractable objects (such as constraints, ranges, objectives, etc.) for which aninstance of IloAddNumVar will be added to this instance of IloNumColumn. Notethat IloNumColumn does not support normalization, as normalization is not welldefined for constraints such as IloSOS1 and IloAllDiff.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.For information on columnwise modeling, see the concept Column-Wise Modeling.See AlsoConstructorsIloNumVar, IloObjective, IloRangepublic IloNumColumn(const IloEnv env)This constructor creates an empty column in the environment env.public IloNumColumn(const IloAddNumVar & var)This constructor creates a column and adds var to it.Methodspublic void clear() constThis member function removes (from the invoking column) its list of extractableobjects.public operator const IloAddNumVar &() constThis casting operator allows you to use instances of IloNumColumn in columnexpressions. It accepts an extractable object, such as an objective (an instance ofIloObjective) or a constraint (an instance of IloConstraint). It returns theobject derived from IloAddNumVar and needed to represent the extractable object incolumn format.public IloNumColumn & operator+=(const IloAddValueToRange & rhs)This operator adds the appropriate instances of IloAddValueToRange for therighthand side rhs to the invoking column.Examples:To use an instance of this class to create a column with a coefficient of 2 in theobjective, with 10 in range1, and with 3 in range2, set:IloNumColumn col = obj(2) + range1(10) + range2(3);<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 330


IloNumColumnTo use an instance of this class to create a numeric variable corresponding to the columnwith lower bound 0 (zero) and upper bound 10:IloNumVar var(env, col, 0, 10);Another example:IloNumColumn col1(env);IloNumColumn col2 = rng7(3.1415);col1 += obj(1.0);col1 += rng(-12.0);col2 += rng2(13.7) + rng3(14.7);col2 += col1;public IloNumColumn & operator+=(const IloAddNumVar & rhs)This operator adds the appropriate instances of IloAddNumVar for the righthand siderhs to the invoking column.public IloNumColumn & operator+=(const IloNumColumn & rhs)This operator assigns the righthand side rhs to the invoking column.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 331


IloNumColumnArrayIloNumColumnArrayCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary For <strong>ILOG</strong> <strong>CPLEX</strong>: array class of the column representation class for a model.Constructor SummarypublicpublicIloNumColumnArray(IloDefaultArrayI * i=0)IloNumColumnArray(const IloEnv env,IloIntn=0)public IloNumColumnArray(const IloNumColumnArray & h)DescriptionFor each basic type, Concert Technology defines a corresponding array class.IloNumColumnArray is the array class of the column representation class for amodel. The implementation class for IloNumColumnArray is the undocumentedclass IloNumColumnArrayI.Instances of IloNumColumnArray are extensible. That is, you can add moreelements to such an array. <strong>Reference</strong>s to an array change whenever an element is addedor removed from the array.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.See AlsoConstructorsIloModel, IloNumColumnpublic IloNumColumnArray(IloDefaultArrayI * i=0)This constructor creates an empty extensible array of columns. You cannot createinstances of the undocumented class IloDefaultArrayI. As an argument in thisdefault constructor, it allows you to pass 0 (zero) as a value to an optional argument infunctions and member functions that accept an array as an argument.public IloNumColumnArray(const IloEnv env,IloInt n=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 332


IloNumColumnArrayThis constructor creates an array of n elements. Initially, the n elements are emptyhandles.public IloNumColumnArray(const IloNumColumnArray & h)This copy constructor creates a handle to the array of column objects specified by copy.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 333


IloSOS1IloSOS1CategoryClassInheritancePathDefinition Fileilconcert/ilolinear.hSummary For <strong>ILOG</strong> <strong>CPLEX</strong>: represents special ordered sets of type 1 (SOS1).Constructor SummarypublicpublicpublicpublicpublicIloSOS1()IloSOS1(IloSOS1I * impl)IloSOS1(const IloEnv env,const char * name=0)IloSOS1(const IloEnv env,const IloNumVarArrayvars,const char * name=0)IloSOS1(const IloEnv env,const IloNumVarArrayvars,const IloNumArray vals,const char *name=0)Method Summarypublic IloSOS1I *public voidpublic voidgetImpl() constgetNumVars(IloNumVarArray variables) constgetValues(IloNumArray values) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 334


IloSOS1Inherited methods from IloConstraintIloConstraint::getImplInherited methods from IloIntExprArgIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionThis handle class represents special ordered sets of type 1 (SOS1). A special ordered setof type 1 specifies a set of variables, and only one among them may take a non zerovalue. You may assign a weight to each variable in an SOS1. This weight specifies anorder among the variables. If you do not assign any weights to enforce order among thevariables, then Concert Technology considers the order in which you gave the variablesto the constructor of this set and the order in which you added variables later.When you extract a model (an instance of IloModel) for an instance of IloCplex(documented in the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong> <strong>Manual</strong>), it will use the order for branchingon variables.For more details about SOS1, see the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong> and User <strong>Manual</strong>s.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 335


IloSOS1Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.See AlsoConstructorsIloSOS1Array, IloSOS2public IloSOS1()This constructor creates an empty handle. You must initialize it before you use it.public IloSOS1(IloSOS1I * impl)This constructor creates a handle object from a pointer to an implementation object.public IloSOS1(const IloEnv env,const char * name=0)This constructor creates a special ordered set of type 1 (SOS1). You must add thevariables to this set for them to be taken into account.public IloSOS1(const IloEnv env,const IloNumVarArray vars,const char * name=0)This constructor creates a special ordered set of type 1 (SOS1). The set includes each ofthe variables specified in the array vars.public IloSOS1(const IloEnv env,const IloNumVarArray vars,const IloNumArray vals,const char * name=0)This constructor creates a special ordered set of type 1 (SOS1). The set includes thevariables specified in the array vars. The corresponding value in vals specifies theweight of each variable in vars.Methodspublic IloSOS1I * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public void getNumVars(IloNumVarArray variables) constThis member function accesses the variables in a special ordered set of type 1 (SOS1)and puts those variables into its argument variables.public void getValues(IloNumArray values) constThis member function accesses the weights of the variables in a special ordered set oftype 1 (SOS1) and puts those weights into its argument values.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 336


IloSOS1ArrayIloSOS1ArrayCategoryClassInheritancePathDefinition Fileilconcert/ilolinear.hSummary For <strong>ILOG</strong> <strong>CPLEX</strong>: the array class of special ordered sets of type 1 (SOS1).Constructor SummarypublicpublicIloSOS1Array(IloDefaultArrayI * i=0)IloSOS1Array(const IloEnv env,IloInt n=0)Method Summarypublic void add(IloInt more,const IloSOS1 & x)public void add(const IloSOS1 & x)public void add(const IloSOS1Array & x)public IloSOS1operator[](IloInt i) constpublic IloSOS1 & operator[](IloInt i)Inherited methods from IloConstraintArrayadd, add, add, operator[], operator[]<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 337


IloSOS1ArrayInherited methods from IloExtractableArrayIloExtractableArray::add, IloExtractableArray::add,IloExtractableArray::add, IloExtractableArray::endElements,IloExtractableArray::setNamesDescriptionSee AlsoConstructorsFor each basic type, Concert Technology defines a corresponding array class.IloSOS1Array is the array class of special ordered sets of type 1 (SOS1) for a model.Instances of IloSOS1Array are extensible. That is, you can add more elements tosuch an array. <strong>Reference</strong>s to an array change whenever an element is added to orremoved from the array.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.For information on arrays, see the concept ArraysIloSOS1, operator>>, operatorpublic IloSOS1Array(IloDefaultArrayI * i=0)This default constructor creates an empty array. You cannot create instances of theundocumented class IloDefaultArrayI. As an argument in this defaultconstructor, it allows you to pass 0 (zero) as a value to an optional argument in functionsand member functions that accept an array as an argument.public IloSOS1Array(const IloEnv env,IloInt n=0)This constructor creates an array of n empty elements in the environment env.Methodspublic void add(IloInt more,const IloSOS1 & x)This member function appends x to the invoking array multiple times. The argumentmore specifies how many times.public void add(const IloSOS1 & x)This member function appends x to the invoking array.public void add(const IloSOS1Array & x)This member function appends the elements in array to the invoking array.public IloSOS1 operator[](IloInt i) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 338


IloSOS1ArrayThis operator returns a reference to the object located in the invoking array at theposition specified by the index i. On const arrays, Concert Technology uses theconst operator:IloSOS1 operator[] (IloInt i) const;public IloSOS1 & operator[](IloInt i)This operator returns a reference to the object located in the invoking array at theposition specified by the index i.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 339


IloSOS2IloSOS2CategoryClassInheritancePathDefinition Fileilconcert/ilolinear.hSummary For <strong>ILOG</strong> <strong>CPLEX</strong>: represents special ordered sets of type 2 (SOS2).Constructor SummarypublicpublicpublicpublicpublicIloSOS2()IloSOS2(IloSOS2I * impl)IloSOS2(const IloEnv env,const char * name=0)IloSOS2(const IloEnv env,const IloNumVarArrayvars,const char * name=0)IloSOS2(const IloEnv env,const IloNumVarArrayvars,const IloNumArray vals,const char *name=0)Method Summarypublic IloSOS2I *public voidpublic voidgetImpl() constgetNumVars(IloNumVarArray variables) constgetValues(IloNumArray values) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 340


IloSOS2Inherited methods from IloConstraintIloConstraint::getImplInherited methods from IloIntExprArgIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionThis handle class represents special ordered sets of type 2 (SOS2). A special ordered setof type 2 specifies a set of variables, and only two among them may take a non zerovalue. These two variables must be adjacent. You may assign a weight to each variablein an SOS2. This weight specifies an order among the variables. Concert Technologyasserts adjacency with respect to this assigned order. If you do not assign any weights toenforce order and adjacency among the variables, then Concert Technology considersthe order in which you gave the variables to the constructor of this set and the order inwhich you added variables later (for example, by column generation).When you extract a model (an instance of IloModel) for an instance of IloCplex(documented in the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong> <strong>Manual</strong>), it will use the order of the SOS2for branching on variables.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 341


IloSOS2For more details about SOS2, see the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong> and User's <strong>Manual</strong>s.Special ordered sets of type 2 (SOS2) commonly appear in models of piecewise linearfunctions. Concert Technology provides direct support for piecewise linear models inIloPiecewiseLinear.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.See AlsoConstructorsIloPiecewiseLinear, IloSOS1, IloSOS2Arraypublic IloSOS2()This constructor creates an empty handle. You must initialize it before you use it.public IloSOS2(IloSOS2I * impl)This constructor creates a handle object from a pointer to an implementation object.public IloSOS2(const IloEnv env,const char * name=0)This constructor creates a special ordered set of type 2 (SOS2). You must add thevariables to this set for them to be taken into account.public IloSOS2(const IloEnv env,const IloNumVarArray vars,const char * name=0)This constructor creates a special ordered set of type 2 (SOS2). The set includes each ofthe variables specified in the array vars.public IloSOS2(const IloEnv env,const IloNumVarArray vars,const IloNumArray vals,const char * name=0)This constructor creates a special ordered set of type 2 (SOS2). The set includes thevariables specified in the array vars. The corresponding value in vals specifies theweight of each variable in vars.Methodspublic IloSOS2I * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public void getNumVars(IloNumVarArray variables) constThis member function accesses the variables in a special ordered set of type 2 (SOS2)and puts those variables into its argument variables.public void getValues(IloNumArray values) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 342


IloSOS2This member function accesses the weights of the variables in a special ordered set oftype 2 (SOS2) and puts those weights into its argument values.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 343


IloSOS2ArrayIloSOS2ArrayCategoryClassInheritancePathDefinition Fileilconcert/ilolinear.hSummary For <strong>ILOG</strong> <strong>CPLEX</strong>: the array class of special ordered sets of type 2 (SOS2).Constructor SummarypublicpublicIloSOS2Array(IloDefaultArrayI * i=0)IloSOS2Array(const IloEnv env,IloInt num=0)Method Summarypublic void add(IloInt more,const IloSOS2 x)public void add(const IloSOS2 x)public voidadd(const IloSOS2Array array)public IloSOS2operator[](IloInt i) constpublic IloSOS2 & operator[](IloInt i)Inherited methods from IloConstraintArrayadd, add, add, operator[], operator[]<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 344


IloSOS2ArrayInherited methods from IloExtractableArrayIloExtractableArray::add, IloExtractableArray::add,IloExtractableArray::add, IloExtractableArray::endElements,IloExtractableArray::setNamesDescriptionSee AlsoConstructorsFor each basic type, Concert Technology defines a corresponding array class.IloSOS2Array is the array class of special ordered sets of type 2 (SOS2) for a model.Instances of IloSOS2Array are extensible. That is, you can add more elements tosuch an array. <strong>Reference</strong>s to an array change whenever an element is added to orremoved from the array.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.For information on arrays, see the concept ArraysIloSOS2, operator>>, operatorpublic IloSOS2Array(IloDefaultArrayI * i=0)This default constructor creates an empty array. You cannot create instances of theundocumented class IloDefaultArrayI. As an argument in this defaultconstructor, it allows you to pass 0 (zero) as a value to an optional argument in functionsand member functions that accept an array as an argument.public IloSOS2Array(const IloEnv env,IloInt num=0)This constructor creates an array of num empty elements in the environment env.Methodspublic void add(IloInt more,const IloSOS2 x)This member function appends x to the invoking array multiple times. The argumentmore specifies how many times.public void add(const IloSOS2 x)This member function appends x to the invoking array.public void add(const IloSOS2Array array)This member function appends the elements in array to the invoking array.public IloSOS2 operator[](IloInt i) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 345


IloSOS2ArrayThis operator returns a reference to the object located in the invoking array at theposition specified by the index i. On const arrays, Concert Technology uses theconst operator:IloSOS2 operator[] (IloInt i) const;public IloSOS2 & operator[](IloInt i)This operator returns a reference to the object located in the invoking array at theposition specified by the index i.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 346


IloSemiContVarIloSemiContVarCategoryClassInheritancePathDefinition Fileilconcert/iloexpression.hSummary For <strong>ILOG</strong> <strong>CPLEX</strong>: instance represents a constrained semicontinuous variable.Constructor SummarypublicpublicpublicpublicIloSemiContVar()IloSemiContVar(IloSemiContVarI * impl)IloSemiContVar(const IloEnv env,IloNumsclb,IloNum ub,IloNumVar::Typetype=ILOFLOAT,const char * name=0)IloSemiContVar(const IloAddNumVar & var,IloNumsclb,IloNum ub,IloNumVar::Typetype=ILOFLOAT,const char * name=0)Method Summarypublic IloSemiContVarI *public IloNumpublic voidgetImpl() constgetSemiContLB() constsetSemiContLB(IloNum sclb) constInherited methods from IloNumVar<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 347


IloSemiContVargetImpl, getLB, getPossibleValues, getType, getUB, setBounds, setLB,setPossibleValues, setUBInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectDescriptionAn instance of this class represents a constrained semicontinuous variable in a ConcertTechnology model. Semicontinuous variables derive from IloNumVar, the class ofnumeric variables.A semicontinuous variable may be 0 (zero) or it may take a value within an intervaldefined by its semicontinuous lower and upper bound. Conventionally, semicontinuousvariables are defined as floating-point variables, but you can designate an instance ofIloSemiContVar as integer by using the type specification it inherits fromIloNumVar. In that case, Concert Technology will impose an integrality constraint onthe semicontinuous variable for you, thus further restricting the feasible set of values to0 (zero) and the integer values in the interval defined by the semicontinuous lower andupper bound.Note:When numeric bounds are given to an integer variable (an instance ofIloIntVar or IloNumVar with Type = Int) in the constructors or via amodifier (setUB, setLB, setBounds), they are inwardly rounded to aninteger value. LB is rounded down and UB is rounded up.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 348


IloSemiContVarIn an instance of IloNumVar, lb denotes the lower bound of the variable, and ubdenotes its upper bound. In an instance of the derived class IloSemiContVar, sclbdenotes the semicontinuous lower bound.In formal terms, if lb


IloSemiContVarpublic IloSemiContVar(const IloAddNumVar & var,IloNum sclb,IloNum ub,IloNumVar::Type type=ILOFLOAT,const char * name=0)This constructor creates an instance of IloSemiContVar from the prototype var.Methodspublic IloSemiContVarI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public IloNum getSemiContLB() constThis member function returns the semicontinuous lower bound (that is, its sclb) of theinvoking semicontinuous variable.public void setSemiContLB(IloNum sclb) constThis member function makes sclb the semicontinuous lower bound of the invokingsemicontinuous variable.Note: The member function setSemiContinuousLb notifies ConcertTechnology algorithms about this change of this invoking object.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 350


IloSemiContVarArrayIloSemiContVarArrayCategoryClassInheritancePathDefinition FileSummaryilconcert/iloexpression.hFor <strong>ILOG</strong> <strong>CPLEX</strong>: is the array class of the semicontinuous numeric variable class for amodel.Constructor SummarypublicpublicpublicpublicpublicIloSemiContVarArray(IloDefaultArrayI * i=0)IloSemiContVarArray(const IloEnv env)IloSemiContVarArray(const IloEnv env,IloIntn)IloSemiContVarArray(const IloEnv env,IloIntn,IloNum sclb,IloNum ub,IloNumVar::Typetype=ILOFLOAT)IloSemiContVarArray(const IloEnv env,constIloNumColumnArray columnarray,constIloNumArray sclb,const IloNumArrayub,IloNumVar::Type type=ILOFLOAT)Method Summarypublic void add(IloInt more,const IloSemiContVar x)public void add(const IloSemiContVar x)public voidadd(const IloSemiContVarArray array)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 351


IloSemiContVarArrayInherited methods from IloNumVarArrayadd, add, add, endElements, operator[], setBounds, toIntExprArray,toIntVarArray, toNumExprArrayInherited methods from IloNumExprArrayIloNumExprArray::add, IloNumExprArray::add, IloNumExprArray::add,IloNumExprArray::endElements, IloNumExprArray::operator[]Inherited methods from IloExtractableArrayIloExtractableArray::add, IloExtractableArray::add,IloExtractableArray::add, IloExtractableArray::endElements,IloExtractableArray::setNamesDescriptionSee AlsoConstructorsFor each basic type, Concert Technology defines a corresponding array class.IloSemiContVarArray is the array class of the semicontinuous numeric variableclass for a model.Instances of IloSemiContVarArray are extensible. That is, you can add moreelements to such an array. <strong>Reference</strong>s to an array change whenever an element is addedto or removed from the array.Most member functions in this class contain assert statements. For an explanation ofthe macro NDEBUG (a way to turn on or turn off these assert statements), see theconcept Assert and NDEBUG.IloSemiContVar, IloModel, IloNumVar, operator>>, operatorpublic IloSemiContVarArray(IloDefaultArrayI * i=0)This constructor creates an empty extensible array of semicontinuous numeric variables.You cannot create instances of the undocumented class IloDefaultArrayI. As anargument in this default constructor, it allows you to pass 0 (zero) as a value to anoptional argument in functions and member functions that accept an array as anargument.public IloSemiContVarArray(const IloEnv env)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 352


IloSemiContVarArrayThis constructor creates an extensible array of semicontinuous numeric variables inenv. Initially, the array contains zero elements.public IloSemiContVarArray(const IloEnv env,IloInt n)This constructor creates an extensible array of n semicontinuous numeric variables inenv. Initially, the n elements are empty handles.public IloSemiContVarArray(const IloEnv env,IloInt n,IloNum sclb,IloNum ub,IloNumVar::Type type=ILOFLOAT)This constructor creates an extensible array of n semicontinuous numeric variables inthe environment env. Each element of the array has a semicontinuous lower bound ofsclb and an upper bound of ub. The type (whether integer, Boolean, or floating-point)of each element is specified by type. The default type is floating-point.public IloSemiContVarArray(const IloEnv env,const IloNumColumnArray columnarray,const IloNumArray sclb,const IloNumArray ub,IloNumVar::Type type=ILOFLOAT)This constructor creates an extensible array of semicontinuous numeric variables from acolumn array in the environment env. The array sclb specifies the correspondingsemicontinuous lower bound, and the array ub specifies the corresponding upper boundfor each new element. The argument type specifies the type (whether integer, Boolean,or floating point) of each new element. The default type is floating-point.Methodspublic void add(IloInt more,const IloSemiContVar x)This member function appends x to the invoking array multiple times. The argumentmore specifies how many times.public void add(const IloSemiContVar x)This member function appends x to the invoking array.public void add(const IloSemiContVarArray array)This member function appends the elements in array to the invoking array.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 353


IloSemiContVarArrayGroup optim.concert.extensionsThe <strong>ILOG</strong> Concert Extensions Library.Classes SummaryIloCsvLine Represents a line in a csv file.IloCsvReader Reads a formatted csv file.IloCsvReader::IloColumnHeaderNotFoundExceptionIloCsvReader::IloCsvReaderParameterExceptionIloCsvReader::IloDuplicatedTableExceptionIloCsvReader::IloFieldNotFoundExceptionIloCsvReader::IloFileNotFoundExceptionIloCsvReader::IloIncorrectCsvReaderUseExceptionException thrown for unfoundheader.Exception thrown for incorrectarguments in constructor.Exception thrown for tables of samename in csv file.Exception thrown for field not found.Exception thrown when file is notfound.Exception thrown for call toinappropriate csv reader.Exception thrown for unfound line.IloCsvReader::IloLineNotFoundExceptionIloCsvReader::IloTableNotFou Exception thrown for unfound table.ndExceptionIloCsvReader::LineIterator Line-iterator for csv readers.IloCsvReader::TableIterator Table-iterator of csv readers.IloCsvTableReader Reads a csv table with format.IloCsvTableReader::LineItera Line-iterator for csv table readers.torIloIntervalList Represents a list of nonoverlappingintervals.IloIntervalListCursor Inspects the intervals of an intervallist.IloNumToAnySetStepFunction Represents a step function thatassociates sets with intervals.IloNumToAnySetStepFunctionCursorAllows you to inspect the contents ofan IloNumToAnySetStepFunction.IloNumToNumSegmentFunction Piecewise linear function over asegment.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 354


IloSemiContVarArrayIloNumToNumSegmentFunctionCursorCursor over segments of a piecewiselinear function.IloNumToNumStepFunction Represents a step function that isdefined everywhere on an interval.IloNumToNumStepFunctionCursorAllows you to inspect the contents ofan instance ofIloNumToNumStepFunction.Global Functions SummaryIloDifferenceCreates and returns a function equalto the difference between thefunctions.IloDifference Creates and returns the differencebetween two interval lists.IloIntersection creates and returns a function equalto the intersection between thefunctions.IloMax This operator creates and returns afunction equal to the maximal value ofthe functions f1 and f2.IloMin This operator creates and returns afunction equal to the minimal value ofthe functions f1 and f2.IloUnion Represents a function equal to theunion of the functions.IloUnionCreates and returns the union of twointerval lists.operator * These operators create and return afunction equal to the function f1multiplied by a factor k.operator+ This operator creates and returns afunction equal the sum of thefunctions f1 and f2.operator- This operator creates and returns afunction equal to the differencebetween functions f1 and f2.operator Overloaded operator for csv output.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 355


IloCsvLineDescriptionIloCsvLineoperator== Returns IloTrue for same intervallists. same.operator== overloaded operator.operator==Overloaded operator tests equality ofnumeric functions.CategoryClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Represents a line in a csv file.Constructor SummarypublicpublicpublicIloCsvLine()IloCsvLine(IloCsvLineI * impl)IloCsvLine(const IloCsvLine & csvLine)Method Summarypublic voidpublic IloBoolpublic IloBoolpublic voidpublic IloNumcopy(const IloCsvLine)emptyFieldByHeader(const char * name) constemptyFieldByPosition(IloInt i) constend()getFloatByHeader(const char * name) constpublic IloNum getFloatByHeaderOrDefaultValue(const char *name,IloNum defaultValue) constpublic IloNumgetFloatByPosition(IloInt i) constpublic IloNumpublic IloCsvLineI *getFloatByPositionOrDefaultValue(IloInti,IloNum defaultValue) constgetImpl() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 356


IloCsvLinepublic IloIntgetIntByHeader(const char * name) constpublic IloInt getIntByHeaderOrDefaultValue(const char *name,IloInt defaultValue) constpublic IloIntgetIntByPosition(IloInt i) constpublic IloIntpublic IloIntpublic IloIntpublic char *getIntByPositionOrDefaultValue(IloInti,IloInt defaultValue) constgetLineNumber() constgetNumberOfFields() constgetStringByHeader(const char * name) constpublic char * getStringByHeaderOrDefaultValue(const char *name,const char * defaultValue) constpublic char *getStringByPosition(IloInt i) constpublic char *public voidpublic IloBoolgetStringByPositionOrDefaultValue(IloInti,const char * defaultValue) constoperator=(const IloCsvLine & csvLine)printValueOfKeys() constDescriptionConstructorsAn instance of IloCsvLine represents a single line in a file of comma-separatedvalues (csv file).public IloCsvLine()This constructor creates a csv line object whose handle pointer is null. This object mustbe assigned before it can be used.public IloCsvLine(IloCsvLineI * impl)This constructor creates a handle object (an instance of IloCsvLine) from a pointerto an implementation object (an instance of the class IloCsvLineI).public IloCsvLine(const IloCsvLine & csvLine)This copy constructor creates a handle from a reference to a csv line object. The csv lineobject and csvLine both point to the same implementation object.Methodspublic void copy(const IloCsvLine)This member function returns the real number of the invoking csv line in the data file.public IloBool emptyFieldByHeader(const char * name) constThis member function returns IloTrue if the field denoted by the string name in theinvoking csv line is empty. Otherwise, it returns IloFalsepublic IloBool emptyFieldByPosition(IloInt i) constThis member function returns IloTrue if the field denoted by i in the invoking csvline is empty. Otherwise, it returns IloFalse<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 357


IloCsvLinepublic void end()This member function deallocates the memory used by the csv line. If you no longerneed a csv line, you can call this member function to reduce memory consumption.public IloNum getFloatByHeader(const char * name) constThis member function returns the float contained in the field name in the invoking csvline.If you have a loop in which you are getting a string, integer, or float by header on severallines with the same header name, it is better for performance to get the position of theheader named name using the member functionIloCsvReader::getPosition(name) than using getFloatByPosition(position of name in the header line).public IloNum getFloatByHeaderOrDefaultValue(const char * name,IloNum defaultValue) constThis member function returns the float contained in the field name in the invoking csvline if this field contains a value. Otherwise, it returns defaultValue.public IloNum getFloatByPosition(IloInt i) constThis member function returns the float contained in the field i in the invoking csv line.public IloNum getFloatByPositionOrDefaultValue(IloInt i,IloNum defaultValue) constThis member function returns the float contained in the field i in the invoking csv line ifthis field contains a value. Otherwise, it returns defaultValue.public IloCsvLineI * getImpl() constThis member function returns a pointer to the implementation object corresponding tothe invoking csv line.public IloInt getIntByHeader(const char * name) constThis member function returns the integer contained in the field name in the invoking csvline.If you have a loop in which you are getting a string, integer, or float by header on severallines with the same header name, it is better for performance to get the position of theheader named name using the member functionIloCsvReader::getPosition(name) than using getIntByPosition(position of name in the header line).public IloInt getIntByHeaderOrDefaultValue(const char * name,IloInt defaultValue) constThis member function returns the integer contained in the field name in the invoking csvline if this field contains a value. Otherwise, it returns defaultValue.public IloInt getIntByPosition(IloInt i) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 358


IloCsvLineThis member function returns the integer contained in the field i in the invoking csvline.public IloInt getIntByPositionOrDefaultValue(IloInt i,IloInt defaultValue) constThis member function returns the integer contained in the field i in the invoking csv lineif this field contains a value. Otherwise, it returns defaultValue.public IloInt getLineNumber() constThis member function returns the real number of the invoking csv line in the data file.public IloInt getNumberOfFields() constThis member function returns the number of fields in the line.public char * getStringByHeader(const char * name) constThis member function returns a reference to the string contained in the field name in theinvoking csv line.If you have a loop in which you are getting a string, integer, or float by header on severallines with the same header name, it is better for performance to get the position of theheader named name using the member functionIloCsvReader::getPosition(name) than using getStringByPosition(position of name in the header line).public char * getStringByHeaderOrDefaultValue(const char * name,const char * defaultValue) constThis member function returns the string contained in the field name in the invoking csvline if this field contains a value. Otherwise, it returns defaultValue.public char * getStringByPosition(IloInt i) constThis member function returns a reference to the string contained in the field number i inthe invoking csv line.public char * getStringByPositionOrDefaultValue(IloInt i,const char * defaultValue) constThis member function returns the string contained in the field i in the invoking csv lineif this field contains a value. Otherwise, it returns defaultValue.public void operator=(const IloCsvLine & csvLine)This operator assigns an address to the handle pointer of the invoking csv line. Thisaddress is the location of the implementation object of the argument csvLine.After execution of this operator, the invoking csv line and csvLine both point to thesame implementation object.public IloBool printValueOfKeys() constThis member function prints the values of the keys fields in this line.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 359


IloCsvReaderIloCsvReaderCategoryClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Reads a formatted csv file.Constructor SummarypublicpublicpublicIloCsvReader()IloCsvReader(IloCsvReaderI * impl)IloCsvReader(const IloCsvReader & csv)public IloCsvReader(IloEnv env,const char *problem,IloBool multiTable=IloFalse,IloBoolallowTableSplitting=IloFalse,const char *separator=",;",const char decimalp='.',constchar quote='"',const char comment='#')Method Summarypublic voidpublic IloNumpublic IloCsvLinepublic IloEnvpublic IloNumpublic IloCsvReaderI *end()getCsvFormat()getCurrentLine() constgetEnv() constgetFileVersion()getImpl() constpublic IloCsvLinegetLineByKey(IloInt numberOfKeys,const char*,...)public IloCsvLine getLineByNumber(IloInt i)public IloIntpublic IloIntpublic IloIntpublic IloIntgetNumberOfColumns()getNumberOfItems()getNumberOfKeys() constgetNumberOfTables()<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 360


IloCsvReaderpublic IloInt IloCsvReader::getPosition(const char *headingName) constpublic IloCsvTableReader getReaderForUniqueTableFile() constpublic const char *public IloCsvTableReaderpublic IloCsvTableReadergetRequiredBy()getTable()getTableByName(const char * name)public IloCsvTableReader getTableByNumber(IloInt i)public IloBoolpublic voidpublic IloBoolisHeadingExists(const char * headingName) constoperator=(const IloCsvReader & csv)printKeys() constInner ClassIloCsvReader::IloCsvReader::IloColumnHeaderNotFoundExceptionIloCsvReader::IloCsvReader::TableIteratorIloCsvReader::IloCsvReader::LineIteratorIloCsvReader::IloCsvReader::IloFileNotFoundExceptionIloCsvReader::IloCsvReader::IloFieldNotFoundExceptionIloCsvReader::IloCsvReader::IloCsvReaderParameterExceptionIloCsvReader::IloCsvReader::IloDuplicatedTableExceptionIloCsvReader::IloCsvReader::IloTableNotFoundExceptionIloCsvReader::IloCsvReader::IloIncorrectCsvReaderUseExceptionIloCsvReader::IloCsvReader::IloLineNotFoundExceptionException thrown for unfound header.Table-iterator of csv readers.Line-iterator for csv readers.Exception thrown when file is not found.Exception thrown for field not found.Exception thrown for incorrect arguments inconstructor.Exception thrown for tables of same name incsv file.Exception thrown for unfound table.Exception thrown for call to inappropriate csvreader.Exception thrown for unfound line.DescriptionAn instance of IloCsvReader reads a file of comma-separated values of a specifiedformat. The csv file can be a multitable or a single table file. Empty lines andcommented lines are allowed everywhere in the file.Format of multitable files<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 361


IloCsvReaderThe first column of the table must contain the name of the table.Each table can begin with a line containing column headers, the first field of this linemust have this format: tableName|NAMESThe keys can be specified in the data file by adding a line at the beginning of the table.This line is formatted as follows:◆the first field is tableName|KEYS◆ the other fields have the value 1 if the corresponding column is a key for the table; ifnot they have the value 0.If this line doesn't exist, all columns form a key. If you need to get a line having aspecific value for a field, you must add the key line in which you specify that this field isa key for the table.Any line containing '|' in its first field is ignored by the reader.A table can be split in several parts in the file (for example, you have a part of table TA,then table TB, then the end of table TA).ExampleNODES|NAMES,node_type,node_name,xcoord,ycoordNODES|KEYS,1,1,0,0NODES,1,node1,0,1NODES,1,node2,0,2NODES,2,node1,0,4Format of single table filesThe line containing the column headers, if it exists, must have a first field of thefollowing format: Field|NAMES.Table keys can be specified by adding a line at the beginning of the table. This line musthave a first field with this format: tableName|KEYS. If this line doesn't exist, allcolumns form a key.ExampleField|NAMES,nodeName,xCoord,yCoordField|KEYS,1,0,0node1,0,1node2,0,2Constructorspublic IloCsvReader()<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 362


IloCsvReaderThis constructor creates a csv reader object whose handle pointer is null. This objectmust be assigned before it can be used.public IloCsvReader(IloCsvReaderI * impl)This constructor creates a handle object (an instance of IloCsvReader) from apointer to an implementation object (an instance of the class IloCsvReaderI).public IloCsvReader(const IloCsvReader & csv)This copy constructor creates a handle from a reference to a csv reader object. Both thecsv reader object and csv point to the same implementation object.public IloCsvReader(IloEnv env,const char * problem,IloBool multiTable=IloFalse,IloBool allowTableSplitting=IloFalse,const char * separator=",;",const char decimalp='.',const char quote='"',const char comment='#')This constructor creates a csv reader object for the file problem in the environmentenv. If the argument isCached has the value IloTrue, the data of the file will bestored in the memory.The cached mode is useful only if you need to read lines by keys. It needs consequentmemory consumption and takes time to load data according to the csv file size.If the argument isMultiTable has the value IloTrue, the file problem is read asa multitable file. The default value is IloFalse.If the argument allowTableSplitting has the value IloFalse, splitting thetable into several parts in the file is not permitted. The default value is IloFalse.The string separator represents the characters used as separator in the data file. Thedefault values are , ; .The character decimal represents the character used to write decimal numbers in thedata file. The default value is . (period).The character quote represents the character used to quote expressions.The character comment represents the character used at the beginning of eachcommented line. The default value is #.Methodspublic void end()This member function deallocates the memory used by the csv reader. If you no longerneed a csv reader, you can reduce memory consumption by calling this memberfunction.public IloNum getCsvFormat()<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 363


IloCsvReaderThis member function returns the format of the csv data file. This format is identified inthe data file by <strong>ILOG</strong>_CSV_FORMAT.Example<strong>ILOG</strong>_CSV_FORMAT;1getCsvFormat() returns 1.Note:This member function can be used only ifvalue IloTrue.isMultiTable has thepublic IloCsvLine getCurrentLine() constThis member function returns the last line read by getLineByKey orgetLineByNumber.Note:This member function can be used only ifvalue IloFalse.isMultiTable has thepublic IloEnv getEnv() constThis member function returns the environment object corresponding to the invoking csvreader.public IloNum getFileVersion()This member function returns the version of the csv data file. This information isidentified in the data file by <strong>ILOG</strong>_DATA_SCHEMA.Example<strong>ILOG</strong>_DATA_SCHEMA;PROJECTNAME;0.9getFileVersion() returns 0.9.Note:This member function can be used only ifvalue IloTrue.isMultiTable has thepublic IloCsvReaderI * getImpl() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 364


IloCsvReaderThis member function returns a pointer to the implementation object corresponding tothe invoking csv reader.public IloCsvLine getLineByKey(IloInt numberOfKeys,const char *,...)This member function takes numberOfKeys arguments; these arguments are used asone key to identify a line. It returns an instance of IloCsvLine representing the linehaving (key1, key2, ...) in the data file. If the number of keys specified is lessthan the number of keys in the table, this member function throws an exception. Eachtime getLineByNumber or getLineByKey is called, the previous line read by oneof these methods is deleted.Note:This member function can be used only ifvalue IloFalse.isMultiTable has thepublic IloCsvLine getLineByNumber(IloInt i)This member function returns an instance of IloCsvLine representing the linenumbered i in the data file. If i does not exist, this member function throws anexception. Each time getLineByNumber or getLineByKey is called, the previousline read by one of these methods is deleted.Note:This member function can be used only ifvalue IloFalse.isMultiTable has thepublic IloInt getNumberOfColumns()This member function returns the number of columns in the table. If the first columncontains the name of the table it is ignored.Note:This member function can be used only ifvalue IloFalse.isMultiTable has thepublic IloInt getNumberOfItems()This member function returns the number of lines of the table excluding blank lines,commented lines, and the header line.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 365


IloCsvReaderNote:This member function can be used only ifvalue IloFalse.isMultiTable has thepublic IloInt getNumberOfKeys() constThis member function returns the number of keys for the table.Note:This member function can be used only ifvalue IloFalse.isMultiTable has thepublic IloInt getNumberOfTables()This member function returns the number of tables in the data file.public IloInt getPosition(const char * headingName) constThis member function returns the position (column number) of the headingName inthe file.Note:This member function can be used only ifvalue IloFalse.isMultiTable has thepublic IloCsvTableReader getReaderForUniqueTableFile() constThis member function returns an IloCsvTableReader for the unique tablecontained in the csv data file.Note:This member function can be used only ifvalue IloFalse.isMultiTable has thepublic const char * getRequiredBy()This member function returns the name of the project that uses the csv data file. Thisinformation is identified in the data file by <strong>ILOG</strong>_DATA_SCHEMA.Example<strong>ILOG</strong>_DATA_SCHEMA;PROJECTNAME;0.9<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 366


IloCsvReadergetRequiredBy() returns PROJECTNAME.Note:This member function can be used only ifvalue IloTrue.isMultiTable has thepublic IloCsvTableReader getTable()This member function returns an instance of IloCsvTableReader representing theunique table in the data file.Note:This member function can be used only ifvalue IloFalse.isMultiTable has thepublic IloCsvTableReader getTableByName(const char * name)This member function returns an instance of IloCsvTableReader representing thetable named name in the data file.Note:This member function can be used only ifvalue IloTrue.isMultiTable has thepublic IloCsvTableReader getTableByNumber(IloInt i)This member function returns an instance of IloCsvTableReader representing thetable numbered i in the data file.Note:This member function can be used only ifvalue IloTrue.isMultiTable has thepublic IloBool isHeadingExists(const char * headingName) constThis member function returns IloTrue if the column header headingName exists.Otherwise, it returns IloFalse.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 367


IloCsvReaderNote:This member function can be used only ifvalue IloFalse.isMultiTable has thepublic void operator=(const IloCsvReader & csv)This operator assigns an address to the handle pointer of the invoking csv reader. Thisaddress is the location of the implementation object of the argument csv.After execution of this operator, both the invoking csv reader and csv point to the sameimplementation object.public IloBool printKeys() constThis member function prints the column header of keys if the header exists. Otherwise,it prints the column numbers of keys.Note:This member function can be used only ifvalue IloFalse.isMultiTable has the<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 368


IloCsvReader::IloColumnHeaderNotFoundExceptionIloCsvReader::IloColumnHeaderNotFoundExceptionCategoryInner ClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Exception thrown for unfound header.DescriptionThis exception is thrown by the member functions listed below if a header (columnname) that you use does not exist.◆◆◆◆◆◆◆◆getFloatByHeadergetIntByHeadergetStringByHeadergetFloatByHeaderOrDefaultValuegetIntByHeaderOrDefaultValuegetStringByHeaderOrDefaultValueIloCsvReader::getPositionIloCsvTableReader::getPosition<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 369


IloCsvReader::IloCsvReaderParameterExceptionIloCsvReader::IloCsvReaderParameterExceptionCategoryInner ClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Exception thrown for incorrect arguments in constructor.DescriptionThis exception is thrown in the constructor of the csv reader if the argument valuesused in the csv reader constructor are incorrect.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 370


IloCsvReader::IloDuplicatedTableExceptionIloCsvReader::IloDuplicatedTableExceptionCategoryInner ClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Exception thrown for tables of same name in csv file.DescriptionThis exception is thrown in the constructor of the csv reader if you read a multitable filein which two tables have the same name but table splitting has not been specified.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 371


IloCsvReader::IloFieldNotFoundExceptionIloCsvReader::IloFieldNotFoundExceptionCategoryInner ClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Exception thrown for field not found.DescriptionThis exception is thrown by the IloCsvLine methods listed below if thecorresponding field does not exist.◆◆◆◆◆◆◆◆◆◆◆◆getFloatByPositiongetIntByPositiongetStringByPositiongetFloatByHeadergetIntByHeadergetStringByHeadergetFloatByPositionOrDefaultValuegetIntByPositionOrDefaultValuegetStringByPositionOrDefaultValuegetFloatByHeaderOrDefaultValuegetIntByHeaderOrDefaultValuegetStringByHeaderOrDefaultValue<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 372


IloCsvReader::IloFileNotFoundExceptionIloCsvReader::IloFileNotFoundExceptionCategoryInner ClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Exception thrown when file is not found.DescriptionThis exception is thrown in the constructor of the csv reader if a specified file is notfound.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 373


IloCsvReader::IloIncorrectCsvReaderUseExceptionIloCsvReader::IloIncorrectCsvReaderUseExceptionCategoryInner ClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Exception thrown for call to inappropriate csv reader.DescriptionThis exception is thrown in the following member functions if you call them from areader built as a multitable csv reader.◆◆◆◆◆◆◆◆getLineByNumbergetLineByKeygetNumberOfItemsgetNumberOfColumnsgetNumberOfKeysgetReaderForUniqueTableFilegetTableisHeadingExists◆ printKeysThis exception is throw in the following member functions if you call them from areader built as a unique table csv reader.◆◆◆◆◆getCsvFormatgetFileVersiongetTableByNamegetTableByNumbergetRequiredBy<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 374


IloCsvReader::IloLineNotFoundExceptionIloCsvReader::IloLineNotFoundExceptionCategoryInner ClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Exception thrown for unfound line.DescriptionThis exception is thrown by the following member functions if the line is not found.◆ IloCsvTableReader::getLineByKey◆ IloCsvTableReader::getLineByNumber◆ getLineByKey◆ getLineByNumber<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 375


IloCsvReader::IloTableNotFoundExceptionIloCsvReader::IloTableNotFoundExceptionCategoryInner ClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Exception thrown for unfound table.DescriptionThis exception is thrown by the constructorIloCsvTableReader(IloCsvReaderI *, const char * name = 0)and by the member functions listed below if the table you want to construct or to get isnot found.◆◆◆getTableByNumbergetTableByNamegetTable<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 376


IloCsvReader::LineIteratorIloCsvReader::LineIteratorCategoryInner ClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Line-iterator for csv readers.Constructor SummarypublicpublicLineIterator()LineIterator(IloCsvReader csv)Method Summarypublic IloBoolpublic IloCsvLinepublic LineIterator &ok() constoperator *() constoperator++()DescriptionLineIterator is a nested class of the class IloCsvReader. It is to be used onlywith csv reader objects built to read a unique-table data file.IloCsvReader::LineIterator allows you to step through all the lines of the csvdata file (except blank lines and commented lines) on which the csv reader was created.Constructorspublic LineIterator()This constructor creates an empty LineIterator object. This object must beassigned before it can be used.public LineIterator(IloCsvReader csv)This constructor creates an iterator to traverse all the lines in the csv data file on whichthe csv reader csv was created.The iterator does not traverse blank lines and commented lines.Methodspublic IloBool ok() constThis member function returns IloTrue if the current position of the iterator is a validone.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 377


IloCsvReader::LineIteratorIt returns IloFalse if the iterator reaches the end of the table.public IloCsvLine operator *() constThis operator returns the current instance of IloCsvLine (representing the currentline in the csv file); the one to which the invoking iterator points.public LineIterator & operator++()This left-increment operator shifts the current position of the iterator to the next instanceof IloCsvLine representing the next line in the file.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 378


IloCsvReader::TableIteratorIloCsvReader::TableIteratorCategoryInner ClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Table-iterator of csv readers.Constructor SummarypublicTableIterator(IloCsvReader csv)Method Summarypublic IloBoolpublic IloCsvTableReaderpublic TableIterator &ok() constoperator *() constoperator++()DescriptionTableIterator is a nested class of the class IloCsvReader. It is to be used onlyfor multitable files.IloCsvReader::TableIterator allows you to step through all the tables of themultitable csv data file on which the csv reader was created.Constructorspublic TableIterator(IloCsvReader csv)This constructor creates an iterator to traverse all the tables in the csv data file on whichthe csv reader csv was created.Methodspublic IloBool ok() constThis member function returns IloTrue if the current position of the iterator is a validone.It returns IloFalse if the iterator reaches the end of the table.public IloCsvTableReader operator *() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 379


IloCsvReader::TableIteratorThis operator returns the current instance of IloCsvTable (representing the currenttable in the csv file); the one to which the invoking iterator points.public TableIterator & operator++()This left-increment operator shifts the current position of the iterator to the next instanceof IloCsvTableReader representing the next line in the file.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 380


IloCsvTableReaderIloCsvTableReaderCategoryClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Reads a csv table with format.Constructor SummarypublicpublicIloCsvTableReader()IloCsvTableReader(IloCsvTableReaderI * impl)publicIloCsvTableReader(const IloCsvTableReader &csv)public IloCsvTableReader(IloCsvReaderI *csvReaderImpl,const char * name=0)Method Summarypublic voidpublic IloCsvLinepublic IloEnvpublic IloCsvTableReaderI *public IloCsvLinepublic IloCsvLinepublic const char *public IloIntpublic IloIntpublic IloIntend()getCurrentLine() constgetEnv() constgetImpl() constIloCsvTableReader::getLineByKey(IloIntnumberOfKeys,const char *,...)IloCsvTableReader::getLineByNumber(IloInti)getNameOfTable() constgetNumberOfColumns()getNumberOfItems()getNumberOfKeys() constpublic IloInt IloCsvTableReader::getPosition(const char *)constpublic IloBoolisHeadingExists(const char * headingName) constpublic voidoperator=(const IloCsvTableReader & csv)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 381


IloCsvTableReaderpublic IloBoolprintKeys() constInner ClassIloCsvTableReader::IloCsvTableReader::LineIteratorLine-iterator for csv table readers.DescriptionConstructorsAn instance of IloCsvTableReader is used to read a table of comma-separatedvalues (csv) with a specified format.An instance is built using a pointer to an implementation class of IloCsvReader,which must be created first.public IloCsvTableReader()This constructor creates a table csv reader object whose handle pointer is null. Thisobject must be assigned before it can be used.public IloCsvTableReader(IloCsvTableReaderI * impl)This constructor creates a handle object (an instance of IloCsvReader) from apointer to an implementation object (an instance of the class IloCsvReaderI).public IloCsvTableReader(const IloCsvTableReader & csv)This copy constructor creates a handle from a reference to a table csv reader object.The table csv reader object and csv both point to the same implementation object.public IloCsvTableReader(IloCsvReaderI * csvReaderImpl,const char * name=0)This constructor creates a table csv reader object using the implementation class of a csvreader csvimpl. The second argument is the name of the table.Methodspublic void end()This member function deallocates the memory used by the table csv reader.If you no longer need the table csv reader, calling this member function can reducememory consumption.public IloCsvLine getCurrentLine() constThis member function returns the last line read using getLineByKey orgetLineByNumber.public IloEnv getEnv() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 382


IloCsvTableReaderThis member function returns the environment object corresponding to the invokingtable csv reader.public IloCsvTableReaderI * getImpl() constThis member function returns a pointer to the implementation object corresponding tothe invoking table csv reader.public IloCsvLine getLineByKey(IloInt numberOfKeys,const char *,...)This member function takes numberOfKeys arguments. These arguments are used asone key to identify a line. If the specified number of keys is less than the number of keysof the table, this member function throws an exception.Otherwise, it returns an instance of IloCsvLine representing the line having (key1,key2, ...) in the data file.public IloCsvLine getLineByNumber(IloInt i)This member function returns an instance of IloCsvLine representing the linenumber i in the data file if it exists. Otherwise, it throws an exception.Each time getLineByNumber or getLineByKey is called, the previous line readby one of those methods is deleted.public const char * getNameOfTable() constThis member function returns the name of the table.public IloInt getNumberOfColumns()This member function returns the number of columns in the table. If the first columncontains the name of the table, it is ignored.public IloInt getNumberOfItems()This member function returns the number of lines of the table excluding blank lines,commented lines, and the header line.Note:This member function can be used only ifvalue IloFalse.isMultiTable has thepublic IloInt getNumberOfKeys() constThis member function returns the number of keys in the table.public IloInt getPosition(const char *) constThis member function returns the position (column number) of headingName in thetable.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 383


IloCsvTableReaderpublic IloBool isHeadingExists(const char * headingName) constThis member function returns IloTrue if the column header named headingNameexists. Otherwise, it returns IloFalse.public void operator=(const IloCsvTableReader & csv)This operator assigns an address to the handle pointer of the invoking table csv reader.This address is the location of the implementation object of the argument csv.After execution of this operator, the invoking table csv reader and csv both point to thesame implementation object.public IloBool printKeys() constThis member function prints the column headers of keys if they exist. Otherwise, itprints the column numbers of keys.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 384


IloCsvTableReader::LineIteratorIloCsvTableReader::LineIteratorCategoryInner ClassInheritancePathDefinition Fileilconcert/ilocsvreader.hSummary Line-iterator for csv table readers.Constructor SummarypublicpublicLineIterator()LineIterator(IloCsvTableReader csv)Method Summarypublic IloBoolpublic IloCsvLinepublic LineIterator &ok() constoperator *() constoperator++()DescriptionConstructorsLineIterator is a nested class of the class IloCsvTableReader. It allows youto step through all the lines of a table from a csv data file (except blank lines andcommented lines) on which the table csv reader was created.public LineIterator()This constructor creates an empty LineIterator object.This object must be assigned before it can be used.public LineIterator(IloCsvTableReader csv)This constructor creates an iterator to traverse all the lines in the table csv data file onwhich the csv reader csv was created.The iterator does not traverse blank lines and commented lines.Methodspublic IloBool ok() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 385


IloCsvTableReader::LineIteratorThis member function returns IloTrue if the current position of the iterator is a validone.It returns IloFalse if the iterator reaches the end of the table.public IloCsvLine operator *() constThis operator returns the current instance of IloCsvLine (representing the currentline in the csv file); the one to which the invoking iterator points.public LineIterator & operator++()This left-increment operator shifts the current position of the iterator to the next instanceof IloCsvLine representing the next line in the file.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 386


IloDifferenceIloDifferenceCategoryDefinition FileSynopsisGlobal Functionilconcert/ilointervals.hpublic IloIntervalList IloDifference(const IloIntervalList intervals1,const IloIntervalList intervals2)Summary Creates and returns the difference between two interval lists.DescriptionThis operator creates and returns an interval list equal to the difference between theinterval list intervals1 and the interval list intervals2. The argumentsintervals1 and intervals2 must be defined on the same interval. The resultinginterval list is defined on the same interval as the arguments. See alsoIloIntervalList.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 387


IloDifferenceIloDifferenceCategoryDefinition FileSynopsisGlobal Functionilconcert/ilosetfunc.hpublic IloNumToAnySetStepFunction IloDifference(constIloNumToAnySetStepFunction f1,const IloNumToAnySetStepFunction f2)Summary Creates and returns a function equal to the difference between the functions.DescriptionThis operator creates and returns a function equal to the difference between thefunctions f1 and f2. The argument functions f1 and f2 must be defined on the sameinterval. The resulting function is defined on the same interval as the arguments. Seealso: IloNumToAnySetStepFunction.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 388


IloIntersectionIloIntersectionCategoryDefinition FileSynopsisGlobal Functionilconcert/ilosetfunc.hpublic IloNumToAnySetStepFunction IloIntersection(constIloNumToAnySetStepFunction f1,const IloNumToAnySetStepFunction f2)Summary creates and returns a function equal to the intersection between the functions.DescriptionThis operator creates and returns a function equal to the intersection between thefunctions f1 and f2. The argument functions f1 and f2 must be defined on the sameinterval. The resulting function is defined on the same interval as the arguments. Seealso: IloNumToAnySetStepFunction.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 389


IloIntervalListIloIntervalListCategoryClassInheritancePathDefinition Fileilconcert/ilointervals.hSummary Represents a list of nonoverlapping intervals.Constructor SummarypublicpublicIloIntervalList(const IloEnv env,IloNum min=-IloInfinity,IloNum max=+IloInfinity,const char* name=0)IloIntervalList(const IloEnv env,constIloNumArray times,const IloNumArraytypes,const char * name=0)Method Summarypublic voidpublic voidpublic IloBoolpublic IloIntervalListpublic voidpublic voidpublic IloNumpublic IloNumpublic IloBoolpublic IloBoolpublic voidpublic voidaddInterval(IloNum start,IloNum end,IloNumtype=0L) constaddPeriodicInterval(IloNum start,IloNumduration,IloNum period,IloNum end,IloNumtype=0L) constcontains(const IloIntervalList intervals) constcopy() constdilate(IloNum k) constempty() constgetDefinitionIntervalMax() constgetDefinitionIntervalMin() constisEmpty() constisKeptOpen() constkeepOpen(IloBool val=IloTrue) constremoveInterval(IloNum start,IloNum end) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 390


IloIntervalListpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidremoveIntervalOnDuration(IloNum start,IloNumduration) constremovePeriodicInterval(IloNum start,IloNumduration,IloNum period,IloNum end) constsetDifference(const IloIntervalList intervals)constsetPeriodic(const IloIntervalListintervals,IloNum x0,IloNum n=IloInfinity) constsetUnion(const IloIntervalList intervals) constshift(IloNum dx) constDescriptionAn instance of the class IloIntervalList represents a list of nonoverlappingintervals. Each interval [timeMin, timeMax) from the list is associated with anumeric type.Note that if n is the number of intervals in the list, the random access to a given interval(see the member functions addInterval, contains, and removeInterval) hasa worst-case complexity in O(log(n)).Furthermore, when two consecutive intervals of the list have the same types, theseintervals are merged so that the list is always represented with the minimal number ofintervals.See AlsoConstructorsIloIntervalListCursor, IloUnion, IloDifferencepublic IloIntervalList(const IloEnv env,IloNum min=-IloInfinity,IloNum max=+IloInfinity,const char * name=0)This constructor creates a new instance of IloIntervalList and adds it to the set ofinterval lists managed in the given environment. The arguments min and maxrespectively represent the origin and the horizon of the interval list. The new interval listdoes not contain any intervals.public IloIntervalList(const IloEnv env,const IloNumArray times,const IloNumArray types,const char * name=0)This constructor creates an interval list whose intervals are defined by the two arraystimes and types. More precisely, if n is the size of array times, then the size ofarray types must be n-1 and the following contiguous intervals are created on theinterval list: [times[i],times[i+1]) with type types[i] for all i in [0, n-1].Methodspublic void addInterval(IloNum start,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 391


IloIntervalListIloNum end,IloNum type=0L) constThis member function adds an interval of type type to the invoking interval list. Thestart time and end time of that newly added interval are set to start and end. Bydefault, the type of the interval is 0. Adding a new interval that overlaps with an alreadyexisting interval of a different type will override the existing type on the intersection.public void addPeriodicInterval(IloNum start,IloNum duration,IloNum period,IloNum end,IloNum type=0L) constThis member function adds a set of intervals to the invoking interval list. For every i>= 0 such that start + i * period < end, an interval of [start + i *period, start + duration + i * period) is added. By default, the typeof these intervals is 0. Adding a new interval that overlaps with an already existinginterval of a different type will override the existing type on the intersection.public IloBool contains(const IloIntervalList intervals) constThis member function returns IloTrue if and only if each interval of intervals isincluded in an interval of the invoking interval list, regardless of interval type.public IloIntervalList copy() constThis member function creates and returns a new interval list that is a copy of theinvoking interval list.public void dilate(IloNum k) constThis member function multiplies by k the scale of times for the invoking interval list. kmust be a positive number.public void empty() constThis member function removes all the intervals from the invoking interval list.public IloNum getDefinitionIntervalMax() constThis member function returns the right most point (horizon) of the definition interval ofthe invoking interval list.public IloNum getDefinitionIntervalMin() constThis member function returns the left most point (origin) of the definition interval of theinvoking interval list.public IloBool isEmpty() constThis member function returns IloTrue if and only if the invoking interval list isempty.public IloBool isKeptOpen() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 392


IloIntervalListThis member function returns IloTrue if the interval list must be kept open.Otherwise, it returns IloFalse.public void keepOpen(IloBool val=IloTrue) constIf the argument val is equal to IloTrue, this member function states that the invokinginterval list must be kept open during the search for a solution to the problem. It meansthat additional intervals may be added during the search. Otherwise, if the argumentval is equal to IloFalse, it states that all the intervals of the invoking interval listwill be defined in the model before starting to solve the problem. By default, it issupposed that all the intervals of the invoking interval list are defined in the modelbefore starting to solve the problem.public void removeInterval(IloNum start,IloNum end) constThis member function removes all intervals on the invoking interval list between startand end. If start is placed inside an interval [start1, end1), that is, start1 = 0 such that start + i * period < end, this functionremoves all intervals between start + i * period and start + duration+ i * period.public void setDifference(const IloIntervalList intervals) constThis member function removes from the invoking interval list all the intervalscontained in the interval list intervals. The definition interval of the invokinginterval list is not changed.public void setPeriodic(const IloIntervalList intervals,IloNum x0,IloNum n=IloInfinity) constThis member function initializes the invoking interval list as an interval list that repeatsthe interval list intervals n times after x0.public void setUnion(const IloIntervalList intervals) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 393


IloIntervalListThis member function sets the invoking interval list to be the union between the currentinterval list and the interval list intervals. An instance of IloException isthrown if two intervals with different types overlap. The definition interval of theinvoking interval list is set to the union between the current definition interval and thedefinition interval of intervals.public void shift(IloNum dx) constThis member function shifts the intervals of the invoking interval list from dx to theright if dx > 0 or from -dx to the left if dx < 0. It has no effect if dx = 0.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 394


IloIntervalListCursorIloIntervalListCursorCategoryClassInheritancePathDefinition Fileilconcert/ilointervals.hSummary Inspects the intervals of an interval list.Constructor SummarypublicpublicpublicIloIntervalListCursor(const IloIntervalList)IloIntervalListCursor(constIloIntervalList,IloNum x)IloIntervalListCursor(constIloIntervalListCursor &)Method Summarypublic IloNumpublic IloNumpublic IloNumpublic IloBoolpublic voidpublic voidpublic voidpublic voidgetEnd() constgetStart() constgetType() constok() constoperator++()operator--()operator=(const IloIntervalListCursor &)seek(IloNum)DescriptionAn instance of the class IloIntervalListCursor allows you to inspect theintervals of an interval list, that is, an instance of IloIntervalList. Cursors areintended to iterate forward or backward over the intervals of an interval list.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 395


IloIntervalListCursorNote: The structure of the interval list cannot be changed while a cursor isbeing used to inspect it. Therefore, functions that change the structure ofthe interval list, such as addInterval, should not be called while thecursor is being used.See AlsoConstructorsIloIntervalListpublic IloIntervalListCursor(const IloIntervalList)This constructor creates a cursor to inspect the interval list argument. This cursor letsyou iterate forward or backward over the intervals of the interval list. The cursor initiallyspecifies the first interval of the interval list.public IloIntervalListCursor(const IloIntervalList,IloNum x)This constructor creates a cursor to inspect the interval list intervals. This cursorlets you iterate forward or backward over the interval list. The cursor initially specifiesthe interval of the interval list that contains x.Note that if n is the number of intervals of the interval list given as argument, the worstcasecomplexity of this constructor is O(log(n)).public IloIntervalListCursor(const IloIntervalListCursor &)This constructor creates a new cursor that is a copy of the argument. The new cursorinitially specifies the same interval and the same interval list as the argument cursor.Methodspublic IloNum getEnd() constThis member function returns the end point of the interval currently specified by thecursor.public IloNum getStart() constThis member function returns the start point of the interval currently specified by thecursor.public IloNum getType() constThis member function returns the type of the interval currently specified by the cursor.public IloBool ok() constThis member function returns IloFalse if the cursor does not currently specify aninterval included in the interval list. Otherwise, it returns IloTrue.public void operator++()<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 396


IloIntervalListCursorThis operator moves the cursor to the interval adjacent to the current interval (forwardmove).public void operator--()This operator moves the cursor to the interval adjacent to the current interval (backwardmove).public void operator=(const IloIntervalListCursor &)This operator assigns an address to the handle pointer of the invoking instance ofIloIntervalListCursor. That address is the location of the implementationobject of the argument cursor. After the execution of this operator, the invoking objectand cursor both point to the same implementation object.public void seek(IloNum)This member function sets the cursor to specify the first interval of the interval listwhose end is strictly greater than x. Note that if n is the number of intervals of theinterval list traversed by the invoking iterator, the worst-case complexity of this memberfunction is O(log(n)). An instance of IloException is thrown if x does not belongto the interval of definition of the invoking interval list.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 397


IloMaxIloMaxCategoryDefinition FileGlobal Functionilconcert/ilonumfunc.hSynopsis public IloNumToNumStepFunction IloMax(const IloNumToNumStepFunction f1,const IloNumToNumStepFunction f2)SummaryDescriptionThis operator creates and returns a function equal to the maximal value of the functionsf1 and f2.This operator creates and returns a function equal to the maximal value of the functionsf1 and f2. That is, for all points x in the definition interval, the resulting function isequal to the max(f1(x), f2(x)). The argument functions f1 and f2 must bedefined on the same interval. The resulting function is defined on the same interval asthe arguments. See also: IloNumToNumStepFunction.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 398


IloMinIloMinCategoryDefinition FileGlobal Functionilconcert/ilonumfunc.hSynopsis public IloNumToNumStepFunction IloMin(const IloNumToNumStepFunction f1,const IloNumToNumStepFunction f2)Summary This operator creates and returns a function equal to the minimal value of the functionsf1 and f2.DescriptionThis operator creates and returns a function equal to the minimal value of the functionsf1 and f2. That is, for all points x in the definition interval, the resulting function isequal to the min(f1(x), f2(x)). The argument functions f1 and f2 must bedefined on the same interval. The resulting function is defined on the same interval asthe arguments. See also: IloNumToNumStepFunction.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 399


IloNumToAnySetStepFunctionIloNumToAnySetStepFunctionCategoryClassInheritancePathDefinition Fileilconcert/ilosetfunc.hSummary Represents a step function that associates sets with intervals.Constructor SummarypublicpublicIloNumToAnySetStepFunction(const IloEnvenv,IloNum xmin=-IloInfinity,IloNumxmax=IloInfinity,const char * name=0)IloNumToAnySetStepFunction(const IloEnvenv,IloNum xmin,IloNum xmax,const IloAnySetdval,const char * name=0)Method Summarypublic voidpublic voidpublic voidpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBooladd(const IloNumToAnySetStepFunction f) constadd(IloNum xMin,IloNum xMax,IloAny elt) constadd(IloNum xMin,IloNum xMax,const IloAnySetelts,IloBool complt=IloFalse) constalwaysContains(constIloNumToAnySetStepFunction f) constalwaysContains(IloNum xMin,IloNum xMax,constIloAnySet elts) constalwaysContains(IloNum xMin,IloNum xMax,IloAnyelt) constalwaysIntersects(constIloNumToAnySetStepFunction f) constalwaysIntersects(IloNum xMin,IloNumxMax,const IloAnySet elts) constcontains(IloNum x,const IloAnySet elts) constcontains(IloNum x,IloAny elt) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 400


IloNumToAnySetStepFunctionpubliccopy() constIloNumToAnySetStepFunctionpublic voiddilate(IloNum k) constpublic voidempty(IloNum xMin,IloNum xMax) constpublic IloBooleverContains(const IloNumToAnySetStepFunctionf) constpublic IloBooleverContains(IloNum xMin,IloNum xMax,constIloAnySet elts) constpublic IloBooleverContains(IloNum xMin,IloNum xMax,IloAnyelt) constpublic IloBooleverIntersects(constIloNumToAnySetStepFunction f) constpublic IloBooleverIntersects(IloNum xMin,IloNum xMax,constIloAnySet elts) constpublic voidfill(IloNum xMin,IloNum xMax) constpublic IloAnySetgetComplementSet(IloNum x) constpublic IloNumgetDefinitionIntervalMax() constpublic IloNumgetDefinitionIntervalMin() constpublic IloAnySetgetSet(IloNum x) constpublic IloBoolintersects(IloNum x,const IloAnySet elts)constpublic IloBoolisEmpty(IloNum x) constpublic IloBoolisFull(IloNum x) constpublic void remove(const IloNumToAnySetStepFunction f)constpublic voidremove(IloNum xMin,IloNum xMax,IloAny elt)constpublic voidremove(IloNum xMin,IloNum xMax,const IloAnySetelts,IloBool complt=IloFalse) constpublic voidset(IloNum xMin,IloNum xMax,IloAny elt) constpublic voidset(IloNum xMin,IloNum xMax,const IloAnySetelts,IloBool complt=IloFalse) constpublic voidsetIntersection(constIloNumToAnySetStepFunction f) constpublic voidsetIntersection(IloNum xMin,IloNumxMax,IloAny elt) constpublic voidsetIntersection(IloNum xMin,IloNum xMax,constIloAnySet elts,IloBool complt=IloFalse) constpublic voidsetPeriodic(const IloNumToAnySetStepFunctionf,IloNum x0,IloNum n,const IloAnySet dval)constpublic voidshift(IloNum dx,const IloAnySet dval) constpublic IloBool usesComplementaryRepresentation(IloNum x)const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 401


IloNumToAnySetStepFunctionDescriptionSee AlsoConstructorsAn instance of IloNumToAnySetStepFunction represents a step function thatassociates sets with intervals. It is defined everywhere on an interval [xMin,xMax). Eachinterval [x1,x2) on which the function has the same set is called a step.Note that if n is the number of steps of the function, the random access to a given step(see the member functions add, alwaysIntersects, contains, empty,everContains, everIntersects, fill, getComplementSet, getSet,intersects, isEmpty, isFull, remove, set, and setIntersection) has aworst-case complexity of O(log(n)).Complementary Representation of ValuesIloNumToAnySetStepFunction allows the implicit representation of infinite setsthrough the representation of the complement of the actual set value. This, for example,allows you to completely fill a set (using the fill member function) and then specifythe elements that are not in the set. Under normal circumstances, it is not necessary toknow if the value of the step function at a particular point is represented by the set or itscomplement: all the member functions that manipulate the step function value willcorrectly adapt to either representation. The only case where it is necessary to know theinternal representation is if you want to directly access the set that represents a value(using the getSet or getComplementSet member functions). In that circumstanceonly, it is necessary to use the usesComplementaryRepresentation memberfunction to determine the internal representation, and then use either getSet orgetComplementSet depending on the return value ofusesComplementaryRepresentation. Note that getSet will raise an error if itis used to access a set that is represented as a complement set. getComplementSetwill raise an error if it is used to access a set that is directly represented.IloNumToAnySetStepFunctionCursorpublic IloNumToAnySetStepFunction(const IloEnv env,IloNum xmin=-IloInfinity,IloNum xmax=IloInfinity,const char * name=0)This constructor creates a step function defined everywhere on the interval [xMin,xMax) with empty set as the value.public IloNumToAnySetStepFunction(const IloEnv env,IloNum xmin,IloNum xmax,const IloAnySet dval,const char * name=0)This constructor creates a step function defined everywhere on the interval [xMin,xMax) with the same set dval.Methodspublic void add(const IloNumToAnySetStepFunction f) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 402


IloNumToAnySetStepFunctionThis member function adds the value of f at point x to the value of the invoking stepfunction at point x, for all points x in the definition interval of the invoking stepfunction. An instance of IloException is thrown if the definition interval of f is notequal to the definition interval of the invoking step function.public void add(IloNum xMin,IloNum xMax,IloAny elt) constThis member function adds elt to the value of the invoking step function on theinterval [xMin, xMax).public void add(IloNum xMin,IloNum xMax,const IloAnySet elts,IloBool complt=IloFalse) constThis member function adds the elements of elts to the value of the invoking stepfunction on the interval [xMin, xMax).public IloBool alwaysContains(const IloNumToAnySetStepFunction f) constThis member function returns IloTrue if for all points x on the definition interval ofthe invoking step function, the value of f at point x is a subset of the value of theinvoking step function at point x. An instance of IloException is thrown if thedefinition interval of f is not equal to the definition interval of the invoking stepfunction.public IloBool alwaysContains(IloNum xMin,IloNum xMax,const IloAnySet elts) constThis member function returns IloTrue if elts is a subset of the value of the invokingstep function at all points on the interval [xMin, xMax).public IloBool alwaysContains(IloNum xMin,IloNum xMax,IloAny elt) constThis member function returns IloTrue if at all points on the interval [xMin,xMax) the value of the invoking step function contains elt.public IloBool alwaysIntersects(const IloNumToAnySetStepFunction f) constThis member function returns IloTrue if for all points x in the definition interval ofthe invoking step function, the intersection of f and the invoking step function is notempty. An instance of IloException is thrown if the definition interval of f is notequal to the definition interval of the invoking step function.public IloBool alwaysIntersects(IloNum xMin,IloNum xMax,const IloAnySet elts) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 403


IloNumToAnySetStepFunctionThis member function returns IloTrue if for all x on the interval [xMin, xMax)the intersection of elts and the value of the invoking step function at point x is notempty.public IloBool contains(IloNum x,const IloAnySet elts) constThis member function returns IloTrue if elts is a subset of the value of the invokingstep function at point x.public IloBool contains(IloNum x,IloAny elt) constThis member function returns IloTrue if the invoking step function contains elementelt at point x.public IloNumToAnySetStepFunction copy() constThis member function creates and returns a new function that is a copy of the invokingfunction.public void dilate(IloNum k) constThis member function multiplies by k the scale of x for the invoking step function. kmust be a nonnegative numeric value. More precisely, if the invoking step function wasdefined over an interval [xMin, xMax), it will be redefined over the interval[k*xMin, k*xMax) and the value at x will be the former value at x/k.public void empty(IloNum xMin,IloNum xMax) constThis member function sets the value of the invoking step function on the interval[xMin, xMax) to be the empty set.public IloBool everContains(const IloNumToAnySetStepFunction f) constThis member function returns IloTrue if at any point x in the definition interval of theinvoking step function, f at point x is a subset of the invoking step function at point x.An instance of IloException is thrown if the definition interval of f is not equal tothe definition interval of the invoking step function.public IloBool everContains(IloNum xMin,IloNum xMax,const IloAnySet elts) constThis member function returns IloTrue if at any point on the interval [xMin,xMax)elts is a subset of the value of the invoking step function.public IloBool everContains(IloNum xMin,IloNum xMax,IloAny elt) constThis member function returns IloTrue if at any point on the interval [xMin,xMax) the value of the invoking step function contains elt.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 404


IloNumToAnySetStepFunctionpublic IloBool everIntersects(const IloNumToAnySetStepFunction f) constThis member function returns IloTrue if at some point x in the definition interval ofthe invoking step function, the intersection of f and the invoking step function is notempty. An instance of IloException is thrown if the definition interval of f is notequal to the definition interval of the invoking step function.public IloBool everIntersects(IloNum xMin,IloNum xMax,const IloAnySet elts) constThis member function returns IloTrue if at any point x on the interval [xMin,xMax) the intersection of elts and the value of the invoking step function at point xis not empty.public void fill(IloNum xMin,IloNum xMax) constThis member function sets the value of the invoking step function on the interval[xMin, xMax) to be the full set.public IloAnySet getComplementSet(IloNum x) constThis member function returns the complement of the value of the invoking step functionat point x. An instance of IloException is thrown if the invoking step function atpoint x does not use the complementary representation. See ComplementaryRepresentation of Values for more information.public IloNum getDefinitionIntervalMax() constThis member function returns the right-most point of the definition interval of theinvoking step function.public IloNum getDefinitionIntervalMin() constThis member function returns the left-most point of the definition interval of theinvoking step function.public IloAnySet getSet(IloNum x) constThis member function returns the value of the invoking step function at point x. Aninstance of IloException is thrown if the invoking step function at point x uses thecomplementary representation. See Complementary Representation of Values for moreinformation.public IloBool intersects(IloNum x,const IloAnySet elts) constThis member function returns IloTrue if the intersection of elts and the value of theinvoking step function at point x is not empty.public IloBool isEmpty(IloNum x) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 405


IloNumToAnySetStepFunctionThis member function returns IloTrue if the function is empty at point x. In otherwords, a return of IloTrue means that the member function empty has been appliedto point x and no elements have been subsequently added to the value of the invokingstep function at point x.public IloBool isFull(IloNum x) constThis member function returns IloTrue if the function is full at point x. In other words,a return of IloTrue means that the member function fill has been applied to pointx and no elements have been subsequently removed from the value of the invoking stepfunction at point x.public void remove(const IloNumToAnySetStepFunction f) constThis member function removes the value of f from the value of the invoking stepfunction at all points on the definition interval of the invoking step function. An instanceof IloException is thrown if the definition interval of f is not equal to the definitioninterval of the invoking step function.public void remove(IloNum xMin,IloNum xMax,IloAny elt) constThis member function removes elt from the value of the invoking step function on theinterval [xMin, xMax).public void remove(IloNum xMin,IloNum xMax,const IloAnySet elts,IloBool complt=IloFalse) constThis member function removes all the elements in elts from the value of the invokingstep function on the interval [xMin, xMax).public void set(IloNum xMin,IloNum xMax,IloAny elt) constThis member function sets the value of the invoking step function to be elt on theinterval [xMin, xMax).public void set(IloNum xMin,IloNum xMax,const IloAnySet elts,IloBool complt=IloFalse) constThis member function sets the value of the invoking step function to be elts on theinterval [xMin, xMax).public void setIntersection(const IloNumToAnySetStepFunction f) constThis member function assigns the value of the invoking step function at all points x onthe definition interval of the invoking step function to be the intersection of the value of<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 406


IloNumToAnySetStepFunctionf at point x and the value of the invoking step function at point x. An instance ofIloException is thrown if the definition interval of f is not equal to the definitioninterval of the invoking step function.public void setIntersection(IloNum xMin,IloNum xMax,IloAny elt) constThis member function assigns the value of the invoking step function at all points x onthe interval [xMin, xMax) to be the intersection of the set containing elt and thevalue of the invoking set function at point x.public void setIntersection(IloNum xMin,IloNum xMax,const IloAnySet elts,IloBool complt=IloFalse) constThis member function assigns the value of the invoking step function at all points x onthe interval [xMin, xMax) to be the intersection of elts and the value of theinvoking set function at point x.public void setPeriodic(const IloNumToAnySetStepFunction f,IloNum x0,IloNum n,const IloAnySet dval) constThis member function initializes the invoking step function as a function that repeats thestep function f, n times after x0. More precisely, if f is defined on[xfpMin,xfpMax) and if the invoking step function is defined on [xMin,xMax),the value of the invoking step function will be:◆◆◆dval on [xMin, x0),f((x-x0) % (xfpMax-xfpMin)) for x in [x0, Min(x0+n*(xfpMaxxfpMin),xMax)), anddval on [Min(x0+n*(xfpMax-xfpMin), xMax), xMax)public void shift(IloNum dx,const IloAnySet dval) constThis member function shifts the invoking step function from dx to the right if dx > 0,or from -dx to the left if dx < 0. It has no effect if dx = 0. More precisely, if theinvoking step function is defined on [xMin,xMax) and dx > 0, the new value of theinvoking step function is:◆dval on the interval [xMin, xMin+dx),◆ for all x in [xMin+dx, xMax), the former value at x-dx.If dx < 0, the new value of the invoking step function is:◆for all x in [xMin, xMax+dx), the former value at x-dx,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 407


IloNumToAnySetStepFunction◆dval on the interval [xMax+dx, xMax).public IloBool usesComplementaryRepresentation(IloNum x) constThis member function returns IloTrue if the value of the invoking function at point xis represented by a complementary set, rather than by directly representing the value as aset itself. See Complementary Representation of Values for more information.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 408


IloNumToAnySetStepFunctionCursorIloNumToAnySetStepFunctionCursorCategoryClassInheritancePathDefinition Fileilconcert/ilosetfunc.hSummary Allows you to inspect the contents of an IloNumToAnySetStepFunction.Constructor SummarypublicpublicpublicIloNumToAnySetStepFunctionCursor(constIloNumToAnySetStepFunction)IloNumToAnySetStepFunctionCursor(constIloNumToAnySetStepFunction,IloNum x)IloNumToAnySetStepFunctionCursor(constIloNumToAnySetStepFunctionCursor &)Method Summarypublic IloAnySetpublic IloNumpublic IloNumpublic IloAnySetpublic IloBoolpublic IloBoolpublic IloBoolpublic voidpublic voidpublic voidpublic voidpublic IloBoolgetComplementSet() constgetSegmentMax() constgetSegmentMin() constgetSet() constisEmpty() constisFull() constok() constoperator++()operator--()operator=(constIloNumToAnySetStepFunctionCursor &)seek(IloNum)usesComplementaryRepresentation() constDescriptionAn instance of the class IloNumToAnySetStepFunctionCursor allows you toinspect the contents of an IloNumToAnySetStepFunction. A step of a step<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 409


IloNumToAnySetStepFunctionCursorfunction is defined as an interval [x1,x2) over which the value of the function is thesame. Cursors are intended to iterate forward or backward over the steps of a stepfunction.Note: The structure of the step function cannot be changed while a cursoris being used to inspect it. Therefore, functions that change the structure ofthe step function, such as set, should not be called while the cursor isbeing used.See AlsoConstructorsMethodsIloNumToAnySetStepFunctionpublic IloNumToAnySetStepFunctionCursor(constIloNumToAnySetStepFunction)This constructor creates a cursor to inspect the step function argument. This cursor letsyou iterate forward or backward over the steps of the function. The cursor initiallyspecifies the first step of the function.public IloNumToAnySetStepFunctionCursor(constIloNumToAnySetStepFunction,IloNum x)This constructor creates a cursor to inspect the step function argument. This cursor letsyou iterate forward or backward over the steps of the function. The cursor initiallyspecifies the step of the function that contains x.Note that if n is the number of steps of the function given as argument, the worst-casecomplexity of this constructor is O(log(n)).public IloNumToAnySetStepFunctionCursor(constIloNumToAnySetStepFunctionCursor &)This constructor creates a new cursor that is a copy of the argument. The new cursorinitially specifies the same step and the same function as the argument cursor.public IloAnySet getComplementSet() constThis member function returns the set representing the complement of the value of thestep currently specified by the cursor. An instance of IloException is thrown if thevalue of the step does not use a complementary representation.public IloNum getSegmentMax() constThis member function returns the right-most point of the step currently specified by thecursor.public IloNum getSegmentMin() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 410


IloNumToAnySetStepFunctionCursorThis member function returns the left-most point of the step currently specified by thecursor.public IloAnySet getSet() constThis member function returns the value of the step currently specified by the cursor. Aninstance of IloException is thrown if the value of the step uses a complementaryrepresentation.public IloBool isEmpty() constThis member function returns IloTrue if the value of the current step is the empty set.public IloBool isFull() constThis member function returns IloTrue if the value of the current step is the full set.(See also: isFull).public IloBool ok() constThis member function returns IloFalse if the cursor does not currently specify a stepincluded in the definition interval of the step function. Otherwise, it returns IloTrue.public void operator++()This operator moves the cursor to the step adjacent to the current step (forward move).public void operator--()This operator moves the cursor to the step adjacent to the current step (backward move).public void operator=(const IloNumToAnySetStepFunctionCursor &)This operator assigns an address to the handle pointer of the invoking instance ofIloNumToAnySetStepFunctionCursor. That address is the location of theimplementation object of the argument cursor. After the execution of this operator,the invoking object and cursor both point to the same implementation object.public void seek(IloNum)This member function sets the cursor to specify the step of the function that contains x.Note that if n is the number of steps of the step function traversed by the invokingiterator, the worst-case complexity of this member function is O(log(n)). An instance ofIloException is thrown if x does not belong to the definition interval of theinvoking function.public IloBool usesComplementaryRepresentation() constThis member function returns IloTrue if the value of the current step uses thecomplementary representation.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 411


IloNumToNumSegmentFunctionIloNumToNumSegmentFunctionCategoryClassInheritancePathDefinition Fileilconcert/ilosegfunc.hSummary Piecewise linear function over a segment.Constructor SummarypublicpublicpublicIloNumToNumSegmentFunction(const IloEnvenv,IloNum xmin=-IloInfinity,IloNumxmax=IloInfinity,IloNum dval=0.0,const char *name=0)IloNumToNumSegmentFunction(const IloEnvenv,const IloNumArray x,const IloNumArrayv,IloNum xmin=-IloInfinity,IloNumxmax=IloInfinity,const char * name=0)IloNumToNumSegmentFunction(constIloNumToNumStepFunction & numFunction)Method Summarypublic voidpublicIloNumToNumSegmentFunctionpublic voidpublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic voidaddValue(IloNum x1,IloNum x2,IloNum v) constcopy() constdilate(IloNum k) constgetArea(IloNum x1,IloNum x2) constgetDefinitionIntervalMax() constgetDefinitionIntervalMin() constgetMax(IloNum x1,IloNum x2) constgetMin(IloNum x1,IloNum x2) constgetValue(IloNum x) constoperator *=(IloNum k) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 412


IloNumToNumSegmentFunctionpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidoperator+=(const IloNumToNumSegmentFunctionfct) constoperator-=(const IloNumToNumSegmentFunctionfct) constsetMax(const IloNumToNumSegmentFunction fct)constsetMax(IloNum x1,IloNum v1,IloNum x2,IloNumv2) constsetMax(IloNum x1,IloNum x2,IloNum v) constsetMin(const IloNumToNumSegmentFunction fct)constsetMin(IloNum x1,IloNum v1,IloNum x2,IloNumv2) constsetMin(IloNum x1,IloNum x2,IloNum v) constsetPeriodic(const IloNumToNumSegmentFunctionf,IloNum x0,IloNum n=IloInfinity,IloNumdval=0) constsetPeriodicValue(IloNum x1,IloNum x2,constIloNumToNumSegmentFunction f,IloNum offset=0)constsetPoints(const IloNumArray x,constIloNumArray v) constsetSlope(IloNum x1,IloNum x2,IloNum v,IloNumslope) constsetValue(IloNum x1,IloNum x2,IloNum v) constshift(IloNum dx,IloNum dval=0) constDescriptionAn instance of IloNumToNumSegmentFunction represents a piecewise linearfunction that is defined everywhere on an interval [xMin, xMax). Each interval [x1, x2)on which the function is linear is called a segment.Note that if n is the number of segments of the function, the random access to a givensegment (see the member functions addValue, getArea, getValue, setValue)has a worst-case complexity in O(log(n)).Furthermore, when two consecutive segments of the function are co-linear, thesesegments are merged so that the function is always represented with the minimal numberof segments.See AlsoConstructorsIloNumToNumSegmentFunctionCursorpublic IloNumToNumSegmentFunction(const IloEnv env,IloNum xmin=-IloInfinity,IloNum xmax=IloInfinity,IloNum dval=0.0,const char * name=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 413


IloNumToNumSegmentFunctionThis constructor creates a piecewise linear function that is constant. It is definedeverywhere on the interval [xmin,xmax) with the same value dval.public IloNumToNumSegmentFunction(const IloEnv env,const IloNumArray x,const IloNumArray v,IloNum xmin=-IloInfinity,IloNum xmax=IloInfinity,const char * name=0)This constructor creates a piecewise linear function defined everywhere on the interval[xmin, xmax) whose segments are defined by the two argument arrays x and v.More precisely, the size n of array x must be equal to the size of array v and, if thecreated function is defined on the interval [xmin,xmax), its values will be:◆◆◆v[0] on interval [xmin, x[0]),v[i] + (t-x[i])*(v[i+1]-v[i])/(x[i+1]-x[i]) for t in [x[i],x[i+1]) for all i in [0, n-2] such that x[i-1] x[i], andv[n-1] on interval [x[n-1],xmax).public IloNumToNumSegmentFunction(const IloNumToNumStepFunction &numFunction)This copy constructor creates a new piecewise linear function. The new piecewise linearfunction is a copy of the step function numFunction. They point to differentimplementation objects.Methods public void addValue(IloNum x1,IloNum x2,IloNum v) constThis member function adds v to the value of the invoking piecewise linear functioneverywhere on the interval [x1,x2).public IloNumToNumSegmentFunction copy() constThis member function creates and returns a new function that is a copy of the invokingfunction.public void dilate(IloNum k) constThis member function multiplies by k the scale of x for the invoking piecewise linearfunction. k must be a nonnegative numeric value. More precisely, if the invokingfunction was defined over an interval [xMin,xMax), it will be redefined over theinterval [k*xMin,k*xMax) and the value at x will be the former value at x/k.public IloNum getArea(IloNum x1,IloNum x2) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 414


IloNumToNumSegmentFunctionThis member function returns the area of the invoking piecewise linear function on theinterval [x1,x2). An instance of IloException is thrown if the interval [x1,x2)is not included in the definition interval of the invoking function.public IloNum getDefinitionIntervalMax() constThis member function returns the right-most point of the definition interval of theinvoking piecewise linear function.public IloNum getDefinitionIntervalMin() constThis member function returns the left-most point of the definition interval of theinvoking piecewise linear function.public IloNum getMax(IloNum x1,IloNum x2) constThis member function returns the maximal value of the invoking piecewise linearfunction on the interval [x1,x2). An instance of IloException is thrown if theinterval [x1,x2) is not included in the definition interval of the invoking function.public IloNum getMin(IloNum x1,IloNum x2) constThis member function returns the minimal value of the invoking piecewise linearfunction on the interval [x1,x2). An instance of IloException is thrown if theinterval [x1,x2) is not included in the definition interval of the invoking function.public IloNum getValue(IloNum x) constThis member function returns the value of the function at point x.public void operator *=(IloNum k) constThis operator multiplies by a factor k the value of the invoking piecewise linear functioneverywhere on the definition interval.public void operator+=(const IloNumToNumSegmentFunction fct) constThis operator adds the argument function fct to the invoking piecewise linear function.public void operator-=(const IloNumToNumSegmentFunction fct) constThis operator subtracts the argument function fct from the invoking piecewise linearfunction.public void setMax(const IloNumToNumSegmentFunction fct) constThis member function sets the value of the invoking piecewise linear function to be themaximum between the current value and the value of fct everywhere on the definitioninterval of the invoking function. The interval of definition of fct must be the same asthat of the invoking piecewise linear function.public void setMax(IloNum x1,IloNum v1,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 415


IloNumToNumSegmentFunctionIloNum x2,IloNum v2) constThis member function sets the value of the invoking piecewise linear function to be themaximum between the current value and the value of the linear function:x --> v1 + (x-x1)*(v2-v1)/(x2-x1) everywhere on the interval [x1,x2).public void setMax(IloNum x1,IloNum x2,IloNum v) constThis member function sets the value of the invoking piecewise linear function to be themaximum between the current value and v everywhere on the interval [x1,x2).public void setMin(const IloNumToNumSegmentFunction fct) constThis member function sets the value of the invoking piecewise linear function to be theminimum between the current value and the value of fct everywhere on the definitioninterval of the invoking function. The definition interval of fct must be the same as theone of the invoking piecewise linear function.public void setMin(IloNum x1,IloNum v1,IloNum x2,IloNum v2) constThis member function sets the value of the invoking piecewise linear function to be theminimum between the current value and the value of the linear function:x --> v1 + (x-x1)*(v2-v1)/(x2-x1) everywhere on the interval [x1,x2).public void setMin(IloNum x1,IloNum x2,IloNum v) constThis member function sets the value of the invoking piecewise linear function to be theminimum between the current value and v everywhere on the interval [x1,x2).public void setPeriodic(const IloNumToNumSegmentFunction f,IloNum x0,IloNum n=IloInfinity,IloNum dval=0) constThis member function initializes the invoking function as a piecewise linear functionthat repeats the piecewise linear function f, n times after x0. More precisely, if f isdefined on [xfpMin,xfpMax) and if the invoking function is defined on[xMin,xMax), the value of the invoking function will be:◆◆dval on [xMin, x0),f((x-x0) % (xfpMax-xfpMin)) for x in [x0, Min(x0+n*(xfpMaxxfpMin),xMax)), and<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 416


IloNumToNumSegmentFunction◆dval on [Min(x0+n*(xfpMax-xfpMin), xMax), xMax)public void setPeriodicValue(IloNum x1,IloNum x2,const IloNumToNumSegmentFunction f,IloNum offset=0) constThis member function changes the value of the invoking function on the interval[x1,x2). On this interval, the invoking function is set to equal a repetition of thepattern function f with an initial offset of offset. The invoking function is notmodified outside the interval [x1,x2). More precisely, if [min,max) denotes thedefinition interval of f, for all t in [x1,x2), the invoking function at t is set to equalf(min + (offset+t-x1)%(max-min))) where % denotes the modulo operator.By default, the offset is equal to 0.public void setPoints(const IloNumArray x,const IloNumArray v) constThis member function initializes the invoking function as a piecewise linear functionwhose segments are defined by the two argument arrays x and v.More precisely, the size n of array x must be equal to the size of array v, and if thecreated function is defined on the interval [xmin,xmax), its values will be:◆◆◆v[0] on interval [xmin, x[0]),v[i] + (t-x[i])*(v[i+1]-v[i])/(x[i+1]-x[i]) for t in [x[i],x[i+1]) for all i in [0, n-2] such that x[i-1] ? x[i], andv[n-1] on interval [x[n-1],xmax).public void setSlope(IloNum x1,IloNum x2,IloNum v,IloNum slope) constThis member function sets the value of the invoking piecewise linear function equal tof, associating for each x in [x1,x2) -> f(x) = v + slope * (x-x1).public void setValue(IloNum x1,IloNum x2,IloNum v) constThis member function sets the value of the invoking piecewise linear function to beconstant and equal to v on the interval [x1,x2).public void shift(IloNum dx,IloNum dval=0) constThis member function shifts the invoking function from dx to the right if dx > 0 or -dx to the left if dx < 0. It has no effect if dx = 0. More precisely, if the invokingfunction is defined on [xMin,xMax) and dx > 0, the new value of the invokingfunction is:<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 417


IloNumToNumSegmentFunction◆ dval on the interval [xMin,xMin+dx),◆ for all x in [xMin+dx,xMax), the former value at x-dx.If dx < 0, the new value of the invoking function is:◆ for all x in [xMin,xMax+dx), the former value at x-dx,◆ dval on the interval [xMax+dx,xMax).<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 418


IloNumToNumSegmentFunctionCursorIloNumToNumSegmentFunctionCursorCategoryClassInheritancePathDefinition Fileilconcert/ilosegfunc.hSummary Cursor over segments of a piecewise linear function.Constructor SummarypublicpublicIloNumToNumSegmentFunctionCursor(constIloNumToNumSegmentFunction,IloNum x)IloNumToNumSegmentFunctionCursor(constIloNumToNumSegmentFunctionCursor &)Method Summarypublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic IloBoolpublic voidpublic voidpublic voidgetSegmentMax() constgetSegmentMin() constgetValue(IloNum t) constgetValueLeft() constgetValueRight() constok() constoperator++()operator--()seek(IloNum)DescriptionAn instance of the class IloNumToNumSegmentFunctionCursor allows you toinspect the contents of an IloNumToNumSegmentFunction. A segment of apiecewise linear function is defined as an interval [x1, x2) over which the function islinear. Cursors are intended to iterate forward or backward over the segments of apiecewise linear function.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 419


IloNumToNumSegmentFunctionCursorNote: The structure of the piecewise linear function cannot be changedwhile a cursor is being used to inspect it. Therefore, functions that changethe structure of the piecewise linear function, such as setValue, shouldnot be called while the cursor is being used.See AlsoConstructorsMethodsIloNumToNumSegmentFunctionpublic IloNumToNumSegmentFunctionCursor(constIloNumToNumSegmentFunction,IloNum x)This constructor creates a cursor to inspect the piecewise linear function argument. Thiscursor lets you iterate forward or backward over the segments of the function. Thecursor initially specifies the segment of the function that contains x.Note that if n is the number of steps of the function given as argument, the worst-casecomplexity of this constructor is O(log(n)).public IloNumToNumSegmentFunctionCursor(constIloNumToNumSegmentFunctionCursor &)This constructor creates a new cursor that is a copy of the argument cursor. The newcursor initially specifies the same segment and the same function as the argumentcursor.public IloNum getSegmentMax() constThis member function returns the right-most point of the segment currently specified bythe cursor.public IloNum getSegmentMin() constThis member function returns the left-most point of the segment currently specified bythe cursor.public IloNum getValue(IloNum t) constThis member function returns the value of the piecewise linear function at time t. tmust be between the left-most and the right-most point of the segment currentlyspecified by the cursor.public IloNum getValueLeft() constThis member function returns the value of the function at the left-most point of thesegment currently specified by the cursor.public IloNum getValueRight() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 420


IloNumToNumSegmentFunctionCursorThis member function returns the value of the function at the right-most point of thesegment currently specified by the cursor.public IloBool ok() constThis member function returns IloFalse if the cursor does not currently specify asegment included in the definition interval of the piecewise linear function. Otherwise, itreturns IloTrue.public void operator++()This operator moves the cursor to the segment adjacent to the current step (forwardmove).public void operator--()This operator moves the cursor to the segment adjacent to the current step (backwardmove).public void seek(IloNum)This member function sets the cursor to specify the segment of the function that containsx. An IloException is thrown if x does not belong to the definition interval of thepiecewise linear function associated with the invoking cursor.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 421


IloNumToNumStepFunctionIloNumToNumStepFunctionCategoryClassInheritancePathDefinition Fileilconcert/ilonumfunc.hSummary Represents a step function that is defined everywhere on an interval.Constructor SummarypublicpublicIloNumToNumStepFunction(const IloEnvenv,IloNum xmin=-IloInfinity,IloNumxmax=IloInfinity,IloNum dval=0.0,const char *name=0)IloNumToNumStepFunction(const IloEnvenv,const IloNumArray x,const IloNumArrayv,IloNum xmin=-IloInfinity,IloNumxmax=IloInfinity,const char * name=0)Method Summarypublic voidpublicIloNumToNumStepFunctionpublic voidpublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic voidpublic voidaddValue(IloNum x1,IloNum x2,IloNum v) constcopy() constdilate(IloNum k) constgetArea(IloNum x1,IloNum x2) constgetDefinitionIntervalMax() constgetDefinitionIntervalMin() constgetMax(IloNum x1,IloNum x2) constgetMin(IloNum x1,IloNum x2) constgetValue(IloNum x) constoperator *=(IloNum k) constoperator+=(const IloNumToNumStepFunction fct)const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 422


IloNumToNumStepFunctionpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidoperator-=(const IloNumToNumStepFunction fct)constsetMax(const IloNumToNumStepFunction fct) constsetMax(IloNum x1,IloNum x2,IloNum v) constsetMin(const IloNumToNumStepFunction fct) constsetMin(IloNum x1,IloNum x2,IloNum v) constsetPeriodic(const IloNumToNumStepFunctionf,IloNum x0,IloNum n=IloInfinity,IloNumdval=0) constsetPeriodicValue(IloNum x1,IloNum x2,constIloNumToNumStepFunction f,IloNum offset=0)constsetSteps(const IloNumArray x,constIloNumArray v) constsetValue(IloNum x1,IloNum x2,IloNum v) constshift(IloNum dx,IloNum dval=0) constDescriptionAn instance of IloNumToNumStepFunction represents a step function that isdefined everywhere on an interval [xMin, xMax). Each interval [x1, x2) on which thefunction has the same value is called a step.Note that if n is the number of steps of the function, the random access to a given step(see the member functions addValue, getArea, getValue, setValue) has aworst-case complexity in O(log(n)).Furthermore, when two consecutive steps of the function have the same value, thesesteps are merged so that the function is always represented with the minimal number ofsteps.See AlsoConstructorsIloNumToNumStepFunctionCursorpublic IloNumToNumStepFunction(const IloEnv env,IloNum xmin=-IloInfinity,IloNum xmax=IloInfinity,IloNum dval=0.0,const char * name=0)This constructor creates a step function defined everywhere on the interval [xmin,xmax) with the same value dval.public IloNumToNumStepFunction(const IloEnv env,const IloNumArray x,const IloNumArray v,IloNum xmin=-IloInfinity,IloNum xmax=IloInfinity,const char * name=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 423


IloNumToNumStepFunctionThis constructor creates a step function defined everywhere on the interval [xmin,xmax) whose steps are defined by the two argument arrays x and v. More precisely, ifn is the size of array x, size of array v must be n+1 and, if the created function isdefined on the interval [xmin,xmax), its values will be:◆◆v[0] on interval [xmin,x[0]),v[i] on interval [x[i-1],x[i]) for all i in [0,n-1], and◆ v[n] on interval [x[n-1],xmax).The values in the array are copied, and no modification to the arrays will be taken intoaccount once the constructor has been called.Methods public void addValue(IloNum x1,IloNum x2,IloNum v) constThis member function adds v to the value of the invoking step function everywhere onthe interval [x1, x2).public IloNumToNumStepFunction copy() constThis member function creates and returns a new function that is a copy of the invokingfunction.public void dilate(IloNum k) constThis member function multiplies by k the scale of x for the invoking step function. kmust be a nonnegative numeric value. More precisely, if the invoking function wasdefined over an interval [xMin, xMax), it will be redefined over the interval[k*xMin, k*xMax) and the value at x will be the former value at x/k.public IloNum getArea(IloNum x1,IloNum x2) constThis member function returns the sum of the invoking step function on the interval[x1, x2). An instance of IloException is thrown if the interval [x1, x2) isnot included in the definition interval of the invoking function.public IloNum getDefinitionIntervalMax() constThis member function returns the right-most point of the definition interval of theinvoking step function.public IloNum getDefinitionIntervalMin() constThis member function returns the left-most point of the definition interval of theinvoking step function.public IloNum getMax(IloNum x1,IloNum x2) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 424


IloNumToNumStepFunctionThis member function returns the maximal value of the invoking step function on theinterval [x1, x2). An instance of IloException is thrown if the interval [x1,x2) is not included in the definition interval of the invoking function.public IloNum getMin(IloNum x1,IloNum x2) constThis member function returns the minimal value of the invoking step function on theinterval [x1, x2). An instance of IloException is thrown if the interval [x1,x2) is not included in the definition interval of the invoking function.public IloNum getValue(IloNum x) constThis member function returns the value of the invoking step function at x. An instanceof IloException is thrown if x does not belong to the definition interval of theinvoking function.public void operator *=(IloNum k) constThis operator multiplies by a factor k the value of the invoking step function everywhereon the definition interval.public void operator+=(const IloNumToNumStepFunction fct) constThis operator adds the argument function fct to the invoking step function.public void operator-=(const IloNumToNumStepFunction fct) constThis operator subtracts the argument function fct from the invoking step function.public void setMax(const IloNumToNumStepFunction fct) constThis member function sets the value of the invoking step function to be the maximumbetween the current value and the value of fct everywhere on the definition interval ofthe invoking function. The interval of definition of fct must be the same as that of theinvoking step function.public void setMax(IloNum x1,IloNum x2,IloNum v) constThis member function sets the value of the invoking step function to be the maximumbetween the current value and v everywhere on the interval [x1, x2).public void setMin(const IloNumToNumStepFunction fct) constThis member function sets the value of the invoking step function to be the minimumbetween the current value and the value of fct everywhere on the definition interval ofthe invoking function. The definition interval of fct must be the same as the one of theinvoking step function.public void setMin(IloNum x1,IloNum x2,IloNum v) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 425


IloNumToNumStepFunctionThis member function sets the value of the invoking step function to be the minimumbetween the current value and v everywhere on the interval [x1, x2).public void setPeriodic(const IloNumToNumStepFunction f,IloNum x0,IloNum n=IloInfinity,IloNum dval=0) constThis member function initializes the invoking function as a step function that repeats thestep function f, n times after x0. More precisely, if f is defined on[xfpMin,xfpMax) and if the invoking function is defined on [xMin,xMax), thevalue of the invoking function will be:◆◆◆dval on [xMin, x0),fp((x-x0) % (xfpMax-xfpMin)) for x in [x0, Min(x0+n*(xfpMaxxfpMin),xMax)), anddval on [Min(x0+n*(xfpMax-xfpMin), xMax), xMax)public void setPeriodicValue(IloNum x1,IloNum x2,const IloNumToNumStepFunction f,IloNum offset=0) constThis member function changes the value of the invoking function on the interval[x1,x2). On this interval, the invoking function is set to equal a repetition of thepattern function f with an initial offset of offset. The invoking function is notmodified outside the interval [x1,x2). More precisely, if [min,max) denotes thedefinition interval of f, for all t in [x1,x2), the invoking function at t is set to equalf(min + (offset+t-x1)%(max-min))) where % denotes the modulo operator.By default, the offset is equal to 0.public void setSteps(const IloNumArray x,const IloNumArray v) constThis member function initializes the invoking function as a step function whose stepsare defined by the two arguments arrays x and v. More precisely, if n is the size of arrayx, size of array v must be n+1 and, if the invoking function is defined on the interval[xMin,xMax), its values will be:◆◆◆v[0] on interval [xMin,x[0]),v[i] on interval [x[i-1],x[i]) for all i in [0,n-1], andv[n] on interval [x[n-1],xMax).public void setValue(IloNum x1,IloNum x2,IloNum v) constThis member function sets the value of the invoking step function to be v on the interval[x1, x2).<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 426


IloNumToNumStepFunctionpublic void shift(IloNum dx,IloNum dval=0) constThis member function shifts the invoking function from dx to the right if dx > 0 orfrom -dx to the left if dx < 0. It has no effect if dx = 0. More precisely, if theinvoking function is defined on [xMin,xMax) and dx > 0, the new value of theinvoking function is:◆dval on the interval [xMin, xMin+dx),◆ for all x in [xMin+dx, xMax), the former value at x-dx.If dx < 0, the new value of the invoking function is:◆◆for all x in [xMin, xMax+dx), the former value at x-dx,dval on the interval [xMax+dx,xMax).<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 427


IloNumToNumStepFunctionCursorIloNumToNumStepFunctionCursorCategoryClassInheritancePathDefinition Fileilconcert/ilonumfunc.hSummary Allows you to inspect the contents of an instance of IloNumToNumStepFunction.Constructor SummarypublicpublicIloNumToNumStepFunctionCursor(constIloNumToNumStepFunction,IloNum x)IloNumToNumStepFunctionCursor(constIloNumToNumStepFunctionCursor &)Method Summarypublic IloNumpublic IloNumpublic IloNumpublic IloBoolpublic voidpublic voidpublic voidgetSegmentMax() constgetSegmentMin() constgetValue() constok() constoperator++()operator--()seek(IloNum)DescriptionAn instance of the class IloNumToNumStepFunctionCursor allows you toinspect the contents of an instance of IloNumToNumStepFunction. A step of astep function is defined as an interval [x1,x2) over which the value of the function is thesame. Cursors are intended to iterate forward or backward over the steps of a stepfunction.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 428


IloNumToNumStepFunctionCursorNote: The structure of the step function cannot be changed while a cursoris being used to inspect it. Therefore, methods that change the structure ofthe step function, such as IloNumToNumStepFunction::setValue,should not be called while the cursor is being used.See AlsoConstructorsIloNumToNumStepFunctionpublic IloNumToNumStepFunctionCursor(const IloNumToNumStepFunction,IloNum x)This constructor creates a cursor to inspect the step function argument. This cursor letsyou iterate forward or backward over the steps of the function. The cursor initiallyspecifies the step of the function that contains x.Note that if n is the number of steps of the function given as argument, the worst-casecomplexity of this constructor is O(log(n)).public IloNumToNumStepFunctionCursor(const IloNumToNumStepFunctionCursor&)This constructor creates a new cursor that is a copy of the argument cursor. The newcursor initially specifies the same step and the same function as the argument cursor.Methodspublic IloNum getSegmentMax() constThis member function returns the right-most point of the step currently specified by thecursor.public IloNum getSegmentMin() constThis member function returns the left-most point of the step currently specified by thecursor.public IloNum getValue() constThis member function returns the value of the step currently specified by the cursor.public IloBool ok() constThis member function returns IloFalse if the cursor does not currently specify a stepincluded in the definition interval of the step function. Otherwise, it returns IloTrue.public void operator++()This operator moves the cursor to the step adjacent to the current step (forward move).public void operator--()This operator moves the cursor to the step adjacent to the current step (backward move).<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 429


IloNumToNumStepFunctionCursorpublic void seek(IloNum)This member function sets the cursor to specify the step of the function that contains x.An IloException is thrown if x does not belong to the definition interval of the stepfunction associated with the invoking cursor.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 430


IloUnionIloUnionCategoryDefinition FileSynopsisGlobal Functionilconcert/ilointervals.hpublic IloIntervalList IloUnion(const IloIntervalList intervals1,const IloIntervalList intervals2)Summary Creates and returns the union of two interval lists.DescriptionThis operator creates and returns an interval list equal to the union of the interval listsintervals1 and intervals2. The arguments intervals1 and intervals2must be defined on the same interval. An instance of IloException is thrown if twointervals with different types overlap. The resulting interval list is defined on the sameinterval as the arguments. See also: IloIntervalList.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 431


IloUnionIloUnionCategoryDefinition FileSynopsisGlobal Functionilconcert/ilosetfunc.hpublic IloNumToAnySetStepFunction IloUnion(const IloNumToAnySetStepFunctionf1,const IloNumToAnySetStepFunction f2)Summary Represents a function equal to the union of the functions.DescriptionThis operator creates and returns a function equal to the union of the functions f1 andf2. The argument functions f1 and f2 must be defined on the same interval. Theresulting function is defined on the same interval as the arguments. See also:IloNumToAnySetStepFunction.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 432


operator *operator *CategoryDefinition FileGlobal Functionilconcert/ilonumfunc.hSynopsis public IloNumToNumStepFunction operator *(const IloNumToNumStepFunction f1,IloNum k)public IloNumToNumStepFunction operator *(IloNum k,const IloNumToNumStepFunction f1)Summary These operators create and return a function equal to the function f1 multiplied by afactor k.DescriptionThese operators create and return a function equal to the function f1 multiplied by afactor k everywhere on the definition interval. The resulting function is defined on thesame interval as the argument function f1. See also: IloNumToNumStepFunction.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 433


operator+operator+CategoryDefinition FileGlobal Functionilconcert/ilonumfunc.hSynopsis public IloNumToNumStepFunction operator+(const IloNumToNumStepFunction f1,const IloNumToNumStepFunction f2)Summary This operator creates and returns a function equal the sum of the functions f1 and f2.Description This operator creates and returns a function equal the sum of the functions f1 and f2.The argument functions f1 and f2 must be defined on the same interval. The resultingfunction is defined on the same interval as the arguments. See also:IloNumToNumStepFunction.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 434


operator-operator-CategoryDefinition FileGlobal Functionilconcert/ilonumfunc.hSynopsis public IloNumToNumStepFunction operator-(const IloNumToNumStepFunction f1,const IloNumToNumStepFunction f2)Summary This operator creates and returns a function equal to the difference between functionsf1 and f2.DescriptionThis operator creates and returns a function equal to the difference between functionsf1 and f2. The argument functions f1 and f2 must be defined on the same interval.The resulting function is defined on the same interval as the arguments. See also:IloNumToNumStepFunction.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 435


operator


operator==operator==CategoryDefinition FileSynopsisGlobal Functionilconcert/ilointervals.hpublic IloBool operator==(const IloIntervalList intervals1,const IloIntervalList intervals2)Summary Returns IloTrue for same interval lists. same.DescriptionThis operator returns IloTrue if the interval lists are the same. That is, IloTrue isreturned if they have the same definition interval and if they contain the same intervals.Note that it compares the content of the interval lists as well as the equality ofimplementation pointer. See also IloIntervalList.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 437


operator==operator==CategoryDefinition FileGlobal Functionilconcert/ilonumfunc.hSynopsis public IloBool operator==(const IloNumToNumStepFunction f1,const IloNumToNumStepFunction f2)Summary Overloaded operator tests equality of numeric functions.DescriptionThis operator returns IloTrue if the functions f1 and f2 are the same. That is,IloTrue is returned if they have the same definition interval and if they have the samevalue over time. Note that it compares the content of the functions as well as the equalityof implementation pointer. See also: IloNumToNumStepFunction.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 438


operator==operator==CategoryDefinition FileGlobal Functionilconcert/ilosetfunc.hSynopsis public IloBool operator==(const IloNumToAnySetStepFunction f1,const IloNumToAnySetStepFunction f2)Summary overloaded operator.DescriptionThis operator returns IloTrue if the functions are the same. That is, IloTrue isreturned if they have the same definition interval and if they have the same value overtime. Note that it compares the content of the functions as well as the equality ofimplementation pointer. See also: IloNumToAnySetStepFunction.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 439


IloXmlContextGroup optim.concert.xmlThe <strong>ILOG</strong> Concert Serialization <strong>API</strong>.DescriptionIloXmlContextClasses SummaryIloXmlContextIloXmlInfoIloXmlReaderIloXmlWriterCategoryClassInheritancePathDefinition Fileilconcert/iloxmlcontext.hConstructor SummarypublicpublicIloXmlContext(IloEnv env,const char * name=0)IloXmlContext(IloXmlContextI * impl=0)Method Summarypublic voidpublic IloIntpublic const char *public IloIntArraypublic IloXmlContextI *public IloIntpublic const char *public IloAnyArrayend()getChildIdReadError() constgetChildTagReadError() constgetIdListReadError() constgetImpl() constgetParentIdReadError() constgetParentTagReadError() constgetTagListReadError() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 440


IloXmlContextpublic const char *public intpublic IloBoolgetWriteError() constgetWritePrecision() constreadModel(IloModel model,istream & file) constpublic IloBool readModel(IloModel model,const char *fileName) constpublic IloBoolreadModelAndSolution(IloModel model,constchar * modelFileName,IloSolution solution,constchar * solutionFileName) constpublic IloBool readRtti(IloXmlReader reader,IloXmlElement *element) constpublic IloBoolreadSolution(IloSolution solution,istream &file) constpublic IloBool readSolution(IloSolution solution,const char *fileName) constpublic IloBoolreadSolutionValue(IloSolutionsolution,IloXmlElement * root,IloXmlReaderreader) constpublic void registerXML(IloTypeIndex index,IloXmlInfo *xmlinfo) constpublic voidregisterXMLArray(IloXmlInfo * xmlinfo) constpublic IloBoolpublic voidsetWriteMode(IloInt mode) constsetWritePrecision(int writePrecision) constpublic IloBool writeModel(const IloModel model,const char *fileName) constpublic IloBoolpublic IloBoolpublic IloBoolpublic voidwriteModelAndSolution(const IloModelmodel,const char * modelFileName,constIloSolution solution,const char *solutionFileName) constwriteRtti(const IloRtti * it,IloXmlWriterwriter,IloXmlElement * masterElement) constwriteSolution(const IloSolutionsolution,const char * fileName) constwriteSolutionValue(const IloExtractableit,const IloSolution solution,IloXmlWriterwriter) constDescriptionAn instance of IloXmlContext allows you to serialize an IloModel or anIloSolution in XML.You can write an IloModel using writeModel, write an IloSolution usingwriteSolution, or write both using writeModelAndSolution.You can read an IloModel in XML using readModel, read an IloSolution inXML using readSolution, or read both using readModelAndSolution.Other products should add their own serialization class and add them to the plug-inusing the member functions registerXML and registerXMLArray.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 441


IloXmlContextExamplesFor example, you can write:IloModel model(env);IloSolution solution(env);...;IloXmlContext context(env);context.writeModel(model, "model.xml");context.writeSolution(solution, "solution.xml");or you can writeIloModel model(env);IloSolution solution(env);IloXmlContext context(env);context.readModel(model, "model.xml");context.readSolution(solution, "solution.xml");See AlsoConstructorsIloXmlReader, IloXmlWriter, IloXmlInfopublic IloXmlContext(IloEnv env,const char * name=0)This constructor creates an XML context and makes it part of the environment env.public IloXmlContext(IloXmlContextI * impl=0)This constructor creates a XML context from its implementation object.Methodspublic void end()This member function deletes the invoking XML context.public IloInt getChildIdReadError() constThis member function returns the XML ID of the child unparsed XML element in caseswhere a problem occurs when reading an IloModel.public const char * getChildTagReadError() constThis member function returns the XML tag of the child unparsed XML element in caseswhere a problem occurs when reading an IloModelpublic IloIntArray getIdListReadError() constThis member function returns the XML ID list of the unparsed XML elements in caseswhere a problem occurs when reading an IloModel. The list is composed of the tagsfrom the parent to the child elements.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 442


IloXmlContextpublic IloXmlContextI * getImpl() constThis member function returns the IloXmlContextI implementation.public IloInt getParentIdReadError() constThis member function returns the XML ID of the parent unparsed XML element incases where a problem occurs when reading an IloModel.public const char * getParentTagReadError() constThis member function returns the XML tag of the parent unparsed XML element incases where a problem occurs when reading an IloModel.public IloAnyArray getTagListReadError() constThis member function returns the XML tag list of the unparsed XML elements in caseswhere a problem occurs when reading an IloModel. The list is composed of the tagsfrom the parent to the child elements.public const char * getWriteError() constThis member function returns the name of the extractable called in cases where aproblem occurs when reading an IloModel.public int getWritePrecision() constThis member function returns the write precision for floatspublic IloBool readModel(IloModel model,istream & file) constThis member function reads model from an XML stream.public IloBool readModel(IloModel model,const char * fileName) constThis member function reads model from the XML file fileName.public IloBool readModelAndSolution(IloModel model,const char * modelFileName,IloSolution solution,const char * solutionFileName) constThis member function reads model and solution from their respective XML files,modelFileName and solutionFileName.public IloBool readRtti(IloXmlReader reader,IloXmlElement * element) constThis member function tries to read all extractables from the XML element.public IloBool readSolution(IloSolution solution,istream & file) constThis member function reads solution from an XML stream.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 443


IloXmlContextNote: This member function only works if a model has already beenserialized.public IloBool readSolution(IloSolution solution,const char * fileName) constThis member function reads solution from the XML file fileName.Note: This member function only works if a model has already beenserialized.public IloBool readSolutionValue(IloSolution solution,IloXmlElement * root,IloXmlReader reader) constThis member function reads an IloSolution object from an XML element.public void registerXML(IloTypeIndex index,IloXmlInfo * xmlinfo) constThis member function registers the serialization class of an extractable with a linked ID,usually its RTTI index. In write mode, the RTTI index is used to catch the correctserialization class.In read mode, IloXmlInfo::getTagName is used to link the correct serializationclass to the correct tag.IlpXmlContext context(env);context.registerXML(IloAllDiffI::GetTypeIndex(), new (env)IloXmlInfo_AllDiff(context));public void registerXMLArray(IloXmlInfo * xmlinfo) constThis member function registers the serialization class of an array of extractables with alinked ID.context.registerXMLArray(new (env) IloXmlInfo_SOS2Array(context));public IloBool setWriteMode(IloInt mode) constThis member function sets the write mode. The write mode can be set to NoUnknownor EvenUnknown. NoUnknown throws an exception if an attempt is made to serialize<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 444


IloXmlContextan unknown extractable. EvenUnknown writes a Unknown tag with the name of theextractable in a type attribute.public void setWritePrecision(int writePrecision) constThis member function sets the write precision for floats. By default, there is norounding mode on an IloNum or an IloNumArray. You can also choose the norounding mode with the IloNoRoundingMode constant.public IloBool writeModel(const IloModel model,const char * fileName) constThis member function writes model to the file fileNamein XML format.public IloBool writeModelAndSolution(const IloModel model,const char * modelFileName,const IloSolution solution,const char * solutionFileName) constThis member function writes model to the file modelFileName and solution tothe file solutionFileName in XML format.public IloBool writeRtti(const IloRtti * it,IloXmlWriter writer,IloXmlElement * masterElement) constThis member function writes a specified extractable. It is used from the serializationclass of an extractable to write a embedded extractable.The IloOr object calls this method on its constrained vars.See AlsoIloXmlInfo::writeRttipublic IloBool writeSolution(const IloSolution solution,const char * fileName) constThis member function writes solution to the file fileName in XML format.public void writeSolutionValue(const IloExtractable it,const IloSolution solution,IloXmlWriter writer) constThis member function writes a specified extractable of a solution in XML. It is usedfrom the serialization class of an extractable to write an embedded extractable.See AlsoIloXmlInfo::writeSolutionValue<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 445


IloXmlInfoIloXmlInfoCategoryClassInheritancePathDefinition Fileilconcert/iloxmlabstract.hConstructor SummarypublicpublicIloXmlInfo(IloXmlContextI * context,const char* version=0)IloXmlInfo()Method Summarypublic IloBoolpublic IloBoolpublic IloXmlContextI *protected IloBoolprotected IloBoolpublic IloBoolpublic virtual const char *public virtual IloXmlElement*public static const char *checkAttExistence(IloXmlReaderreader,IloXmlElement * element,const char *attribute)checkExprExistence(IloXmlReaderreader,IloXmlElement * element,const char *attribute,IloInt & id)getContext()getIntValArray(IloXmlReaderreader,IloXmlElement * element,IloIntArray &intArray)getNumValArray(IloXmlReaderreader,IloXmlElement * element,IloNumArray &numArray)getRefInChild(IloXmlReaderreader,IloXmlElement * element,IloInt & id)getTag()getTagElement(IloXmlWriter writer,constIloRtti * exprI)IloXmlInfo::getTagName()protected IloNumVar::Type getVarType(IloXmlReader reader,IloXmlElement *element)protected const char * getVersion()<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 446


IloXmlInfoprotected virtual IloRtti * read(IloXmlReader reader,IloXmlElement *element)public virtualIloExtractableArray *readArrayFromXml(IloXmlReaderreader,IloXmlElement * element)public virtual IloRtti * readFrom(IloXmlReader reader,IloXmlElement *element)public virtualIloExtractableI *readFromXml(IloXmlReader reader,IloXmlElement* element)public IloBool readRtti(IloXmlReader reader,IloXmlElement *element)public virtual IloBoolprotected virtualIloExtractableI *protected virtualIloExtractableArray *protected IloXmlElement *public IloXmlElement *public IloXmlElement *public IloXmlElement *protected IloXmlElement *protected IloXmlElement *protected IloXmlElement *protected IloXmlElement *protected voidreadSolution(IloXmlReader reader,IloSolutionsolution,IloXmlElement * element)readXml(IloXmlReader reader,IloXmlElement *element)readXmlArray(IloXmlReaderreader,IloXmlElement * element)setBoolArray(IloXmlWriter writer,constIloBoolArray Array)setCommonArrayXml(IloXmlWriter writer,constIloExtractableArray * extractable)setCommonValueXml(IloXmlWriter writer,constIloRtti * exprI)setCommonXml(IloXmlWriter writer,constIloRtti * exprI)setIntArray(IloXmlWriter writer,constIloIntArray Array)setIntSet(IloXmlWriter writer,const IloIntSetArray)setNumArray(IloXmlWriter writer,constIloNumArray Array)setNumSet(IloXmlWriter writer,const IloNumSetArray)setVersion(const char * version)public void setXml(IloXmlWriter writer,IloXmlElement *element,const IloRtti * exprI)public virtual intwrite(IloXmlWriter writer,constIloExtractableArray *extractable,IloXmlElement * masterElement)public virtual IloBool write(IloXmlWriter writer,const IloRtti *exprI,IloXmlElement * masterElement)public IloBoolwriteExtractable(IloXmlWriterwriter,IloXmlElement * element,constIloExtractable extractable,const char *attribute=0)public virtual IloBool writeRef(IloXmlWriter writer,const IloRtti *exprI,IloXmlElement * masterElement)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 447


IloXmlInfopublic IloBoolpublic virtual voidpublic voidprotected IloBoolprotected IloBoolprotected IloBoolprotected IloBoolprotected IloBoolprotected IloBoolprotected IloBoolprotected IloBoolprotected IloBoolprotected IloBoolprotected IloBoolpublic virtual IloBoolIloXmlInfo::writeRtti(IloXmlWriterwriter,IloXmlElement * element,const IloRtti *rtti,const char * attribute=0)writeSolution(IloXmlWriter writer,constIloSolution solution,const IloExtractableextractable)IloXmlInfo::writeSolutionValue(IloXmlWriterwriter,const IloSolution solution,IloXmlElement* element,const IloRtti * rtti,const char *attribute)writeVarArray(IloXmlWriterwriter,IloXmlElement * element,IloSOS2Arrayarray)writeVarArray(IloXmlWriterwriter,IloXmlElement * element,IloSOS1Arrayarray)writeVarArray(IloXmlWriterwriter,IloXmlElement *element,IloSemiContVarArray array)writeVarArray(IloXmlWriterwriter,IloXmlElement *element,IloConstraintArray array)writeVarArray(IloXmlWriterwriter,IloXmlElement * element,IloRangeArrayarray)writeVarArray(IloXmlWriterwriter,IloXmlElement * element,IloNumVarArrayarray)writeVarArray(IloXmlWriterwriter,IloXmlElement *element,IloIntSetVarArray array)writeVarArray(IloXmlWriterwriter,IloXmlElement * element,IloNumExprArrayarray)writeVarArray(IloXmlWriterwriter,IloXmlElement * element,IloIntExprArrayarray)writeVarArray(IloXmlWriterwriter,IloXmlElement * element,IloBoolVarArrayarray)writeVarArray(IloXmlWriterwriter,IloXmlElement * element,IloIntVarArrayarray)writeXml(IloXmlWriter writer,constIloExtractableI * exprI,IloXmlElement *masterElement)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 448


IloXmlInfopublic virtual IloBoolwriteXmlRef(IloXmlWriter writer,constIloExtractableI * exprI,IloXmlElement *masterElement)DescriptionConstructorsMethodsThe class IloXmlInfo allows you to serialize an IloModel or an IloSolutionin XML.public IloXmlInfo(IloXmlContextI * context,const char * version=0)This constructor creates an instance of the handle class IloXmlInfo from a pointer toan instance of the undocumented implementation class IloXmlContextI.public IloXmlInfo()This constructor creates an empty instance of the handle class IloXmlInfo.public IloBool checkAttExistence(IloXmlReader reader,IloXmlElement * element,const char * attribute)Given a specified attribute, this member function checks element to establish whetherthe attribute exists. If the attribute does not exist, this member function throws anexception.You can use this member function to dynamically validate an XML element.public IloBool checkExprExistence(IloXmlReader reader,IloXmlElement * element,const char * attribute,IloInt & id)Given a specified attribute, this member function checks element to establish whetherthe attribute exists, fills the id, and checks in the XML context memory whether anobject with this id exists.You can use this member function to dynamically validate an XML element.Example: in the read method of the IloDiff, check that the IdRef object is alreadyserializedpublic IloXmlContextI * getContext()This member function returns the related IloXmlContextI of the constructor.protected IloBool getIntValArray(IloXmlReader reader,IloXmlElement * element,IloIntArray & intArray)This member function returns the contained IloIntArray in the XML elementelement.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 449


IloXmlInfoSee AlsoIloXmlReader::string2IntArrayprotected IloBool getNumValArray(IloXmlReader reader,IloXmlElement * element,IloNumArray & numArray)This member function returns the IloNumArray in the XML element element.See AlsoIloXmlReader::string2NumArraypublic IloBool getRefInChild(IloXmlReader reader,IloXmlElement * element,IloInt & id)Given an XML element, this member function checks for the first value id or RefIdin the element and its children.public virtual const char * getTag()This member function returns the related XML tag.public virtual IloXmlElement * getTagElement(IloXmlWriter writer,const IloRtti * exprI)For backward compatibility with 2.0 and the XML for IloExtractable objects, if thismethod is not specialized, by default the getTagElement method with IloExtractableIwill be calledpublic static const char * getTagName()This static member function returns the linked XML tag of this serialization class.protected IloNumVar::Type getVarType(IloXmlReader reader,IloXmlElement * element)This member function returns the type of an IloNumVar - IloFloat, IloInt, orIloBool - in the XML element element.protected const char * getVersion()This member function returns the version of the object.protected virtual IloRtti * read(IloXmlReader reader,IloXmlElement * element)This member function reads an IloRtti from the given XML element.This is the method to specialize for each serialization classFor backward compatibility with Concert 2.0 and the XML for IloExtractable objects,by default the method readXml with IloExtractableI will be calledpublic virtual IloExtractableArray * readArrayFromXml(IloXmlReader reader,IloXmlElement * element)This member function reads an array of IloRtti* from the given XML element.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 450


IloXmlInfoThis is the method to specialize when writing a serialization class for an array ofextractables.public virtual IloRtti * readFrom(IloXmlReader reader,IloXmlElement * element)This member function reads an IloRtti from the given XML element. It asks theXML context to read the extractable in the XML child element using a call toreadRtti; it then calls readXml.For backward compatibility with Concert 2.0 and the XML for IloExtractable objects,by default the method readFromXml with IloExtractableI will be calledpublic virtual IloExtractableI * readFromXml(IloXmlReader reader,IloXmlElement * element)This member function reads an IloRtti from the given XML element. It asks theXML context to read the extractable in the XML child element using a call toreadRtti; it then calls readXml.public IloBool readRtti(IloXmlReader reader,IloXmlElement * element)This member function asks the XML context to read the IloRtti in the child elementand then calls readFromXml to read the parent extractable.public virtual IloBool readSolution(IloXmlReader reader,IloSolution solution,IloXmlElement * element)This member function reads a variable for IloSolution from the XML elementelement.protected virtual IloExtractableI * readXml(IloXmlReader reader,IloXmlElement * element)This member function reads an IloRtti from the given XML element.This is the method to specialize for each serialization classprotected virtual IloExtractableArray * readXmlArray(IloXmlReader reader,IloXmlElement * element)This member function reads an array of IloRtti* from the given XML element.It is called by the XML context. It first asks the XML context to read from XML childelements using a call to readRtti and then calls readArrayFromXml.protected IloXmlElement * setBoolArray(IloXmlWriter writer,const IloBoolArray Array)This member function creates an XML element containing the IloBoolArray.See AlsoIloXmlWriter::IntArray2String<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 451


IloXmlInfopublic IloXmlElement * setCommonArrayXml(IloXmlWriter writer,const IloExtractableArray *extractable)This member function creates a XML element with the common header forIloExtractable arrays.public IloXmlElement * setCommonValueXml(IloXmlWriter writer,const IloRtti * exprI)This member function creates an XML element with the given header for IloRttifrom IloSolution.public IloXmlElement * setCommonXml(IloXmlWriter writer,const IloRtti * exprI)This member function creates an XML element with the common header for IloRtti.protected IloXmlElement * setIntArray(IloXmlWriter writer,const IloIntArray Array)This member function creates an XML element containing the IloIntArray.See AlsoIloXmlWriter::IntArray2Stringprotected IloXmlElement * setIntSet(IloXmlWriter writer,const IloIntSet Array)This member function creates an XML element containing the IloIntSet.See AlsoIloXmlWriter::IntSet2Stringprotected IloXmlElement * setNumArray(IloXmlWriter writer,const IloNumArray Array)This member function creates an XML element containing the IloNumArray.See AlsoIloXmlWriter::NumArray2Stringprotected IloXmlElement * setNumSet(IloXmlWriter writer,const IloNumSet Array)This member function creates an XML element containing the IloNumSet.See AlsoIloXmlWriter::NumSet2Stringprotected void setVersion(const char * version)This member function sets the version of the object.public void setXml(IloXmlWriter writer,IloXmlElement * element,const IloRtti * exprI)This member function adds a name attribute and a ID attribute to the XML element.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 452


IloXmlInfopublic virtual int write(IloXmlWriter writer,const IloExtractableArray * extractable,IloXmlElement * masterElement)This member function writes the given IloExtractableArray in XML and adds itto the XML document of writer. This is the method to specialize when writing aserialization classpublic virtual IloBool write(IloXmlWriter writer,const IloRtti * exprI,IloXmlElement * masterElement)This member function writes the IloRtti object exprI in XML and adds it to theXML document of the IloXmlWriter object writer.For backward compatibility with Concert 2.0 and the XML for IloExtractable objects,by default the method writeXml with IloExtractableI will be calledpublic IloBool writeExtractable(IloXmlWriter writer,IloXmlElement * element,const IloExtractable extractable,const char * attribute=0)SeeIloXmlContext::writeRtti(IloXmlWriter,IloXmlElement*,constIloRtti*,const char*) instead. There is no longer need for the extractableargument.public virtual IloBool writeRef(IloXmlWriter writer,const IloRtti * exprI,IloXmlElement * masterElement)This member function writes the IloRtti object exprI in XML as a reference.For backward compatibility with Concert 2.0 and the XML for IloExtractable objects,by default the method writeXmlRef with IloExtractableI will be calledpublic IloBool writeRtti(IloXmlWriter writer,IloXmlElement * element,const IloRtti * rtti,const char * attribute=0)This member function writes an embedded extractable. Using the getId() method ofthe extractable, it adds an attribute with the ID in the XML element.For example, used with IloDiff, this member function writes the expression and linksit to the XML element via an IdRef attribute.// using an IloDiffI* exprI:writeRtti(writer, element,(IloRtti*)exprI->getExpr1(),IloXmlAttributeDef::Expr1Id);writeRtti(writer, element,(IloRtti*)exprI->getExpr2(),<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 453


IloXmlInfo*IloXmlAttributeDef::Expr2Id);See AlsowriteRttipublic virtual void writeSolution(IloXmlWriter writer,const IloSolution solution,const IloExtractable extractable)This member function writes the specified extractable extractable from theIloSolutionsolution in XML format.public void writeSolutionValue(IloXmlWriter writer,const IloSolution solution,IloXmlElement * element,const IloRtti * rtti,const char * attribute)This member function writes an embedded extractable of a solution in XML. Using thegetId() method of the extractable, it adds an attribute with the ID in the XMLelement.For example, used with IloDiff, this member function writes the expression and linksit to the XML element via an IdRef attribute.See AlsowriteSolutionValueprotected IloBool writeVarArray(IloXmlWriter writer,IloXmlElement * element,IloSOS2Array array)This member function writes an IloSOS2Array. It adds an attribute in the XMLelement element with the ID of array, serializes array, and, if necessary,serializes the IloSOS2s of array.protected IloBool writeVarArray(IloXmlWriter writer,IloXmlElement * element,IloSOS1Array array)This member function writes an IloSOS1Array. It adds an attribute in the XMLelement element with the ID of array, serializes array, and, if necessary,serializes the IloSOS1s of array.protected IloBool writeVarArray(IloXmlWriter writer,IloXmlElement * element,IloSemiContVarArray array)This member function writes an IloSemiContVarArray. It adds an attribute in theXML element element with the ID of array, serializes array, and, if necessary,serializes the IloSemiContVars of array.protected IloBool writeVarArray(IloXmlWriter writer,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 454


IloXmlInfoIloXmlElement * element,IloConstraintArray array)This member function writes an IloConstraintArray. It adds an attribute in theXML element element with the ID of array, serializes array, and, if necessary,serializes the IloConstraints of array.protected IloBool writeVarArray(IloXmlWriter writer,IloXmlElement * element,IloRangeArray array)This member function writes an IloRangeArray. It adds an attribute in the XMLelement element with the ID of array, serializes array, and, if necessary,serializes the IloRanges of array.protected IloBool writeVarArray(IloXmlWriter writer,IloXmlElement * element,IloNumVarArray array)This member function writes an IloNumVarArray. It adds an attribute in the XMLelement element with the ID of array, serializes array, and, if necessary,serializes the IloNumVars of array.protected IloBool writeVarArray(IloXmlWriter writer,IloXmlElement * element,IloIntSetVarArray array)This member function writes an IloIntSetVarArray. It adds an attribute in theXML element element with the ID of array, serializes array, and, if necessary,serializes the IloIntSetVars of array.protected IloBool writeVarArray(IloXmlWriter writer,IloXmlElement * element,IloNumExprArray array)This member function writes an IloNumExprArray. It adds an attribute in the XMLelement element with the ID of array, serializes array, and, if necessary,serializes the IloNumExprs of array.protected IloBool writeVarArray(IloXmlWriter writer,IloXmlElement * element,IloIntExprArray array)This member function writes an IloIntExprArray. It adds an attribute in the XMLelement element with the ID of array, serializes array, and, if necessary,serializes the IloIntExprs of array.protected IloBool writeVarArray(IloXmlWriter writer,IloXmlElement * element,IloBoolVarArray array)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 455


IloXmlInfoThis member function writes an IloBoolVarArray. It adds an attribute in the XMLelement element with the ID of array, serializes array, and, if necessary,serializes the IloBoolVars of array.protected IloBool writeVarArray(IloXmlWriter writer,IloXmlElement * element,IloIntVarArray array)This member function writes an IloIntVarArray. It adds an attribute in the XMLelement element with the ID of array, serializes array, and, if necessary,serializes the IloIntVars of array.Example using IloSos containing an IloIntVarArray:// Using an IloSOS1I* exprI;this.writeVarArray(writer,element,exprI->getVarArray(),IloXmlAttributeDef::IdRef);This sample adds an IdRef attribute on the SOS XML element, creates an XMLelement containing the IloIntVarArray with the list of IloIntVar IDs, andcreates a list of XML elements for the IloIntVars.public virtual IloBool writeXml(IloXmlWriter writer,const IloExtractableI * exprI,IloXmlElement * masterElement)This member function writes the IloRtti object exprI in XML and adds it to theXML document of the IloXmlWriter object writer.public virtual IloBool writeXmlRef(IloXmlWriter writer,const IloExtractableI * exprI,IloXmlElement * masterElement)This member function writes the IloRtti object exprI in XML as a reference.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 456


IloXmlReaderIloXmlReaderCategoryClassInheritancePathDefinition Fileilconcert/iloreader.hConstructor Summarypublic IloXmlReader(IloEnv env,const char *fileName=0)publicIloXmlReader(IloXmlReaderI * impl)Method Summarypublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic voidpublic voidcheckRttiOfObjectById(IloTypeIndexRTTI,IloRtti * exprI)checkRttiOfObjectById(IloTypeIndexRTTI,IloInt Xml_Id)checkTypeOfObjectById(IloTypeInfo type,IloIntXml_Id)checkTypeOfObjectById(IloTypeInfo type,IloRtti* exprI)deleteAllocatedMemory(const char * pointer)deleteAllocatedMemory(char * pointer)public IloXmlElement * findElement(IloXmlElement * root,const char *tag,const char * attribute,const char * value)public IloXmlElement *public IloIntpublic IloEnvpublic IloEnvI *public IloXmlElement *public IloBoolfindElementByTag(IloXmlElement * element,constchar * tag)getChildrenCardinal(IloXmlElement * element)getEnv()getEnvImpl()getFirstSubElement(IloXmlElement * element)getIntAttribute(IloXmlElement * element,constchar * attribute,IloInt & value)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 457


IloXmlReaderpublic IloBoolpublic IloAnypublic IloXmlElement *public IloIntArray *public IloIntArray *public IloBoolpublic IloBoolpublic const char *public const char *public const char *public const char *public const char *public voidpublic IloIntgetNumAttribute(IloXmlElement * element,constchar * attribute,IloNum & value)getObjectById(IloInt id)getRoot()getSerialized()getSolutionSerialized()isSerialized(IloInt id)openDocument()readAttribute(IloXmlElement * element,constchar * attribute)readCData(IloXmlElement * element)readComment(IloXmlElement * element)readData(IloXmlElement * element)readText(IloXmlElement * element)setfileName(const char * fileName)string2Int(const char * str)public IloIntArray IloXmlReader::string2IntArray(const char *str)public IloIntRangestring2IntRange(IloXmlElement * element)public IloIntSetstring2IntSet(const char * str)public IloNumstring2Num(const char * str)public IloNumArray IloXmlReader::string2NumArray(const char *str)DescriptionConstructorsYou can use an instance of IloXmlReader to read an IloModel or aIloSolution in XML format.public IloXmlReader(IloEnv env,const char * fileName=0)This constructor creates an IloXmlReader object and makes it part of theenvironment env.The fileName is set to 0 by default.public IloXmlReader(IloXmlReaderI * impl)This constructor creates an XML reader from its implementation object.Methodspublic IloBool checkRttiOfObjectById(IloTypeIndex RTTI,IloRtti * exprI)This method checks the RTTI of the given object.public IloBool checkRttiOfObjectById(IloTypeIndex RTTI,IloInt Xml_Id)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 458


IloXmlReaderThis method checks the RTTI of the object referenced by the identifier Xml_Id in theXML. This object must already be serialized.public IloBool checkTypeOfObjectById(IloTypeInfo type,IloInt Xml_Id)This method checks the TypeInfo of the object referenced by the id in the XML. Thisobject must have been already serialized.public IloBool checkTypeOfObjectById(IloTypeInfo type,IloRtti * exprI)This method checks the TypeInfo of the given objectpublic void deleteAllocatedMemory(const char * pointer)This member function frees the memory that has been allocated by the XML readerusing, for example, the IloXmlWriter::Int2String member function.public void deleteAllocatedMemory(char * pointer)This member function frees the memory that has been allocated by the XML readerusing, for example, the IloXmlWriter::Int2String member function.public IloXmlElement * findElement(IloXmlElement * root,const char * tag,const char * attribute,const char * value)This member function examines the XML element root to identify the XML childelement denoted by tag, attribute, and value.public IloXmlElement * findElementByTag(IloXmlElement * element,const char * tag)This member function examines the XML element element to identify the XML childelement denoted by tag.public IloInt getChildrenCardinal(IloXmlElement * element)This member function counts the number of child elements of the XML elementelement.public IloEnv getEnv()This member function gets the IloEnv of the object.public IloEnvI * getEnvImpl()This member function gets the implementation of the IloEnv of the object.public IloXmlElement * getFirstSubElement(IloXmlElement * element)This member function gets the first child in the XML element element.public IloBool getIntAttribute(IloXmlElement * element,const char * attribute,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 459


IloXmlReaderIloInt & value)This member function checks the existence of attribute in the XML elementelement and converts it to an IloInt.public IloBool getNumAttribute(IloXmlElement * element,const char * attribute,IloNum & value)This member function checks the existence of attribute in the XML elementelement and converts it to an IloNum.public IloAny getObjectById(IloInt id)This member function gets the already serialized object of the given identifier id.IloDiff Diff(reader.getEnv(),IloExpr((IloNumExprI*)reader.getObjectById(IdExpr1)),IloExpr((IloNumExprI*)reader.getObjectById(IdExpr2)),reader.readAttribute(element,IloXmlAttributeDef::Name));The sample code creates a IloDiff from a XML element referencing its twoexpressions with the attributes IdRef1 and IdRef2.public IloXmlElement * getRoot()This member function gets the XML root, that is, the XML document without theheader.public IloIntArray * getSerialized()This member function gets the IDs of the serialized extractables and the unique IDs ofthe array of extractables that were serialized from the model.public IloIntArray * getSolutionSerialized()This member function gets the IDs of the serialized extractables and the unique IDs ofthe array of extractables that were serialized from the solution.public IloBool isSerialized(IloInt id)This member function checks whether the extractable with the ID id in the model hasalready been serialized.public IloBool openDocument()This member function opens the XML document specified in the constructor or with thesetFileName method.public const char * readAttribute(IloXmlElement * element,const char * attribute)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 460


IloXmlReaderThis member function returns the value of the attribute in the XML elementelement.public const char * readCData(IloXmlElement * element)This member function reads the CDATA of the XML element element.public const char * readComment(IloXmlElement * element)This member function returns the value of the comment in the XML elementelement.public const char * readData(IloXmlElement * element)This member function reads the data of the XML element element.public const char * readText(IloXmlElement * element)This member function returns the value of the text contained in the XML elementelement, independently of its origin (data or CDATA).public void setfileName(const char * fileName)This member function sets fileName as the file from which to read the XML.public IloInt string2Int(const char * str)This member function converts str into an IloInt.public IloIntArray string2IntArray(const char * str)This member function converts str into an IloIntArray.public IloIntRange string2IntRange(IloXmlElement * element)This member function converts str into an IloIntRange.public IloIntSet string2IntSet(const char * str)This member function converts str into an IloIntSet.public IloNum string2Num(const char * str)This member function converts str into an IloNum.public IloNumArray string2NumArray(const char * str)This member function converts str into an IloNumArray.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 461


IloXmlWriterIloXmlWriterCategoryClassInheritancePathDefinition Fileilconcert/ilowriter.hConstructor Summarypublic IloXmlWriter(IloEnv env,const char *rootTag,const char * fileName=0)publicIloXmlWriter(IloXmlWriterI * impl)Method Summarypublic voidaddAttribute(IloXmlElement * element,const char* attribute,const char * value)public void addCData(IloXmlElement * element,const char *CData)public void addComment(IloXmlElement * element,const char *comment)public voidaddElement(IloXmlElement * element)public void addSubElement(IloXmlElement *element,IloXmlElement * subElement)public void addText(IloXmlElement * element,const char *text)public IloXmlElement * createElement(const char * element)public voidpublic voidpublic IloEnvpublic IloEnvI *public const char *public IloXmlElement *public IloIntArray *public IloIntArray *public const char *deleteAllocatedMemory(const char * pointer)deleteAllocatedMemory(char * pointer)getEnv()getEnvImpl()getfileName()getRoot()getSerialized()getSolutionSerialized()IloXmlWriter::Int2String(const IloInt number)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 462


IloXmlWriterpublic const char *public const char *public IloBoolpublic IloBoolpublic const char *public const char *public const char *public voidpublic IloIntpublic IloBoolIloXmlWriter::IntArray2String(constIloIntArray intArray)IloXmlWriter::IntSet2String(const IloIntSetintSet)isSerialized(IloInt id)isSolutionSerialized(IloInt id)Num2String(const IloNum number)IloXmlWriter::NumArray2String(constIloNumArray numArray)IloXmlWriter::NumSet2String(const IloNumSetnumSet)setfileName(const char * fileName)string2Int(const char * str)writeDocument()DescriptionConstructorsYou can use an instance of IloXmlWriter to serialize an IloModel or anIloSolution in XML.public IloXmlWriter(IloEnv env,const char * rootTag,const char * fileName=0)This constructor creates an IloXmlWriter object and makes it part of theenvironment env.The fileName is set to 0 by default.public IloXmlWriter(IloXmlWriterI * impl)This constructor creates a XML writer object from its implementation object.Methodspublic void addAttribute(IloXmlElement * element,const char * attribute,const char * value)This member function adds an attribute of the specified value to the XML element.public void addCData(IloXmlElement * element,const char * CData)This member function adds a CDATA section to the XML element element.public void addComment(IloXmlElement * element,const char * comment)This member function adds comment to the XML element element.public void addElement(IloXmlElement * element)This member function adds the XML element element to the end of the XML.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 463


IloXmlWriterpublic void addSubElement(IloXmlElement * element,IloXmlElement * subElement)This member function adds a child element, subElement, to the XML elementelement.public void addText(IloXmlElement * element,const char * text)This member function adds text to the specified element.public IloXmlElement * createElement(const char * element)This member function creates an empty element with the given tag, element.public void deleteAllocatedMemory(const char * pointer)This member function frees the memory that has been allocated by the XML readerusing, for example, the IloXmlWriter::Int2String member function.public void deleteAllocatedMemory(char * pointer)This member function frees the memory that has been allocated by the XML readerusing, for example, the IloXmlWriter::Int2String member function.public IloEnv getEnv()This member function gets the IloEnv of the object.public IloEnvI * getEnvImpl()This member function gets the implementation of the IloEnv of the object.public const char * getfileName()This member function returns the name of the XML filepublic IloXmlElement * getRoot()This member function gets the root XML element of the XML document.public IloIntArray * getSerialized()This member function gets the IDs of the serialized objects of an IloModel.public IloIntArray * getSolutionSerialized()This member function gets the IDs of the serialized objects of an IloSolution.public const char * Int2String(const IloInt number)This member function converts the IloInt object number into a string, constchar*.public const char * IntArray2String(const IloIntArray intArray)This member function converts the IloIntArray object intArray into a string,const char*.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 464


IloXmlWriterpublic const char * IntSet2String(const IloIntSet intSet)This member function converts the IloIntSet object intSet into a string, constchar*.public IloBool isSerialized(IloInt id)This member function checks whether an object has been serialized.public IloBool isSolutionSerialized(IloInt id)This member function checks whether a solution object has already been serialized.public const char * Num2String(const IloNum number)This member function converts the IloNum object number into a string, constchar*.public const char * NumArray2String(const IloNumArray numArray)This member function converts the IloNumArray object numArray into a string,const char*.public const char * NumSet2String(const IloNumSet numSet)This member function converts the IloNumSet object numSet into a string, constchar*.public void setfileName(const char * fileName)This member function specifies fileName as the name of the XML file.public IloInt string2Int(const char * str)This member function converts str into an IloInt.public IloBool writeDocument()This member function outputs the XML to the file specified in the constructor or usingthe setFileName method. If null, this member function outputs on the cout io.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 465


IloXmlWriterGroup optim.cplex.cppThe <strong>API</strong> of <strong>ILOG</strong> <strong>CPLEX</strong> for users of <strong>C++</strong>.Classes SummaryControlCallbackI::PresolvedVariableExceptionIloBoundIloCplexIloCplex::AborterIloCplex::BarrierCallbackIIloCplex::BranchCallbackIIloCplex::CallbackIloCplex::CallbackIIloCplex::ContinuousCallbackIIloCplex::ControlCallbackIIloCplex::CrossoverCallbackIIloCplex::CutCallbackIIloCplex::DisjunctiveCutCallbackIIloCplex::DisjunctiveCutInfoCallbackIIloCplex::ExceptionIloCplex::FlowMIRCutCallbackIIloCplex::FlowMIRCutInfoCallbackIIloCplex::FractionalCutCallbackIIloCplex::FractionalCutInfoCallbackIIloCplex::GoalIloCplex::GoalIIloCplex::HeuristicCallbackIIloCplex::IncumbentCallbackIIloCplex::InvalidCutExceptionIloCplex::LazyConstraintCallbackIIloCplex::MIPCallbackIIloCplex::MIPInfoCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 466


IloXmlWriterIloCplex::MultipleConversionExceptionIloCplex::MultipleObjExceptionIloCplex::NetworkCallbackIIloCplex::NodeCallbackIIloCplex::NodeEvaluatorIloCplex::NodeEvaluatorIIloCplex::OptimizationCallbackIIloCplex::ParameterSetIloCplex::PresolveCallbackIIloCplex::ProbingCallbackIIloCplex::ProbingInfoCallbackIIloCplex::SearchLimitIloCplex::SearchLimitIIloCplex::SimplexCallbackIIloCplex::SolveCallbackIIloCplex::TuningCallbackIIloCplex::UnknownExtractableExceptionIloCplex::UserCutCallbackIMIPCallbackI::NodeDataParameterSet::IteratorMacros SummaryILOBARRIERCALLBACK0ILOBRANCHCALLBACK0ILOCONTINUOUSCALLBACK0ILO<strong>CPLEX</strong>GOAL0ILOCROSSOVERCALLBACK0ILOCUTCALLBACK0ILODISJUNCTIVECUTCALLBACK0ILODISJUNCTIVECUTINFOCALLBACK0ILOFLOWMIRCUTCALLBACK0ILOFLOWMIRCUTINFOCALLBACK0ILOFRACTIONALCUTCALLBACK0<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 467


IloXmlWriterILOFRACTIONALCUTINFOCALLBACK0ILOHEURISTICCALLBACK0ILOINCUMBENTCALLBACK0ILOLAZYCONSTRAINTCALLBACK0ILOMIPCALLBACK0ILOMIPINFOCALLBACK0ILONETWORKCALLBACK0ILONODECALLBACK0ILOPRESOLVECALLBACK0ILOPROBINGCALLBACK0ILOPROBINGINFOCALLBACK0ILOSIMPLEXCALLBACK0ILOSOLVECALLBACK0ILOTUNINGCALLBACK0ILOUSERCUTCALLBACK0Enumerations SummaryBranchCallbackI::BranchTypeCallback::TypeControlCallbackI::IntegerFeasibilityGoalI::BranchTypeGoalI::IntegerFeasibilityIloBound::TypeIloCplex::AlgorithmIloCplex::BasisStatusIloCplex::BoolParamIloCplex::BranchDirectionIloCplex::ConflictStatusIloCplex::CplexStatusIloCplex::CutTypeIloCplex::DeleteModeIloCplex::DualPricingIloCplex::IntParamIloCplex::MIPEmphasisTypeIloCplex::MIPsearchIloCplex::NodeSelectIloCplex::NumParam<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 468


IloXmlWriterIloCplex::Parallel_ModeIloCplex::PrimalPricingIloCplex::QualityIloCplex::RelaxationIloCplex::StringParamIloCplex::TuningStatusIloCplex::VariableSelectType Definitions SummaryControlCallbackI::IntegerFeasibilityArrayGoalI::IntegerFeasibilityArrayIloCplex::BasisStatusArrayIloCplex::BranchDirectionArrayIloCplex::ConflictStatusArrayDescriptionWhat is IloCplex?IloCplex is a Concert Technology class derived from IloAlgorithm. Instances ofthis class are capable of solving optimization problems of the following types:◆ Linear Programs (LPs),◆ Mixed Integer Linear Programs (MILPs),◆ Mixed Integer Programs (MIPs),◆ Quadratic Programs (QPs),◆ Mixed Integer Quadratic Programs (MIQPs),◆ Quadratically Constrained Programs (QCPs);◆ Mixed Integer Quadratically Constrained Programs (MIQCPs).An instance of IloCplex can extract and solve models consisting of the followingConcert Technology extractables:Extractable Class Used to Model<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 469


IloXmlWriterIloNumVar numeric variablesIloSemiContVar semi-continuous or semi-integervariablesIloObjective at most one objective function withlinear, piecewise linear, or quadraticexpressionsIloRange range constraints with linear orpiecewise linear expressionsIloConstraint ranged constraints of the formexpr1relationexpr, where expr1indicates a linear, logical, orquadratic expression and the relationless than or equal to or the relationgreater than or equal to; constraintscan be combined by logical operatorsIloConversion variable type conversionsIloModel submodelsIloSOS1 special ordered sets of type 1IloSOS2 special ordered sets of type 2IloAnd constraint clausesWhat is special about this set of extractable classes recognized by IloCplex is thatmodels consisting of these objects can be transformed into mathematical programmingproblems of the form:When all variables are continuous and Q is zero, problems of this form are known asLinear Programs (LPs). If Q is not zero, such problems are known as QuadraticPrograms (QPs). If any variables are integer, semi-continuous, or Boolean, suchproblems are called Mixed Integer Programs (MIPs). A MIP with a zero Q matrix iscalled a Mixed Integer Linear Program (MILP), and a MIP with a non-zero Q is calleda Mixed Integer Quadratic Program (MIQP). If there are quadratic constraints in theproblem, and its variables are continuous, it is known as a Quadratically ConstrainedProgram (QCP). If in addition to the quadratic constraints, there are discrete variables inthe problem (such as integer, Boolean, or semi-continuous variables), then it is known asMIQCP.◆ Objects of the class IloNumVar represent modeling variables. They are definedby the lower and upper bounds of the variable, and the type of the variable. The typeof the variable can be one of these:<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 470


IloXmlWriter◆◆◆ILOFLOAT, for continuous,ILOINT, for integer,ILOBOOL, for Boolean variables.◆ Objects of the class IloSemiContVar represent semi-continuous variables. Asemi-continous variable may be 0 (zero) or may take a value within an intervaldefined by its semi-continuous lower and upper bounds. Semi-continuous variablesare usually defined as continuous variables, but you can designate an instance ofIloSemiContVar as integer by using the type indicator it inherits fromIloNumVar.◆◆Objects of the class IloObjective represent objective functions of optimizationmodels. IloCplex deals with models containing at most one objective function,and the objective function must be linear, piecewise linear, or quadratic.Objects of the class IloRange represent constraints of the form: lower bound


IloXmlWriterto your particular model. In the case of the mixed integer optimizer, you can use yourown goals or callbacks and directly control the branch & cut search carried out byIloCplex.The most general kind of problem is a MIP. You might think of the LPs as a subset ofMIPs: an LP is a problem in which the model is:◆ without integer variables,◆ without Boolean variables,◆ without semi-continuous variables,◆ without piecewise linear functions,◆ without a quadratic component in the objective function,◆ without quadratic constraints,◆ and without a special ordered set (SOS).For linear programming problems (LPs), a variety of additional solution information canbe queried. These queries include dual information or, with the appropriate optimizeroption, basis information. Sensitivity analysis allows you to analyze how you canmodify your model while preserving the same solution. Or, if your model is infeasible,the infeasibility finder enables you to analyze the source of the infeasibility.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 472


ILOBARRIERCALLBACK0ILOBARRIERCALLBACK0CategorySynopsisDescriptionMacroILOBARRIERCALLBACK0(name)ILOBARRIERCALLBACK1(name, type1, x1)ILOBARRIERCALLBACK2(name, type1, x1, type2, x2)ILOBARRIERCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOBARRIERCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOBARRIERCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5)ILOBARRIERCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6)ILOBARRIERCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of methodduplicateCallback as required for callbacks. The implementation of the mainmethod must be provided in curly brackets {} by the user and must follow the macroinvocation, like this:ILOBARRIERCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::BarrierCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::BarrierCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 473


ILOBRANCHCALLBACK0ILOBRANCHCALLBACK0CategorySynopsisDescriptionMacroILOBRANCHCALLBACK0(name)ILOBRANCHCALLBACK1(name, type1, x1)ILOBRANCHCALLBACK2(name, type1, x1, type2, x2)ILOBRANCHCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOBRANCHCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOBRANCHCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5)ILOBRANCHCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6)ILOBRANCHCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOBRANCHCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::BranchCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::BranchCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 474


ILOCONTINUOUSCALLBACK0ILOCONTINUOUSCALLBACK0CategorySynopsisDescriptionMacroILOCONTINUOUSCALLBACK0(name)ILOCONTINUOUSCALLBACK1(name, type1, x1)ILOCONTINUOUSCALLBACK2(name, type1, x1, type2, x2)ILOCONTINUOUSCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOCONTINUOUSCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOCONTINUOUSCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5)ILOCONTINUOUSCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6)ILOCONTINUOUSCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of methodduplicateCallback as required for callbacks. The implementation of the mainmethod must be provided in curly brackets {} by the user and must follow the macroinvocation, like this:ILOCONTINUOUSCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::ContinuousCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::ContinuousCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 475


ILO<strong>CPLEX</strong>GOAL0ILO<strong>CPLEX</strong>GOAL0CategorySynopsisDescriptionMacroILO<strong>CPLEX</strong>GOAL0(name)ILO<strong>CPLEX</strong>GOAL1(name, type0, var0)ILO<strong>CPLEX</strong>GOAL2(name, type0, var0, type1, var1)ILO<strong>CPLEX</strong>GOAL3(name, type0, var0, type1, var1, type2, var2)ILO<strong>CPLEX</strong>GOAL4(name, t0, v0, t1, v1, t2, v2, t3, v3)ILO<strong>CPLEX</strong>GOAL5(name, t0, v0, t1, v1, t2, v2, t3, v3, t4, v4)ILO<strong>CPLEX</strong>GOAL6(name, t0, v0, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5)This macro defines a user goal class named nameI and a constructor named name withn data members, where n is the number following ILO<strong>CPLEX</strong>GOAL. The firstparameter of this macro is always the name of the constructor to be created. Whatfollows are n pairs of parameters, each parameter specifying a data member of the goal.The first parameter of such a pair specifies the type of the data member and is denoted asTi in the macro definition above. The second parameter of such a pair, denoted bydatai, specifies the data member's name.The constructor name created by this function will have IloEnvenv as its firstargument, followed by n additional arguments. The constructor creates a new instanceof the user-written goal class nameI and populates its data members with the argumentsfollowing IloEnvenv in the function argument list. The constructor name is whatyou should use to create new goal objects.The call to the macro must be followed immediately by the execute method of thegoal class. This method must be enclosed in curly brackets, as shown in the examplesthat follow. The macro will also generate an implementation of the methodduplicateGoal that simply calls the default constructor for the new class nameI.You are not obliged to use this macro to define goals. In particular, if your data membersdo not permit the use of the default constructor as an implementation of the methodduplicateGoal or the default destructor, you must subclass IloCplex::GoalIdirectly and implement those methods appropriately.Since the argument name is used to construct the name of the goal's implementationclass, it is not possible to use the same name for several goal definitions.ExampleHere's how to define a goal with one data member:ILO<strong>CPLEX</strong>GOAL1(PrintX, IloInt, x) {IloEnv env = getEnv();env.out()


ILO<strong>CPLEX</strong>GOAL0}return 0;This macro generates code similar to the following lines:class PrintXI : public IloCplex::GoalI {public:IloInt x;PrintXI(IloEnv env, IloInt arg1)IloCplex::Goal execute();IloCplex::Goal duplicateGoal();};PrintXI::PrintXI(IloEnv env, IloInt arg1) :IloCplex::GoalI(env),x(arg1) {}IloCplex::Goal PrintX(IloEnv env, IloInt x) {return new PrintXI(env, x);}IloCplex::Goal PrintXI::execute() {IloEnv env = getEnv();env.out()


ILOCROSSOVERCALLBACK0ILOCROSSOVERCALLBACK0CategorySynopsisDescriptionMacroILOCROSSOVERCALLBACK0(name)ILOCROSSOVERCALLBACK1(name, type1, x1)ILOCROSSOVERCALLBACK2(name, type1, x1, type2, x2)ILOCROSSOVERCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOCROSSOVERCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOCROSSOVERCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5)ILOCROSSOVERCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6)ILOCROSSOVERCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOCROSSOVERCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::CrossoverCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::CallbackI, IloCplex::CrossoverCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 478


ILOCUTCALLBACK0ILOCUTCALLBACK0CategorySynopsisDescriptionMacroILOCUTCALLBACK0(name)ILOCUTCALLBACK1(name, type1, x1)ILOCUTCALLBACK2(name, type1, x1, type2, x2)ILOCUTCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOCUTCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOCUTCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5)ILOCUTCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5,type6, x6)ILOCUTCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5,type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle to it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOCUTCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::CutCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::CutCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 479


ILODISJUNCTIVECUTCALLBACK0ILODISJUNCTIVECUTCALLBACK0CategorySynopsisDescriptionMacroILODISJUNCTIVECUTCALLBACK0(name)ILODISJUNCTIVECUTCALLBACK1(name, type1, x1)ILODISJUNCTIVECUTCALLBACK2(name, type1, x1, type2, x2)ILODISJUNCTIVECUTCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILODISJUNCTIVECUTCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4,x4)ILODISJUNCTIVECUTCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4,x4, type5, x5)ILODISJUNCTIVECUTCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4,x4, type5, x5, type6, x6)ILODISJUNCTIVECUTCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4,x4, type5, x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle to it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILODISJUNCTIVECUTCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::DisjunctiveCutCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::DisjunctiveCutCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 480


ILODISJUNCTIVECUTINFOCALLBACK0ILODISJUNCTIVECUTINFOCALLBACK0CategorySynopsisDescriptionMacroILODISJUNCTIVECUTINFOCALLBACK0(name)ILODISJUNCTIVECUTINFOCALLBACK1(name, type1, x1)ILODISJUNCTIVECUTINFOCALLBACK2(name, type1, x1, type2, x2)ILODISJUNCTIVECUTINFOCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILODISJUNCTIVECUTINFOCALLBACK4(name, type1, x1, type2, x2, type3, x3,type4, x4)ILODISJUNCTIVECUTINFOCALLBACK5(name, type1, x1, type2, x2, type3, x3,type4, x4, type5, x5)ILODISJUNCTIVECUTINFOCALLBACK6(name, type1, x1, type2, x2, type3, x3,type4, x4, type5, x5, type6, x6)ILODISJUNCTIVECUTINFOCALLBACK7(name, type1, x1, type2, x2, type3, x3,type4, x4, type5, x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle to it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILODISJUNCTIVECUTINFOCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::DisjunctiveCutInfoCallbackI and its parent classes can beused.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::DisjunctiveCutInfoCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 481


ILOFLOWMIRCUTCALLBACK0ILOFLOWMIRCUTCALLBACK0CategorySynopsisDescriptionMacroILOFLOWMIRCUTCALLBACK0(name)ILOFLOWMIRCUTCALLBACK1(name, type1, x1)ILOFLOWMIRCUTCALLBACK2(name, type1, x1, type2, x2)ILOFLOWMIRCUTCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOFLOWMIRCUTCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOFLOWMIRCUTCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5)ILOFLOWMIRCUTCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6)ILOFLOWMIRCUTCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first argument, followed by the narguments specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOFLOWMIRCUTCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::FlowMIRCutCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, <strong>ILOG</strong> recommends that you define a callback classdirectly. Since the argument name is used to name the callback class, it is not possible touse the same name for several callback definitions.See AlsoIloCplex::FlowMIRCutCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 482


ILOFLOWMIRCUTINFOCALLBACK0ILOFLOWMIRCUTINFOCALLBACK0CategorySynopsisDescriptionMacroILOFLOWMIRCUTINFOCALLBACK0(name)ILOFLOWMIRCUTINFOCALLBACK1(name, type1, x1)ILOFLOWMIRCUTINFOCALLBACK2(name, type1, x1, type2, x2)ILOFLOWMIRCUTINFOCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOFLOWMIRCUTINFOCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4,x4)ILOFLOWMIRCUTINFOCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4,x4, type5, x5)ILOFLOWMIRCUTINFOCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4,x4, type5, x5, type6, x6)ILOFLOWMIRCUTINFOCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4,x4, type5, x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first argument, followed by the narguments specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOFLOWMIRINFOCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::FlowMIRCutInfoCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, <strong>ILOG</strong> recommends that you define a callback classdirectly. Since the argument name is used to name the callback class, it is not possible touse the same name for several callback definitions.See AlsoIloCplex::FlowMIRCutInfoCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 483


ILOFRACTIONALCUTCALLBACK0ILOFRACTIONALCUTCALLBACK0CategorySynopsisDescriptionMacroILOFRACTIONALCUTCALLBACK0(name)ILOFRACTIONALCUTCALLBACK1(name, type1, x1)ILOFRACTIONALCUTCALLBACK2(name, type1, x1, type2, x2)ILOFRACTIONALCUTCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOFRACTIONALCUTCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOFRACTIONALCUTCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5)ILOFRACTIONALCUTCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6)ILOFRACTIONALCUTCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOFRACTIONALCUTCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::FractionalCutCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::FractionalCutCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 484


ILOFRACTIONALCUTINFOCALLBACK0ILOFRACTIONALCUTINFOCALLBACK0CategorySynopsisDescriptionMacroILOFRACTIONALCUTINFOCALLBACK0(name)ILOFRACTIONALCUTINFOCALLBACK1(name, type1, x1)ILOFRACTIONALCUTINFOCALLBACK2(name, type1, x1, type2, x2)ILOFRACTIONALCUTINFOCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOFRACTIONALCUTINFOCALLBACK4(name, type1, x1, type2, x2, type3, x3,type4, x4)ILOFRACTIONALCUTINFOCALLBACK5(name, type1, x1, type2, x2, type3, x3,type4, x4, type5, x5)ILOFRACTIONALCUTINFOCALLBACK6(name, type1, x1, type2, x2, type3, x3,type4, x4, type5, x5, type6, x6)ILOFRACTIONALCUTINFOCALLBACK7(name, type1, x1, type2, x2, type3, x3,type4, x4, type5, x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOFRACTIONALCUTINFOCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::FractionalCutInfoCallbackI and its parent classes can beused.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::FractionalCutInfoCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 485


ILOHEURISTICCALLBACK0ILOHEURISTICCALLBACK0CategorySynopsisDescriptionMacroILOHEURISTICCALLBACK0(name)ILOHEURISTICCALLBACK1(name, type1, x1)ILOHEURISTICCALLBACK2(name, type1, x1, type2, x2)ILOHEURISTICCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOHEURISTICCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOHEURISTICCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5)ILOHEURISTICCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6)ILOHEURISTICCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOHEURISTICCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::HeuristicCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::HeuristicCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 486


ILOINCUMBENTCALLBACK0ILOINCUMBENTCALLBACK0CategorySynopsisDescriptionMacroILOINCUMBENTCALLBACK0(name)ILOINCUMBENTCALLBACK1(name, type1, x1)ILOINCUMBENTCALLBACK2(name, type1, x1, type2, x2)ILOINCUMBENTCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOINCUMBENTCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOINCUMBENTCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5)ILOINCUMBENTCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6)ILOINCUMBENTCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOINCUMBENTCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::IncumbentCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::IncumbentCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 487


ILOLAZYCONSTRAINTCALLBACK0ILOLAZYCONSTRAINTCALLBACK0CategorySynopsisDescriptionMacroILOLAZYCONSTRAINTCALLBACK0(name)ILOLAZYCONSTRAINTCALLBACK1(name, type1, x1)ILOLAZYCONSTRAINTCALLBACK2(name, type1, x1, type2, x2)ILOLAZYCONSTRAINTCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOLAZYCONSTRAINTCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4,x4)ILOLAZYCONSTRAINTCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4,x4, type5, x5)ILOLAZYCONSTRAINTCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4,x4, type5, x5, type6, x6)ILOLAZYCONSTRAINTCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4,x4, type5, x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined lazyconstraint callback named nameI and a function named name that creates an instanceof this class and returns an IloCplex::Callback handle for it. This function needsto be called with an environment as first parameter followed by the n parametersspecified at the macro execution in order to create a callback. You can then use thecallback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of methodmakeClone as required for callbacks. The implementation of the main method mustbe provided in curly brackets {} by the user and must follow the macro invocation, likethis:ILOLAZYCONSTRAINTCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::LazyConstraintCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::LazyConstraintCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 488


ILOMIPCALLBACK0ILOMIPCALLBACK0CategorySynopsisDescriptionMacroILOMIPCALLBACK0(name)ILOMIPCALLBACK1(name, type1, x1)ILOMIPCALLBACK2(name, type1, x1, type2, x2)ILOMIPCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOMIPCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOMIPCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5)ILOMIPCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5,type6, x6)ILOMIPCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5,type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOMIPCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::MIPCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::MIPCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 489


ILOMIPINFOCALLBACK0ILOMIPINFOCALLBACK0CategorySynopsisDescriptionMacroILOMIPINFOCALLBACK0(name)ILOMIPINFOCALLBACK1(name, type1, x1)ILOMIPINFOCALLBACK2(name, type1, x1, type2, x2)ILOMIPINFOCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOMIPINFOCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOMIPINFOCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5)ILOMIPINFOCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6)ILOMIPINFOCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOMIPINFOCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::MIPInfoCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::MIPInfoCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 490


ILONETWORKCALLBACK0ILONETWORKCALLBACK0CategorySynopsisDescriptionMacroILONETWORKCALLBACK0(name)ILONETWORKCALLBACK1(name, type1, x1)ILONETWORKCALLBACK2(name, type1, x1, type2, x2)ILONETWORKCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILONETWORKCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILONETWORKCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5)ILONETWORKCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6)ILONETWORKCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILONETWORKCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::NetworkCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::NetworkCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 491


ILONODECALLBACK0ILONODECALLBACK0CategorySynopsisDescriptionMacroILONODECALLBACK0(name)ILONODECALLBACK1(name, type1, x1)ILONODECALLBACK2(name, type1, x1, type2, x2)ILONODECALLBACK3(name, type1, x1, type2, x2, type3, x3)ILONODECALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILONODECALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5)ILONODECALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5,type6, x6)ILONODECALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5,type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILONODECALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::NodeCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::NodeCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 492


ILOPRESOLVECALLBACK0ILOPRESOLVECALLBACK0CategorySynopsisDescriptionMacroILOPRESOLVECALLBACK0(name)ILOPRESOLVECALLBACK1(name, type1, x1)ILOPRESOLVECALLBACK2(name, type1, x1, type2, x2)ILOPRESOLVECALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOPRESOLVECALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOPRESOLVECALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5)ILOPRESOLVECALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6)ILOPRESOLVECALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOPRESOLVECALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::PresolveCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::PresolveCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 493


ILOPROBINGCALLBACK0ILOPROBINGCALLBACK0CategorySynopsisDescriptionMacroILOPROBINGCALLBACK0(name)ILOPROBINGCALLBACK1(name, type1, x1)ILOPROBINGCALLBACK2(name, type1, x1, type2, x2)ILOPROBINGCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOPROBINGCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOPROBINGCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5)ILOPROBINGCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6)ILOPROBINGCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOPROBINGCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::ProbingCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::ProbingCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 494


ILOPROBINGINFOCALLBACK0ILOPROBINGINFOCALLBACK0CategorySynopsisDescriptionMacroILOPROBINGINFOCALLBACK0(name)ILOPROBINGINFOCALLBACK1(name, type1, x1)ILOPROBINGINFOCALLBACK2(name, type1, x1, type2, x2)ILOPROBINGINFOCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOPROBINGINFOCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOPROBINGINFOCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5)ILOPROBINGINFOCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6)ILOPROBINGINFOCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4,type5, x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOPROBINGINFOCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::ProbingInfoCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::ProbingInfoCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 495


ILOSIMPLEXCALLBACK0ILOSIMPLEXCALLBACK0CategorySynopsisDescriptionMacroILOSIMPLEXCALLBACK0(name)ILOSIMPLEXCALLBACK1(name, type1, x1)ILOSIMPLEXCALLBACK2(name, type1, x1, type2, x2)ILOSIMPLEXCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOSIMPLEXCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOSIMPLEXCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5)ILOSIMPLEXCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6)ILOSIMPLEXCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOSIMPLEXCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::SimplexCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::SimplexCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 496


ILOSOLVECALLBACK0ILOSOLVECALLBACK0CategorySynopsisDescriptionMacroILOSOLVECALLBACK0(name)ILOSOLVECALLBACK1(name, type1, x1)ILOSOLVECALLBACK2(name, type1, x1, type2, x2)ILOSOLVECALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOSOLVECALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOSOLVECALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5)ILOSOLVECALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6)ILOSOLVECALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first parameter, followed by the nparameters specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOSOLVECALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::SolveCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::SolveCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 497


ILOTUNINGCALLBACK0ILOTUNINGCALLBACK0CategorySynopsisDescriptionMacroILOTUNINGCALLBACK0(name)ILOTUNINGCALLBACK1(name, type1, x1)ILOTUNINGCALLBACK2(name, type1, x1, type2, x2)ILOTUNINGCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOTUNINGCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOTUNINGCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5)ILOTUNINGCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6)ILOTUNINGCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined callbacknamed nameI and a function named name that creates an instance of this class andreturns a handle for it, that is, an instance of IloCplex::Callback. This functionneeds to be called with an environment as its first argument, followed by the narguments specified at the macro execution in order to create a callback. You can thenuse the callback by passing it to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod duplicateCallback as required for callbacks. The implementation of themain method must be provided in curly brackets {} by the user and must follow themacro invocation, like this:ILOTUNINGCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::TuningCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, <strong>ILOG</strong> recommends that you define a callback classdirectly. Since the argument name is used to name the callback class, it is not possible touse the same name for several callback definitions.See AlsoIloCplex::TuningCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 498


ILOUSERCUTCALLBACK0ILOUSERCUTCALLBACK0CategorySynopsisDescriptionMacroILOUSERCUTCALLBACK0(name)ILOUSERCUTCALLBACK1(name, type1, x1)ILOUSERCUTCALLBACK2(name, type1, x1, type2, x2)ILOUSERCUTCALLBACK3(name, type1, x1, type2, x2, type3, x3)ILOUSERCUTCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)ILOUSERCUTCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5)ILOUSERCUTCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6)ILOUSERCUTCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5,x5, type6, x6, type7, x7)This macro creates two things: an implementation class for a user-defined user cutcallback named nameI and a function named name that creates an instance of this classand returns an IloCplex::Callback handle for it. This function needs to be calledwith an environment as first parameter followed by the n parameters specified at themacro execution in order to create a callback. You can then use the callback by passingit to the use method of an IloCplex object.The class nameI that is created by the macro includes the implementation of themethod makeClone as required for callbacks. The implementation of the mainmethod must be provided in curly brackets {} by the user and must follow the macroinvocation, like this:ILOUSERCUTCALLBACKn(name, ...) {// implementation of the callback}For the implementation of the callback, methods from the classIloCplex::UserCutCallbackI and its parent classes can be used.You are not obliged to use this macro to define callbacks. When the macro seems toorestrictive for your purposes, we recommend that you define a callback class directly.Since the argument name is used to name the callback class, it is not possible to use thesame name for several callback definitions.See AlsoIloCplex::UserCutCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 499


IloBoundIloBoundCategoryClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicpublicpublicIloBound()IloBound(IloBoundI * impl)IloBound(IloNumVar var,IloBound::Type type)Method Summarypublic IloBoundI *public IloBound::Typepublic IloNumVargetImpl() constgetType()getVar()Inherited methods from IloConstraintIloConstraint::getImpl<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 500


IloBoundInherited methods from IloIntExprArgIloIntExprArg::getImplInherited methods from IloNumExprArgIloNumExprArg::getImplInherited methods from IloExtractableIloExtractable::asConstraint, IloExtractable::asIntExpr,IloExtractable::asModel, IloExtractable::asNumExpr,IloExtractable::asObjective, IloExtractable::asVariable,IloExtractable::end, IloExtractable::getEnv, IloExtractable::getId,IloExtractable::getImpl, IloExtractable::getName,IloExtractable::getObject, IloExtractable::isConstraint,IloExtractable::isIntExpr, IloExtractable::isModel,IloExtractable::isNumExpr, IloExtractable::isObjective,IloExtractable::isVariable, IloExtractable::setName,IloExtractable::setObjectInner EnumerationIloBound::TypeDescriptionConstructorsThis class represents a bound as a constraint in a conflict.public IloBound()This constructor creates an empty handle. You must initialize it before you use it.public IloBound(IloBoundI * impl)This constructor creates a handle object from a pointer to an implementation object.public IloBound(IloNumVar var,IloBound::Type type)This constructor creates a bound for use in conflicts.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 501


IloBoundMethodspublic IloBoundI * getImpl() constThis member function returns a pointer to the implementation object of the invokinghandle.public IloBound::Type getType()Accesses the bound specified by the invoking object.public IloNumVar getVar()Accesses the variable for which the invoking object specifies a bound.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 502


IloBound::TypeIloBound::TypeCategoryDefinition FileSynopsisDescriptionFieldsInner Enumerationilcplex/ilocplexi.hType{Lower,Upper};This enumeration lists the types of bounds that may appear in a conflict.LowerUpper<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 503


IloCplexIloCplexCategoryClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicpublicIloCplex(IloEnv env)IloCplex(const IloModel model)Method Summarypublic IloConstraintpublic constIloConstraintArraypublic FilterIndexpublic FilterIndexpublic IloConstraintpublic constIloConstraintArraypublic FilterIndexpublic FilterIndexpublic IloConstraintaddCut(IloConstraint con)addCuts(const IloConstraintArray con)addDiversityFilter(IloNum lower_cutoff,IloNumupper_cutoff,const IloIntVarArray vars,constIloNumArray weights,const IloNumArrayrefval,const char * fname=0)addDiversityFilter(IloNum lower_cutoff,IloNumupper_cutoff,const IloNumVarArray vars,constIloNumArray weights,const IloNumArrayrefval,const char * fname=0)addLazyConstraint(IloConstraint con)addLazyConstraints(const IloConstraintArraycon)addRangeFilter(IloNum,IloNum,constIloIntVarArray,const IloNumArray,const char*=0)addRangeFilter(IloNum,IloNum,constIloNumVarArray,const IloNumArray,const char*=0)addUserCut(IloConstraint con)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 504


IloCplexpublic constIloConstraintArraypublic static IloCplex::Goalpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic IloNumpublic voidpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic voidpublic IloCplex::Aborterpublic IloCplex::Algorithmpublic voidpublic IloNumpublic IloCplex::BasisStatuspublic IloCplex::BasisStatuspublic IloCplex::BasisStatuspublic voidaddUserCuts(const IloConstraintArray con)Apply(IloCplex cplex,IloCplex::Goalgoal,IloCplex::NodeEvaluator eval)basicPresolve(const IloNumVarArrayvars,IloNumArray redlb=0,IloNumArrayredub=0,const IloRangeArrayrngs=0,IloBoolArray redundant=0) constclearCuts()clearLazyConstraints()clearModel()clearUserCuts()delDirection(IloNumVar var)delDirections(const IloNumVarArray var)delFilter(FilterIndex filter)delPriorities(const IloNumVarArray var)delPriority(IloNumVar var)delSolnPoolSoln(IloInt which)delSolnPoolSolns(IloInt begin,IloInt end)dualFarkas(IloConstraintArrayrng,IloNumArray y)exportModel(const char * filename) constfeasOpt(const IloConstraintArray cts,constIloNumArray prefs)feasOpt(const IloRangeArray rngs,constIloNumArray rnglb,const IloNumArray rngub)feasOpt(const IloNumVarArray vars,constIloNumArray varlb,const IloNumArray varub)feasOpt(const IloRangeArray rngs,constIloNumArray rnglb,const IloNumArrayrngub,const IloNumVarArray vars,constIloNumArray varlb,const IloNumArray varub)freePresolve()getAborter()getAlgorithm() constgetAX(IloNumArray val,const IloRangeArraycon) constgetAX(const IloRange range) constgetBasisStatus(const IloConstraint con) constgetBasisStatus(const IloIntVar var) constgetBasisStatus(const IloNumVar var) constgetBasisStatuses(IloCplex::BasisStatusArraycstat,const IloNumVarArrayvar,IloCplex::BasisStatusArray rstat,constIloConstraintArray con) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 505


IloCplexpublic voidpublic voidpublic IloNumpublic voidpublicIloCplex::ConflictStatuspublicIloCplex::ConflictStatusArraypublic IloCplex::CplexStatuspublic IloCplex::CplexStatuspublic IloNumpublic IloBoolpublic IloCplex::DeleteModepublicIloCplex::BranchDirectionpublic voidpublic IloExtractablepublic IloNumpublic voidpublic IloNumpublic voidpublic IloNumpublic voidpublic FilterIndexpublic FilterTypepublic voidpublic IloIntpublic IloNumpublic IloNumgetBasisStatuses(IloCplex::BasisStatusArraystat,const IloConstraintArray con) constgetBasisStatuses(IloCplex::BasisStatusArraystat,const IloNumVarArray var) constgetBestObjValue() constgetBoundSA(IloNumArray lblower,IloNumArraylbupper,IloNumArray ublower,IloNumArrayubupper,const IloNumVarArray vars) constgetConflict(IloConstraint con) constgetConflict(IloConstraintArray cons) constgetCplexStatus() constgetCplexSubStatus() constgetCutoff() constgetDefault(IloCplex::BoolParam parameter)constgetDeleteMode() constgetDirection(IloNumVar var) constgetDirections(IloCplex::BranchDirectionArray dir,const IloNumVarArray var) constgetDiverging() constgetDiversityFilterLowerCutoff(FilterIndexfilter) constgetDiversityFilterRefVals(FilterIndexfilter,IloNumArray) constgetDiversityFilterUpperCutoff(FilterIndexfilter) constgetDiversityFilterWeights(FilterIndexfilter,IloNumArray) constgetDual(const IloRange range) constgetDuals(IloNumArray val,const IloRangeArraycon) constgetFilterIndex(const char * lname_str) constgetFilterType(FilterIndex filter) constgetFilterVars(FilterIndexfilter,IloNumVarArray) constgetIncumbentNode() constgetInfeasibilities(IloNumArray infeas,constIloIntVarArray var) constgetInfeasibilities(IloNumArray infeas,constIloNumVarArray var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 506


IloCplexpublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloObjectivepublic voidpublic IloNumpublic IloBoolpublicIloCplex::ParameterSetpublic voidpublic IloNumgetInfeasibilities(IloNumArray infeas,constIloConstraintArray con) constgetInfeasibility(const IloIntVar var) constgetInfeasibility(const IloNumVar var) constgetInfeasibility(const IloConstraint con)constgetMax(IloCplex::IntParam parameter) constgetMin(IloCplex::IntParam parameter) constgetNbarrierIterations() constgetNbinVars() constgetNcols() constgetNcrossDExch() constgetNcrossDPush() constgetNcrossPExch() constgetNcrossPPush() constgetNcuts(IloCplex::CutType which) constgetNdualSuperbasics() constgetNfilters() constgetNintVars() constgetNiterations() constgetNnodes() constgetNnodesLeft() constgetNNZs() constgetNphaseOneIterations() constgetNprimalSuperbasics() constgetNQCs() constgetNrows() constgetNsemiContVars() constgetNsemiIntVars() constgetNsiftingIterations() constgetNsiftingPhaseOneIterations() constgetNSOSs() constgetObjective() constgetObjSA(IloNumArray lower,IloNumArrayupper,const IloNumVarArray vars) constgetObjValue(IloInt soln) constgetParam(IloCplex::BoolParam parameter) constgetParameterSet()getPriorities(IloNumArray pri,constIloNumVarArray var) constgetPriority(IloNumVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 507


IloCplexpublic IloNumgetQuality(IloCplex::Quality q,IloIntsoln,IloConstraint * rng,IloNumVar * var=0)constpublic IloNum getQuality(IloCplex::Quality q,IloNumVar *var=0,IloConstraint * rng=0) constpublic voidpublic IloNumpublic IloNumpublic voidpublic voidpublic IloNumpublic IloNumpublic voidpublic voidpublic voidpublic IloNumpublic voidpublic IloNumpublic IloIntpublic IloIntpublic IloAlgorithm::Statuspublic IloCplex::Algorithmpublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic voidpublic voidgetRangeFilterCoefs(FilterIndexfilter,IloNumArray) constgetRangeFilterLowerBound(FilterIndex filter)constgetRangeFilterUpperBound(FilterIndex filter)constgetRangeSA(IloNumArray lblower,IloNumArraylbupper,IloNumArray ublower,IloNumArrayubupper,const IloRangeArray con) constgetRay(IloNumArray vals,IloNumVarArray vars)constgetReducedCost(const IloIntVar var) constgetReducedCost(const IloNumVar var) constgetReducedCosts(IloNumArray val,constIloIntVarArray var) constgetReducedCosts(IloNumArray val,constIloNumVarArray var) constgetRHSSA(IloNumArray lower,IloNumArrayupper,const IloRangeArray cons) constgetSlack(const IloRange range,IloInt soln=-1)constgetSlacks(IloNumArray val,constIloRangeArray con,IloInt soln=-1) constgetSolnPoolMeanObjValue() constgetSolnPoolNreplaced() constgetSolnPoolNsolns() constgetStatus() constgetSubAlgorithm() constgetValue(const IloObjective ob,IloInt soln)constgetValue(const IloNumExprArg expr,IloIntsoln) constgetValue(const IloIntVar var,IloInt soln)constgetValue(const IloNumVar var,IloInt soln)constgetValues(const IloIntVarArrayvar,IloNumArray val,IloInt soln) constgetValues(IloNumArray val,constIloIntVarArray var,IloInt soln) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 508


IloCplexpublic voidpublic voidpublic voidpublic voidpublic voidpublic const char *getValues(IloNumArray val,constIloNumVarArray var,IloInt soln) constgetValues(const IloIntVarArrayvar,IloNumArray val) constgetValues(IloNumArray val,constIloIntVarArray var) constgetValues(const IloNumVarArrayvar,IloNumArray val) constgetValues(IloNumArray val,constIloNumVarArray var) constgetVersion() constpublic void importModel(IloModel & m,const char *filename) constpublic void importModel(IloModel & m,const char *filename,IloObjective & obj,IloNumVarArrayvars,IloRangeArray rngs,IloRangeArraylazy=0,IloRangeArray cuts=0) constpublic void importModel(IloModel & model,const char *filename,IloObjective & obj,IloNumVarArrayvars,IloRangeArray rngs,IloSOS1Arraysos1,IloSOS2Array sos2,IloRangeArraylazy=0,IloRangeArray cuts=0) constpublic IloBoolisDualFeasible() constpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic static IloCplex::Goalpublic IloBoolpublic voidpublic voidpublic voidpublic voidpublic voidpublic FilterIndexArraypublic voidpublic voidpublic voidpublic voidpublic IloBoolpublic voidisMIP() constisPrimalFeasible() constisQC() constisQO() constLimitSearch(IloCplex cplex,IloCplex::Goalgoal,IloCplex::SearchLimit limit)populate()presolve(IloCplex::Algorithm alg)protectVariables(const IloIntVarArray var)protectVariables(const IloNumVarArray var)qpIndefCertificate(IloNumVarArrayvar,IloNumArray x)readBasis(const char * name) constreadFilters(const char * name)readMIPStart(const char * name) constreadOrder(const char * filename) constreadParam(const char * name) constreadSolution(const char * name) constrefineConflict(IloConstraintArraycons,IloNumArray prefs)remove(IloCplex::Aborter abort)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 509


IloCplexpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic IloBoolpublic IloBoolpublic IloBoolsetBasisStatuses(constIloCplex::BasisStatusArray cstat,constIloNumVarArray var,constIloCplex::BasisStatusArray rstat,constIloConstraintArray con)setDefaults()setDeleteMode(IloCplex::DeleteMode mode)setDirection(IloNumVarvar,IloCplex::BranchDirection dir)setDirections(const IloNumVarArray var,constIloCplex::BranchDirectionArray dir)setParam(IloCplex::BoolParamparameter,IloBool value)setParameterSet(IloCplex::ParameterSet set)setPriorities(const IloNumVarArray var,constIloNumArray pri)setPriority(IloNumVar var,IloNum pri)setVectors(const IloNumArray x,constIloNumArray dj,const IloNumVarArray var,constIloNumArray slack,const IloNumArray pi,constIloRangeArray rng)solve(IloCplex::Goal goal)solve()solveFixed(IloInt soln=-1)public IloInt tuneParam(IloArray< const char *>filename,IloCplex::ParameterSet fixedset)public IloCplex::Callback use(IloCplex::Callback cb)public IloCplex::Aborterpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voidpublic voiduse(IloCplex::Aborter abort)writeBasis(const char * name) constwriteConflict(const char * filename) constwriteFilters(const char * name)writeMIPStart(const char * name,IloInt soln=-1) constwriteMIPStarts(const char * name) constwriteOrder(const char * filename) constwriteParam(const char * name) constwriteSolution(const char * name,IloInt soln=-1) constwriteSolutions(const char * name) constInherited methods from IloAlgorithm<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 510


IloCplexclear, end, error, extract, getEnv, getIntValue, getIntValues, getModel,getObjValue, getStatus, getTime, getValue, getValue, getValue, getValue,getValues, getValues, isExtracted, out, printTime, resetTime, setError,setOut, setWarning, solve, warningInner EnumerationIloCplex::AlgorithmIloCplex::BasisStatusIloCplex::BoolParamIloCplex::BranchDirectionIloCplex::ConflictStatusIloCplex::CplexStatusIloCplex::CutTypeIloCplex::DeleteModeIloCplex::DualPricingIloCplex::IntParamIloCplex::MIPEmphasisTypeIloCplex::MIPsearchIloCplex::NodeSelectIloCplex::NumParamIloCplex::Parallel_ModeIloCplex::PrimalPricingIloCplex::QualityIloCplex::RelaxationIloCplex::StringParamIloCplex::TuningStatusIloCplex::VariableSelectInner ClassIloCplex::IloCplex::GoalIIloCplex::IloCplex::GoalIloCplex::IloCplex::CutCallbackIIloCplex::IloCplex::HeuristicCallbackIIloCplex::IloCplex::BranchCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 511


IloCplexIloCplex::IloCplex::ControlCallbackIIloCplex::IloCplex::DisjunctiveCutCallbackIIloCplex::IloCplex::FlowMIRCutCallbackIIloCplex::IloCplex::FractionalCutCallbackIIloCplex::IloCplex::DisjunctiveCutInfoCallbackIIloCplex::IloCplex::FlowMIRCutInfoCallbackIIloCplex::IloCplex::FractionalCutInfoCallbackIIloCplex::IloCplex::CrossoverCallbackIIloCplex::IloCplex::BarrierCallbackIIloCplex::IloCplex::ContinuousCallbackIIloCplex::IloCplex::CallbackIIloCplex::IloCplex::CallbackIloCplex::IloCplex::AborterIloCplex::IloCplex::ExceptionIloCplex::IloCplex::ParameterSetIloCplex::IloCplex::MultipleObjExceptionIloCplex::IloCplex::MultipleConversionExceptionIloCplex::IloCplex::UnknownExtractableExceptionIloCplex::IloCplex::InvalidCutExceptionIloCplex::IloCplex::TuningCallbackIIloCplex::IloCplex::OptimizationCallbackIIloCplex::IloCplex::PresolveCallbackIIloCplex::IloCplex::SimplexCallbackIIloCplex::IloCplex::NetworkCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 512


IloCplexIloCplex::IloCplex::MIPInfoCallbackIIloCplex::IloCplex::ProbingInfoCallbackIIloCplex::IloCplex::MIPCallbackIIloCplex::IloCplex::ProbingCallbackIIloCplex::IloCplex::IncumbentCallbackIIloCplex::IloCplex::NodeCallbackIIloCplex::IloCplex::SolveCallbackIIloCplex::IloCplex::UserCutCallbackIIloCplex::IloCplex::LazyConstraintCallbackIIloCplex::IloCplex::NodeEvaluatorIIloCplex::IloCplex::NodeEvaluatorIloCplex::IloCplex::SearchLimitIIloCplex::IloCplex::SearchLimitInner Type DefIloCplex::IloCplex::BasisStatusArrayIloCplex::IloCplex::BranchDirectionArrayIloCplex::IloCplex::ConflictStatusArrayIloCplex::IloCplex::Status An enumeration for the class IloAlgorithm.DescriptionIloCplex derives from the class IloAlgorithm. Use it to solve MathematicalProgramming models, such as:◆◆LP (linear programming) problems,QP (programs with quadratic terms in the objective function),<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 513


IloCplex◆QCP (quadratically constrained programming), including the special case of SOCP(second order cone programming) problems, and◆ MIP (mixed integer programming) problems.An algorithm (that is, an instance of IloAlgorithm) extracts a model in anenvironment. The model extracted by an algorithm is known as the active model.More precisely, models to be solved by IloCplex should contain onlyIloExtractable objects from the following list:◆variables: objects of type IloNumVar and its extensions IloIntVar andIloSemiContVar◆ range constraints: objects of type IloRange◆ other relational constraints: objects of type IloConstraint of the formexpr1 relation expr2, where the relation is one of ==, >=,


IloCplexMinimize (or Maximize) c'x + x'Qxsubject toL


IloCplex◆◆getNQCs for querying the number of quadratic constraints,getNNZs for querying the number of nonzero elements in A, and◆ getNSOSs for querying the number of special ordered sets (SOSs).Additional information about the active model can be obtained through iterators definedon the different types of modeling objects in the extracted or active model.IloCplex effectively treats all models as MIQCP models. That is, it allows the mostgeneral case, although the solution algorithms make efficient use of special cases, suchas taking advantage of the absence of quadratic terms in the formulation. The methodsolve begins by solving the root relaxation of the MIQCP model, where allintegrality constraints and SOSs are ignored. If the model has no integrality constraintsor SOSs, then the optimization is complete once the root relaxation is solved. Otherwise,IloCplex uses a branch and cut procedure to reintroduce the integrality constraints orSOSs. See the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong> for more information about branch & cut.Most users can simply call solve to solve their models. However, several parametersare available for users who require more control. These parameters are documented inthe <strong>ILOG</strong> <strong>CPLEX</strong> Parameter <strong>Reference</strong> <strong>Manual</strong>. Perhaps the most importantparameter is IloCplex::RootAlg, which determines the algorithm used to solvethe root relaxation. Possible settings, as defined in the classIloCplex::Algorithm, are:◆◆◆◆◆◆◆IloCplex::Auto IloCplex automatically selects an algorithm. This is the defaultsetting.IloCplex::Primal Use the primal simplex algorithm. This option is not available forquadratically constrained problems (QCPs).IloCplex::Dual Use the dual simplex algorithm. This option is not available forquadratically constrained problems (QCPs).IloCplex::Network Use network simplex on the embedded network part of themodel, followed by dual simplex on the entire model. This option is not availablefor quadratically constrained problems.IloCplex::Barrier Use the barrier algorithm.IloCplex::Sifting Use the sifting algorithm. This option is not available forquadratic problems. If selected nonetheless, IloCplex defaults to theIloCplex::Auto setting.IloCplex::Concurrent Use the several algorithms concurrently. This option is notavailable for quadratic problems. If selected nonetheless, IloCplex defaults to theIloCplex::Auto setting.Numerous other parameters allow you to control algorithmic aspects of the optimizer.See the nested enumerations IloCplex::IntParam,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 516


IloCplexIloCplex::DoubleParam, and IloCplex#StringParam for furtherinformation. Parameters are set with the method setParam.Even higher levels of control can be achieved through goals (see IloCplex::Goal)or through callbacks (see IloCplex::Callback and its extensions).Information about a SolutionThe solve method returns an IloBool value specifying whether (IloTrue)ornot(IloFalse) a solution (not necessarily the optimal one) has been found. Furtherinformation about the solution can be queried with the method getStatus. The returncode of type IloAlgorithm::Status specifies whether the solution is feasible,bounded, or optimal, or if the model has been proven to be infeasible or unbounded.The method getCplexStatus provides more detailed information about the statusof the optimizer after solve returns. For example, it can provide information on whythe optimizer terminated prematurely (time limit, iteration limit, or other similar limits).The methods isPrimalFeasible and isDualFeasible can determine whethera primal or dual feasible solution has been found and can be queried.The most important solution information computed by IloCplex are usually thesolution vector and the objective function value. The methodIloCplex::getValue queries the solution vector. The methodIloCplex::getObjValue queries the objective function value. Most optimizersalso compute additional solution information, such as dual values, reduced costs,simplex bases, and others. This additional information can also be queried throughvarious methods of IloCplex. If you attempt to retrieve solution information that isnot available from a particular optimizer, IloCplex will throw an exception.If you are solving an LP and a basis is available, the solution can be further analyzed byperforming sensitivity analysis. This information tells you how sensitive the solution iswith respect to changes in variable bounds, constraint bounds, or objective coefficients.The information is computed and accessed with the methods getBoundSA,getRangeSA, getRHSSA, and getObjSA.An important consideration when you access solution information is the numericquality of the solution. Since IloCplex performs arithmetic operations using finiteprecision, solutions are always subject to numeric errors. For most problems, numericerrors are well within reasonable tolerances. However, for numerically difficult models,you are advised to verify the quality of the solution using the method getQuality,which offers a variety of quality measures.More about Solving ProblemsBy default when the method solve is called, IloCplex first presolves the model;that is, it transforms the model into a smaller, yet equivalent model. This operation canbe controlled with the following parameters:◆IloCplex::PreInd,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 517


IloCplex◆ IloCplex::PreDual,◆ IloCplex::AggInd, and◆ IloCplex::AggFill.For the rare occasion when a user wants to monitor progress during presolve, thecallback class IloCplex::PresolveCallbackI is provided.After the presolve is completed, IloCplex solves the first node relaxation and (incases of a true MIP) enters the branch & cut process. IloCplex provides callbackclasses that allow the user to monitor solution progress at each level. Callbacks derivedfrom IloCplex::ContinuousCallbackI or one of its derived classes are calledregularly during the solution of a node relaxation (including the root), and callbacksderived from IloCplex::MIPCallbackI or one of its derived callbacks are calledregularly during branch & cut search. All callbacks provide the option to abort thecurrent optimization.Branch Priorities and DirectionsWhen a branch occurs at a node in the branch & cut tree, usually there is a set offractional-valued variables available to pick from for branching. IloCplex has severalbuilt-in rules for making such a choice, and they can be controlled by the parameterIloCplex::VarSel. Also, the method setPriority allows the user to specifya priority order. An instance of IloCplex branches on variables with an assignedpriority before variables without a priority. It also branches on variables with higherpriority before variables with lower priority, when the variables have fractional values.Frequently, when two new nodes have been created (controlled by the parameterIloCplex::BtTol), one of the two nodes is processed next. This activity is knownas diving. The branch direction determines which of the branches, the up or the downbranch, is used when diving. By default, IloCplex automatically selects the branchdirection. The user can control the branch direction by the method setDirection.As mentioned before, the greatest flexibility for controlling the branching during branch& cut search is provided through goals (see IloCplex::Goal) or through thecallbacks (see IloCplex::BranchCallbackI). With these concepts, you cancontrol the branching decision based on runtime information during the search, insteadof statically through branch priorities and directions, but the default strategies work wellon many problems.CutsAn instance of IloCplex can also generate certain cuts in order to strengthen therelaxation, that is, in order to make the relaxation a better approximation of the originalMIP. Cuts are constraints added to a model to restrict (cut away) noninteger solutionsthat would otherwise be solutions of the relaxation. The addition of cuts usually reducesthe number of branches needed to solve a MIP.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 518


IloCplexWhen solving a MIP, IloCplex tries to generate violated cuts to add to the problemafter solving a node. After IloCplex adds cuts, the subproblem is re-optimized.IloCplex then repeats the process of adding cuts at a node and reoptimizing until itfinds no further effective cuts.An instance of IloCplex generates its cuts in such a way that they are valid for allsubproblems, even when they are discovered during analysis of a particular node. Aftera cut has been added to the problem, it will remain in the problem to the end of theoptimization. However, cuts are added only internally; that is, they will not be part ofthe model extracted to the IloCplex object after the optimization. Cuts are mostfrequently seen at the root node, but they may be added by an instance of IloCplex atother nodes as conditions warrant.IloCplex looks for various kinds of cuts that can be controlled by the followingparameters:◆◆◆◆◆◆◆◆IloCplex::Cliques,IloCplex::Covers,IloCplex::FlowCovers,IloCplex::GUBCovers,IloCplex::FracCuts,IloCplex::MIRCuts,IloCplex::FlowPaths,IloCplex::ImplBd, and◆ IloCplex::DisjCuts.During the search, you can query information about those cuts with a callback (seeIloCplex::MIPCallbackI and its subclasses). For types of cuts that may take along time to generate, callbacks are provided to monitor the progress and potentiallyabort the cut generation progress. In particular, those callback classes areIloCplex::FractionalCutCallbackI andIloCplex::DisjunctiveCutCallbackI. The callback classIloCplex::CutCallbackI allows you to add your own problem-specific cutsduring search. This callback also allows you to generate and add local cuts, that is cutsthat are only valid within the subtree where they have been added.Instead of using callbacks, you can use goals to add your own cuts during theoptimization.HeuristicsAfter a node has been processed, that is, the LP has been solved and no more cuts weregenerated, IloCplex may try to construct an integer feasible solution from the LP<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 519


IloCplexsolution at that node. The parameter IloCplex::HeurFreq and other parametersprovide some control over this activity. In addition, goals or the callback classIloCplex::HeuristicCallbackI make it possible to call user-writtenheuristics to find an integer feasible solution.Again, instead of using callbacks, you can use goals to add inject your own heuristicallyconstructed solution into the running optimization.Node SelectionWhen IloCplex is not diving but picking an unexplored node from the tree, severaloptions are available that can be controlled with the parameterIloCplex::NodeSel. Again, IloCplex offers a callback class,IloCplex::NodeCallbackI, to give the user full control over this selection. Withgoals, objects of type IloCplex::NodeEvaluatorI can be used to define yourown selection strategy.See also IloAlgorithm in the <strong>ILOG</strong> Concert <strong>Reference</strong> <strong>Manual</strong>.See also Goals among the Concepts in this manual. See also goals in the <strong>ILOG</strong> <strong>CPLEX</strong>User's <strong>Manual</strong>.See AlsoConstructorsIloCplex::Algorithm, IloCplex::BasisStatus,IloCplex::BasisStatusArray, IloCplex::BranchDirection,IloCplex::BranchDirectionArray, IloCplex::CallbackI,IloCplex::DeleteMode, IloCplex::DualPricing,IloCplex::Exception, IloCplex::IntParam,IloCplex::MIPEmphasisType, IloCplex::NodeSelect,IloCplex::NumParam, IloCplex::PrimalPricing,IloCplex::Quality, IloCplex::CplexStatus,IloCplex::StringParam, IloCplex::VariableSelect,IloCplex::GoalIpublic IloCplex(IloEnv env)This constructor creates an <strong>ILOG</strong> <strong>CPLEX</strong> algorithm. The new IloCplex object has noIloModel loaded (or extracted) to it.public IloCplex(const IloModel model)This constructor creates an <strong>ILOG</strong> <strong>CPLEX</strong> algorithm and extracts model for thatalgorithm.When you create an algorithm (an instance of IloCplex, for example) and extract amodel for it, you can write either this line:IloCplex cplex(model);<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 520


IloCplexor these two lines:IloCplex cplex(env);cplex.extract(model);Methodspublic IloConstraint addCut(IloConstraint con)This method adds con as a cut to the invoking IloCplex object. The cut is notextracted as the regular constraints in a model, but is only copied when invoking themethod addCut. Thus, con may be deleted or modified after addCut has been calledand the change will not be notified to the invoking IloCplex object.When columns are deleted from the extracted model, all cuts are deleted as well andneed to be reextracted if they should be considered. Cuts are not part of the rootproblem, but are considered on an as-needed basis. A solution computed by IloCplexis guaranteed to satisfy all cuts added with this method.public const IloConstraintArray addCuts(const IloConstraintArray con)This method adds the constraints in con as cuts to the invoking IloCplex object.Everything said for addCut applies equally to each of the cuts given in array con.public FilterIndex addDiversityFilter(IloNum lower_cutoff,IloNum upper_cutoff,const IloIntVarArray vars,const IloNumArray weights,const IloNumArray refval,const char * fname=0)Creates and installs a named diversity filter for the designated integer variables with thespecified lower and upper cutoff values, reference values, and weights.public FilterIndex addDiversityFilter(IloNum lower_cutoff,IloNum upper_cutoff,const IloNumVarArray vars,const IloNumArray weights,const IloNumArray refval,const char * fname=0)Creates and installs a named diversity filter for the designated numeric variables withthe specified lower and upper cutoff values, reference values, and weights.public IloConstraint addLazyConstraint(IloConstraint con)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 521


IloCplexNote:This is an advanced method. Advanced methods typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other methods instead.This method adds con as a lazy constraint to the invoking IloCplex object. Theconstraint con is copied into the lazy constraint pool; the con itself is not part of thepool, so changes to con after it has been copied into the lazy constraint pool will notaffect the lazy constraint pool.Lazy constraints added with addLazyConstraint are typically constraints of themodel that are not expected to be violated when left out. The idea behind this is that theLPs that are solved when solving the MIP can be kept smaller when these constraints arenot included. IloCplex will, however, include a lazy constraint in the LP as soon as itbecomes violated. In other words, the solution computed by IloCplex makes sure thatall the lazy constraints that have been added are satisfied.By contrast, if the constraint does not change the feasible region of the extracted modelbut only strengthens the formulation, it is referred to as a user cut. While user cuts canbe added to IloCplex with addLazyConstraint, it is generally preferable to doso with addUserCuts. It is an error, however, to add lazy constraints by means of themethod addUserCuts.When columns are deleted from the extracted model, all lazy constraints are deleted aswell and need to be recopied into the lazy constraint pool. Use of this method in place ofaddCuts allows for further presolve reductionsThis method is equivalent to addCut.public const IloConstraintArray addLazyConstraints(constIloConstraintArray con)Note:This is an advanced method. Advanced methods typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other methods instead.This method adds a set of lazy constraints to the invoking IloCplex object.Everything said for addLazyConstraint applies to each of the lazy constraintsgiven in array con.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 522


IloCplexThis method is equivalent to addCuts.public FilterIndex addRangeFilter(IloNum,IloNum,const IloIntVarArray,const IloNumArray,const char *=0)Creates a named range filter, using the specified lower cutoff, upper cutoff, integervariables, and weights, adds the filter to the solution pool of the invoking model, andreturns the index of the filter.public FilterIndex addRangeFilter(IloNum,IloNum,const IloNumVarArray,const IloNumArray,const char *=0)Creates a named range filter, using the specified lower cutoff, upper cutoff, numericvariables, and weights, adds the filter to the solution pool of the invoking model, andreturns its index.public IloConstraint addUserCut(IloConstraint con)Note:This is an advanced method. Advanced methods typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other methods instead.This method adds con as a user cut to the invoking IloCplex object. The constraintcon is copied into the user cut pool; the con itself is not part of the pool, so changesto con after it has been copied into the user cut pool will not affect the user cut pool.Cuts added with addUserCut must be real cuts, in that the solution of a MIP does notdepend on whether the cuts are added or not. Instead, they are there only to strengthenthe formulation.When columns are deleted from the extracted model, all user cuts are deleted as welland need to be recopied into the user cut pool.Note: It is an error to use addUserCut for lazy constraints, that is, constraintswhose absence may potentially change the solution of the problem. UseaddLazyConstraints or, equivalently, addCut when you add such aconstraint.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 523


IloCplexpublic const IloConstraintArray addUserCuts(const IloConstraintArray con)Note:This is an advanced method. Advanced methods typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other methods instead.This method adds a set of user cuts to the invoking IloCplex object. Everything saidfor addUserCut applies to each of the user cuts given in array con.public static IloCplex::Goal Apply(IloCplex cplex,IloCplex::Goal goal,IloCplex::NodeEvaluator eval)This method is used to create and return a goal that applies the node selection strategydefined by eval to the search strategy defined by goal. The resulting goal will use thenode strategy defined by eval for the subtree generated by goal.public void basicPresolve(const IloNumVarArray vars,IloNumArray redlb=0,IloNumArray redub=0,const IloRangeArray rngs=0,IloBoolArray redundant=0) constThis method can be used to compute tighter bounds for the variables of a model and todetect redundant constraints in the model extracted to the invoking IloCplex object.For every variable specified in parameter vars, it will return possibly tightened boundsin the corresponding elements of arrays redlb and redub. Similarly, for everyconstraint specified in parameter rngs, this method will return a Boolean valuereporting whether or not it is redundant in the model in the corresponding element ofarray redundant.public void clearCuts()This method deletes all cuts that have previously been added to the invokingIloCplex object with the methods addCut and addCuts.public void clearLazyConstraints()Note:This is an advanced method. Advanced methods typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other methods instead.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 524


IloCplexThis method deletes all lazy constraints added to the invoking IloCplex object withthe methods addLazyConstraint and addLazyConstraints.This method is equivalent to clearCuts.public void clearModel()This method can be used to unextract the model that is currently extracted to theinvoking IloCplex object.public void clearUserCuts()Note:This is an advanced method. Advanced methods typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other methods instead.This method deletes all user cuts that have previously been added to the invokingIloCplex object with the methods addUserCut and addUserCuts.public void delDirection(IloNumVar var)This method removes any existing branching direction assignment from variable var.public void delDirections(const IloNumVarArray var)This method removes any existing branching direction assignments from all variables inthe array var.public void delFilter(FilterIndex filter)Deletes the speficied filter from the solution pool.public void delPriorities(const IloNumVarArray var)This method removes any existing priority order assignments from all variables in thearray var.public void delPriority(IloNumVar var)This method removes any existing priority order assignment from variable var.public void delSolnPoolSoln(IloInt which)Deletes the specified solution from the solution pool and renumbers the indices of theremaining solutions in the pool.public void delSolnPoolSolns(IloInt begin,IloInt end)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 525


IloCplexDeletes a range of solutions from the solution pool and renumbers the indices of theremaining solutions in the pool.public IloNum dualFarkas(IloConstraintArray rng,IloNumArray y)Note: This is an advanced method. Advanced methods typically demand aprofound understanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incura higher risk of incorrect behavior in your application, behavior that can be difficultto debug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other methods instead.This method returns a Farkas proof of infeasibility for the active LP model after it hasbeen proven to be infeasible by one of the simplex optimizers. For every constraint i ofthe active LP this method computes a value y[i] such that y'A >= y'b, where Adenotes the constraint matrix. For more detailed information about the Farkas proof ofinfeasibility, see the C routine CPXdualfarkas, documented in the reference manualof the Callable Library.Parameters :Returns :rngAn array of length getNrows where constraints corresponding to the values in y arereturned.yAn array of length getNrows.The value of y'b - y'A z for the vector z defined such that z[j] = ub[j] ify'A[j] > 0 and z[j] = lb[j] if y'A[j] < 0 for all variables j.public void exportModel(const char * filename) constThis method writes the active model (that is, the model that has been extracted by theinvoking algorithm) to the file filename. The file format is determined by theextension of the file name. The following extensions are recognized on most platforms:◆◆◆◆◆◆.sav.mps.lp.sav.gz (if gzip is properly installed).mps.gz (if gzip is properly installed).lp.gz (if gzip is properly installed)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 526


IloCplexMicrosoft Windows does not support gzipped files for this <strong>API</strong>.If no name has been assigned to a variable or range (that is, the method getNamereturns null for that variable or range), IloCplex uses a default name when writingthe model to the file (or to the optimization log). Default names are of the form IloXjfor variables and IloCi, where i and j are internal indices of IloCplex.See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> File Formats for more detail and the <strong>ILOG</strong><strong>CPLEX</strong> User's <strong>Manual</strong> for additional information about file formats.public IloBool feasOpt(const IloConstraintArray cts,const IloNumArray prefs)The method feasOpt computes a minimal relaxation of constraints in the activemodel in order to make the model feasible. On successful completion, the methodinstalls a solution vector that is feasible for the minimum-cost relaxation. This solutioncan be queried with query methods, such as getValues or getInfeasibility.The method feasOpt provides several different metrics for determining whatconstitutes a minimum relaxation. The metric is specified by the parameterFeasOptMode. The method feasOpt can also optionally perform a secondoptimization phase where the original objective is optimized, subject to the constraintthat the associated relaxation metric must not exceed the relaxation value computed inthe first phase.The user may specify values (known as preferences) to express relative preferences forrelaxing constraints. A larger preference specifies a greater willingness to relax thecorresponding constraint. Internally, feasOpt uses the reciprocal of the preference toweight the relaxations of the associated bounds in the phase one cost function. Anegative or 0 (zero) value as a preference specifies that the corresponding constraintmust not be relaxed. If a preference is specified for a ranged constraint, that preferenceis used for both, its upper and lower bound. The preference for relaxing constraintcts[i] should be provided in prefs[i].The array cts need not contain all constraints in the model. Only constraints directlyadded to the model can be specified. If a constraint is not present, it will not be relaxed.IloAnd can be used to group constraints to be treated as one. Thus, according to thevarious Inf relaxation penalty metrics, all constraints in a group can be relaxed for apenalty of one unit. Similarly, according to the various Quad metrics, the penalty forrelaxing a group grows as the square of the sum of the individual member relaxations,rather than as the sum of the squares of the individual relaxations.If enough variables or constraints were allowed to be relaxed, the function will returnIloTrue; otherwise, it returns IloFalse.The active model is not changed by this method.See AlsoIloCplex::Relaxation<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 527


IloCplexpublic IloBool feasOpt(const IloRangeArray rngs,const IloNumArray rnglb,const IloNumArray rngub)Attempts to find a minimum feasible relaxation of the active model by relaxing thebounds of the constraints specified in rngs. Preferences are specified in rnglb andrngub on input.The method returns IloTrue if it finds a feasible relaxation.public IloBool feasOpt(const IloNumVarArray vars,const IloNumArray varlb,const IloNumArray varub)Attempts to find a minimum feasible relaxation of the active model by relaxing thebounds of the variables specified in vars as specified in varlb and varub.The method returns IloTrue if it finds a feasible relaxation.public IloBool feasOpt(const IloRangeArray rngs,const IloNumArray rnglb,const IloNumArray rngub,const IloNumVarArray vars,const IloNumArray varlb,const IloNumArray varub)The method feasOpt computes a minimal relaxation of the range and variable boundsof the active model in order to make the model feasible. On successful completion, themethod installs a solution vector that is feasible for the minimum-cost relaxation. Thissolution can be queried with query methods, such as getValues orgetInfeasibility orThe method feasOpt provides several different metrics for determining whatconstitutes a minimum relaxation. The metric is specified by the parameterFeasOptMode. The method feasOpt can also optionally perform a secondoptimization phase where the original objective is optimized, subject to the constraintthat the associated relaxation metric must not exceed the relaxation value computed inthe first phase.The user may specify values (known as preferences) to express relative preferences forrelaxing bounds. A larger preference specifies a greater willingness to relax thecorresponding bound. Internally, feasOpt uses the reciprocal of the preference toweight the relaxations of the associated bounds in the phase one cost function. Anegative or 0 (zero) value as a preference specifies that the corresponding bound mustnot be relaxed. The preference for relaxing the lower bound of constraint rngs[i]should be provided in rnglb[i]; and likewise the preference for relaxing the upperbound of constraint rngs[i] in rngub[i]. Similarly, the preference for relaxingthe lower bound of variable vars[i] should be provided in varlb[i], and thepreference for relaxing its upper bound in varub[i].<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 528


IloCplexArrays rngs and vars need not contain all ranges and variables in the model. If arange or variable is not present, its bounds are not relaxed. Only constraints directlyadded to the model can be specified.If enough variables or constraints were allowed to be relaxed, the function will returnIloTrue; otherwise, it returns IloFalse.The active model is not changed by this method.See AlsoIloCplex::Relaxationpublic void freePresolve()This method frees the presolved problem. Under the default setting of parameterReduce, the presolved problem is freed when an optimal solution is found; however, itis not freed if Reduce has been set to 1 (primal reductions) or to 2 (dual reductions). Inthese instances, the function freePresolve can be used when necessary to free itmanually.public IloCplex::Aborter getAborter()Returns a handle to the aborter being used by the invoking IloCplex object.public IloCplex::Algorithm getAlgorithm() constThis method returns the algorithm type that was used to solve the most recent model incases where it was not a MIP.public void getAX(IloNumArray val,const IloRangeArray con) constComputes A times X, where A is the corresponding LP constraint matrix.For the constraints in con, this method places the values of the expressions, or,equivalently, the activity levels of the constraints for the current solution of the invokingIloCplex object into the array val. Array val is resized to the same size as arraycon, and val[i] will contain the slack value for constraint con[i]. All ranges incon must be part of the extracted model.public IloNum getAX(const IloRange range) constComputes A times X, where A is the corresponding LP constraint matrix.This method returns the value of the expression of the constraint range, or,equivalently, its activity level, for the current solution of the invoking IloCplexobject. The range must be part of the extracted model.public IloCplex::BasisStatus getBasisStatus(const IloConstraint con) constThis method returns the basis status of the implicit slack or artificial variable created forthe constraint con.public IloCplex::BasisStatus getBasisStatus(const IloIntVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 529


IloCplexThis method returns the basis status for the variable var.public IloCplex::BasisStatus getBasisStatus(const IloNumVar var) constThis method returns the basis status for the variable var.public void getBasisStatuses(IloCplex::BasisStatusArray cstat,const IloNumVarArray var,IloCplex::BasisStatusArray rstat,const IloConstraintArray con) constThis method puts the basis status of each variable in var into the corresponding elementof the array cstat, and it puts the status of each row in con (an array of ranges orconstraints) into the corresponding element of the array rstat. Arrays rstat andcstat are resized accordingly.public void getBasisStatuses(IloCplex::BasisStatusArray stat,const IloConstraintArray con) constThis method puts the basis status of each constraint in con into the correspondingelement of the array stat. Array stat is resized accordingly.public void getBasisStatuses(IloCplex::BasisStatusArray stat,const IloNumVarArray var) constThis method puts the basis status of each variable in var into the corresponding elementof the array stat. Array stat is resized accordingly.public IloNum getBestObjValue() constThis method returns a bound on the optimal solution value of the problem. When amodel has been solved to optimality, this value matches the optimal solution value. If aMIP optimization is terminated before optimality has been proven, this value iscomputed for a minimization (maximization) problem as the minimum (maximum)objective function value of all remaining unexplored nodes.public void getBoundSA(IloNumArray lblower,IloNumArray lbupper,IloNumArray ublower,IloNumArray ubupper,const IloNumVarArray vars) constFor the given set of variables vars, bound sensitivity information is computed. Whenthe method returns, the element lblower[j] and lbupper[j] will contain thelowest and highest value the lower bound of variable vars[j] can assume withoutaffecting the optimality of the solution. Likewise, ublower[j] and ubupper[j]will contain the lowest and highest value the upper bound of variable vars[j] canassume without affecting the optimality of the solution. The arrays lblower,lbupper, ublower, and ubupper will be resized to the size of array vars. Thevalue 0 (zero) can be passed for any of the return arrays if the information is not desired.public IloCplex::ConflictStatus getConflict(IloConstraint con) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 530


IloCplexReturns the conflict status for the constraint con.Possible return values are:IloCplex::ConflictMember the constraint has been proven to participate in theconflict.IloCplex::ConflictPossibleMember the constraint has not been proven notto participate in the conflict; in other words, it might participate, though it might not.The constraint con must be one that has previously been passed to refineConflictincluding IloAnd constraints.public IloCplex::ConflictStatusArray getConflict(IloConstraintArray cons)constReturns the conflict status for each of the constraints specified in cons.The element i is the conflict status for the constraint cons[i] and can take thefollowing values:IloCplex::ConflictMember the constraint has been proven to participate in theconflict.IloCplex::ConflictPossibleMember the constraint has not been proven notto participate in the conflict; in other words, it might participate, though it might not.The constraints passed in cons must be among the same ones that have previously beenpassed to refineConflict, including IloAnd constraints.public IloCplex::CplexStatus getCplexStatus() constThis method returns the <strong>ILOG</strong> <strong>CPLEX</strong> status of the invoking algorithm. For possible<strong>ILOG</strong> <strong>CPLEX</strong> values, see the enumeration type IloCplex::CplexStatus.See also the topic Interpreting Solution Quality in the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong> formore information about a status associated with infeasibility or unboundedness.public IloCplex::CplexStatus getCplexSubStatus() constThis method accesses the solution status of the last node problem that was solved in theevent of an error termination in the previous invocation of solve. The methodIloCplex::getCplexSubStatus returns 0 in the event of a normal termination.If the invoking IloCplex object is continuous, this is equivalent to the status returnedby the method getCplexStatus.public IloNum getCutoff() constThis method returns the MIP cutoff value being used during the MIP optimization. In aminimization problem, all nodes are pruned that have an optimal solution value of thecontinuous relaxation that is larger than the current cutoff value. The cutoff is updatedwith the incumbent. If the invoking IloCplex object is an LP or QP,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 531


IloCplex+IloInfinity or -IloInfinity is returned, depending on the optimizationsense.public IloBool getDefault(IloCplex::BoolParam parameter) constThese method return the default setting for the parameter parameter.public IloCplex::DeleteMode getDeleteMode() constThis method returns the current delete mode of the invoking IloCplex object.public IloCplex::BranchDirection getDirection(IloNumVar var) constThis method returns the branch direction previously assigned to variable var withmethod setDirection or setDirections. If no direction has been assigned,IloCplex::BranchGlobal will be returned.public void getDirections(IloCplex::BranchDirectionArray dir,const IloNumVarArray var) constThis method returns the branch directions previously assigned to variables listed in varwith the method setDirection or setDirections. When the function returns,dir[i] will contain the branch direction assigned for variables var[i]. If no branchdirection has been assigned to var[i], dir[i] will be set toIloCplex::BranchGlobal.public IloExtractable getDiverging() constThis method returns the diverging variable or constraint, in a case where the primalSimplex algorithm has determined the problem to be infeasible. The returned extractableis either an IloNumVar or an IloConstraint object extracted to the invokingIloCplex optimizer; it is of type IloNumVar if the diverging column corresponds toa variable, or of type IloConstraint if the diverging column corresponds to theslack variable of a constraint.public IloNum getDiversityFilterLowerCutoff(FilterIndex filter) constGiven the index of a diversity filter associated with the solution pool, this method returnsthe lower cutoff value of that filter.public void getDiversityFilterRefVals(FilterIndex filter,IloNumArray) constAccesses the reference values declared in a diversity filter specified by its index in thesolution pool.public IloNum getDiversityFilterUpperCutoff(FilterIndex filter) constGiven the index of a diversity filter associated with the solution pool, this method returnsthe lower cutoff value of that filter.public void getDiversityFilterWeights(FilterIndex filter,IloNumArray) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 532


IloCplexAccesses the weights declared in a diversity filter specified by its index in the solutionpool.public IloNum getDual(const IloRange range) constThis method returns the dual value associated with the constraint range in the currentsolution of the invoking algorithm.public void getDuals(IloNumArray val,const IloRangeArray con) constThis method puts the dual values associated with the ranges in the array con into thearray val. Array val is resized to the same size as array con, and val[i] willcontain the dual value for constraint con[i].public FilterIndex getFilterIndex(const char * lname_str) constAccesses the index of a filter specified by its name.public FilterType getFilterType(FilterIndex filter) constGiven the index of a filter associated with the solution pool, this method returns the typeof that filter.public void getFilterVars(FilterIndex filter,IloNumVarArray) constAccesses the variables of a diversity filter specified by its index.public IloInt getIncumbentNode() constThis method returns the node number where the current incumbent was found. If theinvoking IloCplex object is an LP or a QP, 0 (zero) is returned.public IloNum getInfeasibilities(IloNumArray infeas,const IloIntVarArray var) constThis method puts the infeasibility values of the integer variables in array var for thecurrent solution into the array infeas. The infeasibility value is 0 (zero) if the variablebounds are satisfied. If the infeasibility value is negative, it specifies the amount bywhich the lower bound of the variable must be changed; if the value is positive, itspecifies the amount by which the upper bound of the variable must be changed. Thismethod does not check for integer infeasibility. The array infeas is automaticallyresized to the same length as array var, and infeas[i] will contain the infeasibilityvalue for variable var[i]. This method returns the maximum absolute infeasibilityvalue over all integer variables in var.public IloNum getInfeasibilities(IloNumArray infeas,const IloNumVarArray var) constThis method puts the infeasibility values of the numeric variables in array var for thecurrent solution into the array infeas. The infeasibility value is 0 (zero) if the variablebounds are satisfied. If the infeasibility value is negative, it specifies the amount bywhich the lower bound of the variable must be changed; if the value is positive, it<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 533


IloCplexspecifies the amount by which the upper bound of the variable must be changed. Thearray infeas is automatically resized to the same length as array var, andinfeas[i] will contain the infeasibility value for variable var[i]. This methodreturns the maximum absolute infeasibility value over all numeric variables in var.public IloNum getInfeasibilities(IloNumArray infeas,const IloConstraintArray con) constThis method puts the infeasibility values of the current solution for the constraintsspecified by the array con into the array infeas. The infeasibility value is 0 (zero) ifthe constraint is satisfied. More specifically, for a range with finite lower bound andupper bound, if the infeasibility value is negative, it specifies the amount by which thelower bound of the range must be changed; if the value is positive, it specifies theamount by which the upper bound of the range must be changed. For a more generalconstraint such as IloOr, IloAnd, IloSOS1, or IloSOS2, the infeasibility valuereturned is the maximal absolute infeasibility value over all range constraints andvariables created by the extraction of the queried constraint. Array infeas is resized tothe same size as array range, and infeas[i] will contain the infeasibility value forconstraint range[i]. This method returns the maximum absolute infeasibility valueover all constraints in con.public IloNum getInfeasibility(const IloIntVar var) constThis method returns the infeasibility of the integer variable var in the current solution.The infeasibility value returned is 0 (zero) if the variable bounds are satisfied. If theinfeasibility value is negative, it specifies the amount by which the lower bound of thevariable must be changed; if the value is positive, it specifies the amount by which theupper bound of the variable must be changed. This method does not check for integerinfeasibility.public IloNum getInfeasibility(const IloNumVar var) constThis method returns the infeasibility of the numeric variable var in the current solution.The infeasibility value returned is 0 (zero) if the variable bounds are satisfied. If theinfeasibility value is negative, it specifies the amount by which the lower bound of thevariable must be changed; if the value is positive, it specifies the amount by which theupper bound of the variable must be changed.public IloNum getInfeasibility(const IloConstraint con) constThis method returns the infeasibility of the current solution for the constraint code. Theinfeasibility value is 0 (zero) if the constraint is satisfied. More specifically, for a rangewith finite lower bound and upper bound, if the infeasibility value is negative, it specifiesthe amount by which the lower bound of the range must be changed; if the value ispositive, it specifies the amount by which the upper bound of the range must bechanged. For a more general constraint such as IloOr, IloAnd, IloSOS1, orIloSOS2, the infeasibility value returned is the maximal absolute infeasibility value<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 534


IloCplexover all range constraints and variables created by the extraction of the queriedconstraint.public IloInt getMax(IloCplex::IntParam parameter) constThese method return the maximum allowed value for the parameter parameter.public IloInt getMin(IloCplex::IntParam parameter) constThese method return the minimum allowed value for the parameter parameter.public IloInt getNbarrierIterations() constThis method returns the number of barrier iterations from the last solve.public IloInt getNbinVars() constThis method returns the number of binary variables in the matrix representation of theactive model in the invoking IloCplex object.public IloInt getNcols() constThis method returns the number of columns extracted for the invoking algorithm. Theremay be differences in the number returned by this function and the number of object oftype IloNumVar and its subclasses in the model that is extracted. This is becauseautomatic transformation of nonlinear constraints and expressions may introduce newvariables.public IloInt getNcrossDExch() constThis method returns the number of dual exchange operations in the crossover of the lastcall to method solve or solveFixed, if barrier with crossover has been used forsolving an LP or QP.public IloInt getNcrossDPush() constThis method returns the number of dual push operations in the crossover of the last callto solve or solveFixed, if barrier with crossover was used for solving an LP orQP.public IloInt getNcrossPExch() constThis method returns the number of primal exchange operations in the crossover of thelast call of method solve or solveFixed, if barrier with crossover was used forsolving an LP of QP.public IloInt getNcrossPPush() constThis method returns the number of primal push operations in the crossover of the lastcall of method solve or solveFixed, if barrier with crossover was used for solvingan LP or QP.public IloInt getNcuts(IloCplex::CutType which) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 535


IloCplexThis method returns the number of cuts of the specified type in use at the end of theprevious mixed integer optimization. If the invoking IloCplex object is not a MIP, itreturns 0.public IloInt getNdualSuperbasics() constThis method returns the number of dual superbasic variables in the current solution ofthe invoking IloCplex object.public IloInt getNfilters() constReturns the number of filters currently associated with the solution pool.public IloInt getNintVars() constThis method returns the number of integer variables in the matrix representation of theactive model in the invoking IloCplex object.public IloInt getNiterations() constThis method returns the number of iterations that occurred during the last call to themethod solve in the invoking algorithm.public IloInt getNnodes() constThis method returns the number of branch-and-cut nodes that were processed in thecurrent solution. If the invoking IloCplex object is not a MIP, it returns 0.public IloInt getNnodesLeft() constThis method returns the number of branch-and-cut nodes that remain to be processed inthe current solution. If the invoking IloCplex object is not a MIP, it returns 0.public IloInt getNNZs() constThis method returns the number of nonzeros extracted to the constraint matrix A of theinvoking algorithm.public IloInt getNphaseOneIterations() constIf a simplex method was used for solving continuous model, this method returns thenumber of iterations in phase 1 of the last call to solve or solveFixed.public IloInt getNprimalSuperbasics() constThis method returns the number of primal superbasic variables in the current solution ofthe invoking IloCplex object.public IloInt getNQCs() constThis method returns the number of quadratic constraints extracted from the active modelfor the invoking algorithm. This number may be different from the total number ofconstraints in the active model because linear constraints are not accounted for in thisfunction.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 536


IloCplexSee AlsogetNrowspublic IloInt getNrows() constThis method returns the number of rows extracted for the invoking algorithm. Theremay be differences in the number returned by this function and the number ofIloRanges and IloConstraints in the model that is extracted. This is becausequadratic constraints are not accounted for by method getNrows and automatictransformation of nonlinear constraints and expressions may introduce new constraints.See AlsogetNQCspublic IloInt getNsemiContVars() constThis method returns the number of semi-continuous variables in the matrixrepresentation of the active model in the invoking IloCplex object.public IloInt getNsemiIntVars() constThis method returns the number of semi-integer variables in the matrix representation ofthe active model in the invoking IloCplex object.public IloInt getNsiftingIterations() constThis method returns the number of sifting iterations performed for solving the last LPwith algorithm type IloCplex::Sifting, or, equivalently, the number of work LPsthat have been solved for it.public IloInt getNsiftingPhaseOneIterations() constThis method returns the number of sifting iterations performed for solving the last LPwith algorithm type IloCplex::Sifting in order to achieve primal feasibility.public IloInt getNSOSs() constThis method returns the number of SOSs extracted for the invoking algorithm. Theremay be differences in the number returned by this function and the number of numericvariables (that is, instances of the class IloNumVar, and so forth) in the model that isextracted because piecewise linear functions are extracted as a set of SOSs.public IloObjective getObjective() constThis method returns the instance of IloObjective that has been extracted to theinvoking instance of IloCplex. If no objective has been extracted, an empty handle isreturned.If you need only the current value of the objective, for example to use in a callback,consider one of these methods instead:◆◆◆ContinuousCallbackI::getObjValueControlCallbackI::getObjValueGoalI::getObjValue<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 537


IloCplex◆◆◆◆IncumbentCallbackI::getObjValueNetworkCallbackI::getObjValueNodeCallbackI::getObjValueNodeEvaluatorI::getObjValueReturns : The parameter set.public void getObjSA(IloNumArray lower,IloNumArray upper,const IloNumVarArray vars) constThis method performs objecitve sensitivity analysis for the variables specified in arrayvars. When this method returns lower[i] and upper[i] will contain the lowestand highest value the objective function coefficient for variable vars[i] can assumewithout affecting the optimality of the solution. The arrays lower and upper will beresized to the size of array vars. If any of the information is not requested, 0 (zero) canbe passed for the corresponding array parameter.public IloNum getObjValue(IloInt soln) constThis member function returns the numeric value of the objective function for thesolution pool member indexed by soln. The soln argument may be omitted or givena value of -1 in order to access the current solution.public IloBool getParam(IloCplex::BoolParam parameter) constThis method returns the current setting of parameter in the invoking algorithm.See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameters and the <strong>ILOG</strong> <strong>CPLEX</strong> User's<strong>Manual</strong> for more information about these parameters. Also see the user's manual forexamples of their use.public IloCplex::ParameterSet getParameterSet()Returns a parameter set corresponding to the present parameter state.If the method fails, an exception of type IloException, or one of its derivedclasses, is thrown.public void getPriorities(IloNumArray pri,const IloNumVarArray var) constThis method returns query branch priorities previously assigned to variables listed invar with the method setPriority or setPriorities. When the functionreturns, pri[i] will contain the priority value assigned for variables var[i]. If nopriority has been assigned to var[i], pri[i] will contain 0 (zero).public IloNum getPriority(IloNumVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 538


IloCplexThis method returns the priority previously assigned to the variable var with themethod setPriority or setPriorities. It returns 0 (zero) if no priority hasbeen assigned.public IloNum getQuality(IloCplex::Quality q,IloInt soln,IloConstraint * rng,IloNumVar * var=0) constThese methods return the requested quality measure for a member of the solution pool.The soln argument may be given a value of -1 to return the quality meausre for thecurrent solution.Some quality measures are related to a variable or a constraint. For example,IloCplex::MaxPrimalInfeas is related to the variable or constraint where themaximum infeasibility (bound violation) occurs. If this information is also requested,pointers to instances of IloNumVar or IloConstraint may be passed as optionalarguments specifying where the relevant variable or range will be written. However, ifthe constraint has been implicitly created (for example, because of automaticlinearization), a null handle will be returned for these arguments.public IloNum getQuality(IloCplex::Quality q,IloNumVar * var=0,IloConstraint * rng=0) constThese methods return the requested quality measure.Some quality measures are related to a variable or a constraint. For example,IloCplex::MaxPrimalInfeas is related to the variable or constraint where themaximum infeasibility (bound violation) occurs. If this information is also requested,pointers to instances of IloNumVar or IloConstraint may be passed as optionalarguments specifying where the relevant variable or range will be written. However, ifthe constraint has been implicitly created (for example, because of automaticlinearization), a null handle will be returned for these arguments.public void getRangeFilterCoefs(FilterIndex filter,IloNumArray) constAccesses the coefficients (that is, the weights) declared in the range filter specified by itsindex.public IloNum getRangeFilterLowerBound(FilterIndex filter) constGiven the index of a range filter associated with the solution pool, this method returnsthe lower bound of that filter.public IloNum getRangeFilterUpperBound(FilterIndex filter) constGiven the index of a range filter associated with the solution pool, this method returnsthe upper bound of that filter.public void getRangeSA(IloNumArray lblower,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 539


IloCplexIloNumArray lbupper,IloNumArray ublower,IloNumArray ubupper,const IloRangeArray con) constThis method performs sensistivity analysis for the upper and lower bounds of theranged constraints passed in the array con. When the method returns, lblower[i]and lbupper[i] will contain, respecitively, the lowest and the highest value that thelower bound of constraint con[i] can assume without affecting the optimality of thesolution. Similarly, ublower[i] and ubupper[i] will contain, respectively, thelowest and the highest value that the upper bound of the constraint con[i] can assumewithout affecting the optimality of the solution. The arrays lblower, lbupper,ublower, and ubupper will be resized to the size of array con. If any of theinformation is not requested, 0 can be passed for the corresponding array parameter.public void getRay(IloNumArray vals,IloNumVarArray vars) constThis method returns an unbounded direction (also known as a ray) corresponding to thepresent basis for an LP that has been determined to be an unbounded problem. <strong>CPLEX</strong>puts the the variables of the extracted model into the array vars and it puts thecorresponding values of the unbounded direction into the array vals.Note:<strong>CPLEX</strong> resizes these arrays for you.public IloNum getReducedCost(const IloIntVar var) constThis method returns the reduced cost associated with var in the invoking algorithm.public IloNum getReducedCost(const IloNumVar var) constThis method returns the reduced cost associated with var in the invoking algorithm.public void getReducedCosts(IloNumArray val,const IloIntVarArray var) constThis method puts the reduced costs associated with the numeric variables of the arrayvar into the array val. The array val is automatically resized to the same length asarray var, and val[i] will contain the reduced cost for variable var[i].public void getReducedCosts(IloNumArray val,const IloNumVarArray var) constThis method puts the reduced costs associated with the variables in the array var intothe array val. Array val is resized to the same size as array var, and val[i] willcontain the reduced cost for variable var[i].public void getRHSSA(IloNumArray lower,IloNumArray upper,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 540


IloCplexconst IloRangeArray cons) constThis method performs righthand side sensitivity analysis for the constraints specified inarray cons. The constraints must be of the form cons[i]: expr[i] rel rhs[i].When this method returns lower[i] and upper[i] will contain the lowest andhighest value rhs[i] can assume without affecting the optimality of the solution. Thearrays lower and upper will be resized to the size of array cons. If any of theinformation is not requested, 0 (zero) can be passed for the corresponding arrayparameter.public IloNum getSlack(const IloRange range,IloInt soln=-1) constThis method returns the slack value associated with the constraint range for a solutionof the invoking algorithm. For a range with finite lower and upper bounds, the slackvalue consists of the difference between the expression of the range and its lowerbound. The current solution is used if the soln argument is omitted or given the value-1; otherwise, the solution pool member indexed by soln is used.public void getSlacks(IloNumArray val,const IloRangeArray con,IloInt soln=-1) constThis method puts the slack values associated with the constraints specified by the arraycon into the array val. For a ranged constraint with finite lower and upper bounds, theslack value consists of the difference between the expression in the range and its lowerbound. The current solution is used if the soln argument is omitted or given the value-1; otherwise, the solution pool member indexed by soln is used. Array val is resizedto the same size as array con, and val[i] will contain the slack value for constraintcon[i].public IloNum getSolnPoolMeanObjValue() constComputes the mean of the objective values of the solutions currently in the solutionpool.public IloInt getSolnPoolNreplaced() constAccesses the number of solutions that have been replaced according to the solution poolreplacement strategy.public IloInt getSolnPoolNsolns() constAccesses the number of solutions currently in the solution pool.public IloAlgorithm::Status getStatus() constThis method returns the status of the invoking algorithm.For its <strong>ILOG</strong> <strong>CPLEX</strong> status, see the method IloCplex::getCplexStatus.See also the topic Interpreting Solution Quality in the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong> formore information about a status associated with infeasibility or unboundedness.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 541


IloCplexpublic IloCplex::Algorithm getSubAlgorithm() constThis method returns the type of the algorithm type that was used to solve most recentnode of a MIP in the case of termination because of an error during mixed integeroptimization.public IloNum getValue(const IloObjective ob,IloInt soln) constThis method returns the value of the objective using the solution pool member indexedby soln. The soln argument may be omitted or given a value of -1 in order to accessthe current solution.public IloNum getValue(const IloNumExprArg expr,IloInt soln) constThis method returns the value of the expression using the solution pool member indexedby soln. The soln argument may be omitted or given a value of -1 in order to accessthe current solution.public IloNum getValue(const IloIntVar var,IloInt soln) constThis method returns the value from the solution pool member indexed by soln for theinteger variable specified by var. The soln argument may be omitted or given a valueof -1 in order to access the current solution.public IloNum getValue(const IloNumVar var,IloInt soln) constThis method returns the value from the solution pool member indexed by soln for thenumeric variable specified by var. The soln argument may be omitted or given avalue of -1 in order to access the current solution.public void getValues(const IloIntVarArray var,IloNumArray val,IloInt soln) constThis method puts the values from the solution pool member indexed by soln for theinteger variables specified by the array var into the array val. The soln argumentmay be omitted or given a value of -1 in order to access the current solution. Array valis resized to the same size as array var, and val[i] will contain the solution value forvariable var[i].public void getValues(IloNumArray val,const IloIntVarArray var,IloInt soln) constThis method puts the values from the solution pool member indexed by soln for thenumeric variables specified by the array var into the array val. The soln argumentmay be omitted or given a value of -1 in order to access the current solution. Array valis resized to the same size as array var, and val[i] will contain the solution value forvariable var[i].<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 542


IloCplexpublic void getValues(IloNumArray val,const IloNumVarArray var,IloInt soln) constThis method puts the values from the solution pool member indexed by soln for thenumeric variables specified by the array var into the array val. The soln argumentmay be omitted or given a value of -1 in order to access the current solution. Array valis resized to the same size as array var, and val[i] will contain the solution value forvariable var[i].public void getValues(const IloIntVarArray var,IloNumArray val) constThis method puts the solution values of the integer variables specified by the array varinto the array val. Array val is resized to the same size as array var, and val[i]will contain the solution value for variable var[i].public void getValues(IloNumArray val,const IloIntVarArray var) constThis method puts the solution values of the integer variables specified by the array varinto the array val. Array val is resized to the same size as array var, and val[i]will contain the solution value for variable var[i].public void getValues(const IloNumVarArray var,IloNumArray val) constThis member function accepts an array of variables vars and puts the correspondingvalues into the array vals; the corresponding values come from the current solution ofthe invoking algorithm. The array vals must be a clean, empty array when you pass itto this member function.If there are no values to return for vars, this member function raises an error. Onplatforms that support <strong>C++</strong> exceptions, when exceptions are enabled, this memberfunction throws the exception NotExtractedException in such a case.public void getValues(IloNumArray val,const IloNumVarArray var) constThis method puts the solution values of the numeric variables specified by the array varinto the array val. Array val is resized to the same size as array var, and val[i]will contain the solution value for variable var[i].public const char * getVersion() constThis method returns a string specifying the version of IloCplex.public void importModel(IloModel & m,const char * filename) constThis method reads a model from the file specified by filename into model. Typicallymodel will be an empty, unextracted model on entry to this method. The invokingIloCplex object is not affected when you call this method unless model is its<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 543


IloCplexextracted model; follow this method with a call to IloCplex::extract in order toextract the imported model to the invoking IloCplex object.When this methods reads a file, new modeling objects, as required by the input file, arecreated and added to any existing modeling objects in the model passed as anargument. Note that any previous modeling objects in model are not removed; precedethe call to importModel with explicit calls to IloModel::remove if you need toremove them.public void importModel(IloModel & m,const char * filename,IloObjective & obj,IloNumVarArray vars,IloRangeArray rngs,IloRangeArray lazy=0,IloRangeArray cuts=0) constThis method is a simplification of the method importModel that does not providearrays to return SOSs. This method is easier to use in the case where you are dealingwith continuous models because in such a case you already know that no SOS will bepresent.public void importModel(IloModel & model,const char * filename,IloObjective & obj,IloNumVarArray vars,IloRangeArray rngs,IloSOS1Array sos1,IloSOS2Array sos2,IloRangeArray lazy=0,IloRangeArray cuts=0) constThis method reads a model from the file specified by filename into model. Typicallymodel will be an empty, unextracted model on entry to this method. The invokingIloCplex object is not affected when you call this method unless model is itsextracted model; follow this method with a call to IloCplex::extract in order toextract the imported model to the invoking IloCplex object.When this methods reads a file, new modeling objects, as required by the input file, arecreated and added to any existing modeling objects in the model passed as anargument. Note that any previous modeling objects in model are not removed; precedethe call to importModel with explicit calls to IloModel::remove if you need toremove them.As this method reads a model from a file, it places the objective it has read in obj, thevariables it has read in the array vars, * the ranges it has read in the array rngs; andthe Special Ordered Sets (SOS) it has read in the arrays sos1 and sos2.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 544


IloCplexNote:<strong>CPLEX</strong> resizes these arrays for you to accomodate the returned objects.Note: This note is for advanced users only. The two arrays lazy and cuts arefilled with the lazy constraints and user cuts that may be included in the model inthe file filename.The format of the file is determined by the extension of the file name. The followingextensions are recognized on most platforms:◆◆◆◆◆.sav.mps.lp.sav.gz (if gzip is properly installed).mps.gz (if gzip is properly installed)◆ .lp.gz (if gzip is properly installed)Microsoft Windows does not support gzipped files for this <strong>API</strong>.public IloBool isDualFeasible() constThis method returns IloTrue if a dual feasible solution is recorded in the invokingIloCplex object and can be queried.public IloBool isMIP() constThis method returns IloTrue if the invoking algorithm has extracted a model that is aMIP (mixed-integer programming problem) and IloFalse otherwise. Memberfunctions for accessing duals and reduced cost basis work only if the model is not aMIP.public IloBool isPrimalFeasible() constThis method returns IloTrue if a primal feasible solution is recorded in the invokingIloCplex object and can be queried.public IloBool isQC() constThis method returns IloTrue if the invoking algorithm has extracted a model that isquadratically constrained. Otherwise, it returns IloFalse. For an explanation ofquadratically constrained see the topic QCP in the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong>.public IloBool isQO() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 545


IloCplexThis method returns IloTrue if the invoking algorithm has extracted a model that hasquadratic objective function terms. Otherwise, it returns IloFalse.public static IloCplex::Goal LimitSearch(IloCplex cplex,IloCplex::Goal goal,IloCplex::SearchLimit limit)This method creates and returns a goal that puts the search specified by goal under thelimit defined by limit. Only the subtree controlled by goal will be subjected to limitlimit.public IloBool populate()The method populate generates multiple solutions to a mixed integer programming(MIP) model. In other words, it populates the solution pool of the model currentlyextracted by the invoking IloCplex object. Like the method solve, this methodreturns IloTrue if it finds a solution (not necessarily an optimal solution).The algorithm that populates the solution pool works in two phases:In the first phase, it solves the model to optimality (or some stopping criterion set bythe user) while it sets up a branch and cut tree for the second phase.In the second phase, it generates multiple solutions by using the information computedand stored in the first phase and by continuing to explore the tree.The amount of preparation in the first phase and the intensity of exploration in thesecond phase are controlled by the solution pool intensity parameterSolnPoolIntensity.Optimality is not a stopping criterion for the populate method. Even if theoptimality gap is zero, this method will still try to find alternative solutions. Thestopping criteria for populate are these:◆◆◆◆Popoulate limit PopulateLim. This parameter controls how many solutions aregenerated before the method stops. Its default value is 20.Time limit TiLim, as in standard MIP optimization.Node limit NodeLim, as in standard MIP optimization.In the absence of other stopping criteria, populate stops when it cannot enumerateany more solutions. In particular, if the user specifies an objective tolerance with therelative or absolute solution pool gap parameters, populate stops if it cannotenumerate any more solutions within the specified objective tolerance. There mayexist additional solutions that satisfy the specified objective tolerance; depending onthe solution pool intensity parameter, populate may or may not enumerate all ofthem; according to certain settings of the solution pool intensity parameter,populate may stop when it has enumerated a subset of additional solutionssatisfying the specified objective tolerance.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 546


IloCplexSuccessive calls to populate create solutions that are stored in the solution pool.However, each call to populate applies only to the subset of solutions created in thecurrent call; the call does not affect the solutions already in the pool. In other words,solutions in the pool are persistent.The user may call this routine independently of any MIP optimization of a model. In thatcase, it carries out the first and second phase itself.The user may also call populate after standard MIP optimization. In the generalcase, the user reads the model, calls MIP optimization, then calls populate. Theactivity of MIP optimization constitutes the first phase of the populate algorithm;populate then re-uses the information computed and stored by MIP optimization andthus carries out only the second phase.The method populate does not try to generate multiple solutions for unbounded MIPmodels. As soon as the proof of unboundedness is obtained, populate stops.public void presolve(IloCplex::Algorithm alg)This method performs Presolve on the model. The enumeration alg tells Presolvewhich algorithm is intended to be used on the reduced model; NoAlg should bespecified for MIP models.public void protectVariables(const IloIntVarArray var)Note:This is an advanced method. Advanced methods typically demand aprofound understanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incura higher risk of incorrect behavior in your application, behavior that can be difficultto debug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other methods instead.This method specifies a set of integer variables that should not be substituted out of theproblem. If presolve can fix a variable to a value, it is removed, even if it is specified inthe protected list.public void protectVariables(const IloNumVarArray var)Note:This is an advanced method. Advanced methods typically demand aprofound understanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incura higher risk of incorrect behavior in your application, behavior that can be difficultto debug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other methods instead.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 547


IloCplexThis method specifies a set of numeric variables that should not be substituted out of theproblem. If presolve can fix a variable to a value, it is removed, even if it is specified inthe protected list.public void qpIndefCertificate(IloNumVarArray var,IloNumArray x)The quadratic objective terms in a QP model must form a positive semi-definite Qmatrix (negative semi-definite for maximization). If IloCplex finds that this is nottrue, it will discontinue the optimization. In such cases, the qpIndefCertificatemethod can be used to compute assignments (returned in array x) to all variables(returned in array var) such that the quadratic term of the objective function evaluatesto a negative value (x'Q x < 0 in matrix terms) to prove the indefiniteness.Note: <strong>CPLEX</strong> resizes these arrays for you.public void readBasis(const char * name) constReads a simplex basis from the BAS file specified by name, and copies that basis intothe invoking IloCplex object. The parameter AdvInd must be set to a nonzero value(e.g. its default setting) for the simplex basis to be used to start a subsequentoptimization with one of the Simplex algorithms.By convention, the file extension is .bas. The BAS file format is documented in thereference manual <strong>ILOG</strong> <strong>CPLEX</strong> File Formats.public FilterIndexArray readFilters(const char * name)Reads solution pool filters from a file in FLT format and copies the filters into aninstance of IloCplex. This format is documented in the reference manual <strong>ILOG</strong><strong>CPLEX</strong> File Formats.public void readMIPStart(const char * name) constReads the SOL file denoted by name and copies the MIP start information into theinvoking IloCplex object. The parameter AdvInd must be turned on (its default: 1(one)) in order for the MIP start information to be used to with a subsequent MIPoptimization.By convention, the file extension is .sol. The SOL file format is documented in the<strong>ILOG</strong> <strong>CPLEX</strong> File Formats <strong>Reference</strong> <strong>Manual</strong> and in the stylesheet solution.xsland schema solution.xsd in the include directory of the product. Examples ofits use appear in the examples distributed with the product and in the <strong>ILOG</strong> <strong>CPLEX</strong>User's <strong>Manual</strong>.public void readOrder(const char * filename) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 548


IloCplexThis method reads a priority order from a file in ORD format into the invokingIloCplex object. The names in the ORD file must match the names in the activemodel. The priority order will be associated with the model. The parameterMipOrdInd must be nonzero for the next invocation of the methodIloCplex::solve to take the order into account.By convention, the file extension is .ord. The ORD file format is documented in thereference manual <strong>ILOG</strong> <strong>CPLEX</strong> File Formats.public void readParam(const char * name) constReads parameters and their settings from the file specified by name and applies them tothe invoking IloCplex object. Parameters not listed in the parameter file will be resetto their default setting.By convention, the file extension is .prm. The PRM file format is documented in thereference manual <strong>ILOG</strong> <strong>CPLEX</strong> File Formats.public void readSolution(const char * name) constReads a solution from the SOL file denoted by name and copies this information into a<strong>CPLEX</strong> problem object. This routine is able to initiate a crossover from the barriersolution, to restart the simplex method with an advanced basis or to specify variablevalues for a MIP start. The parameter AdvInd must set to a nonzero value (such as itsdefault setting: 1 (one)) in order for the solution file to take effect with the methodsolve.By convention, the file extension is .sol. The SOL file format is documented in the<strong>ILOG</strong> <strong>CPLEX</strong> File Format <strong>Reference</strong> <strong>Manual</strong> and in the stylesheet solution.xsland schema solution.xsd in the include directory of the product. Examples ofits use appear in the examples distributed with the product and in the <strong>ILOG</strong> <strong>CPLEX</strong>User's <strong>Manual</strong>.public IloBool refineConflict(IloConstraintArray cons,IloNumArray prefs)The method refineConflict identifies a minimal conflict for the infeasibility of thecurrent model or for a subset of the constraints of the current model. Since the conflictis minimal, removal of any one of these constraints will remove that particular cause forinfeasibility. There may be other conflicts in the model; consequently, repair of a givenconflict does not guarantee feasibility of the remaining model.The constraints among which to look for a conflict are passed to this method through theargument cons. Only constraints directly added to the model can be specified.Constraints may also be grouped by IloAnd. If any constraint in a group participatesin the conflict, the entire group is determined to do so. No further detail about theconstraints within that group is returned.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 549


IloCplexGroups or constraints may be assigned preference. A group or constraint with a higherpreference is more likely to be included in the conflict. However, no guarantee is madewhen a minimal conflict is returned that other conflicts containing groups or constraintswith higher preference do not exist.When this method returns, the conflict can be queried with the methodsgetConflict. The method writeConflict can write a file in LP formatcontaining the conflict.Parameters :consAn array of constraints among which to look for a conflict. The constraints may be anyconstraint in the active model, or a group of constraints organized by IloAnd. If aconstraint does not appear in this array, the constraint is assigned a preference of 0(zero). Thus such constraints are included in the conflict without any analysis. Onlyconstraints directly added to the model can be specified.prefsAn array of integers containing the preferences for the groups or constraints. prefs[i]specifies the preference for group or constraint cons[i]. A negative value specifiesthat the corresponding group or constraint should not be considered in the computationof a conflict. In other words, such groups are not considered part of the model. Groupswith a preference of 0 (zero) are always considered to be part of the conflict. No furtherchecking is performed on such groups.Returns : Boolean value reporting whether or not a conflict has been found.public void remove(IloCplex::Aborter abort)This method removes the aborter object abort from the invoking IloCplex object.public void setBasisStatuses(const IloCplex::BasisStatusArray cstat,const IloNumVarArray var,const IloCplex::BasisStatusArray rstat,const IloConstraintArray con)This method uses the array cstats to set the basis status of the variables in the arrayvar; it uses the array rstats to set the basis status of the ranges in the array con.public void setDefaults()This method resets all <strong>CPLEX</strong> parameters to their default values.public void setDeleteMode(IloCplex::DeleteMode mode)This method sets the delete mode in the invoking IloCplex object to mode.public void setDirection(IloNumVar var,IloCplex::BranchDirection dir)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 550


IloCplexThis method sets the preferred branching direction for variable var to dir. This settingwill cause <strong>CPLEX</strong> first to explore the branch specified by dir after branching onvariable var.public void setDirections(const IloNumVarArray var,const IloCplex::BranchDirectionArray dir)This method sets the preferred branching direction for each variable in the array var tothe corresponding value in the array dir. This will cause <strong>CPLEX</strong> first to explore thebranch specified by dir[i] after branching on variable var[i].public void setParam(IloCplex::BoolParam parameter,IloBool value)This method sets parameter to value in the invoking algorithm. See the <strong>ILOG</strong><strong>CPLEX</strong> User's <strong>Manual</strong> for more detailed information about parameters and forexamples of their use.public void setParameterSet(IloCplex::ParameterSet set)Sets the parameter state using a parameter set.If the method fails, an exception of type IloException, or one of its derivedclasses, is thrown.Parameters :setThe parameter set.public void setPriorities(const IloNumVarArray var,const IloNumArray pri)This method sets the priority order for all variables in the array var to thecorresponding value in the array pri. During branching, integer variables with higherpriorities are given preference over integer variables with lower priorities. Further,variables that have priority assigned to them are given preference over variables that donot. Priorities must be nonnegative integers. By default, the priority of a variablewithout a user-assigned priority is 0 (zero). The parameter MIPOrdInd by defaultspecifies that user-assigned priority orders should be taken into account. WhenMIPOrdInd is reset to its nondefault value 0 (zero), <strong>CPLEX</strong> ignores user-assignedpriorities. To remove user-assigned priority from a variable, see the methoddelPriorities. For more detail about how priorities are applied, see the topicIssuing Priority Orders in the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong>.public void setPriority(IloNumVar var,IloNum pri)This method sets the priority order for the variable var to pri. During branching,integer variables with higher priorities are given preference over integer variables withlower priorities. Further, variables that have priority assigned to them are givenpreference over variables that do not. Priorities must be nonnegative integers. By<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 551


IloCplexdefault, the priority of a variable without a user-assigned priority is 0 (zero). Theparameter MIPOrdInd by default specifies that user-assigned priority orders should betaken into account. When MIPOrdInd is reset to its nondefault value 0 (zero), <strong>CPLEX</strong>ignores user-assigned priorities. To remove user-assigned priority from a variable, seethe method delPriority. For more detail about how priorities are applied, see thetopic Issuing Priority Orders in the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong>.public void setVectors(const IloNumArray x,const IloNumArray dj,const IloNumVarArray var,const IloNumArray slack,const IloNumArray pi,const IloRangeArray rng)This method allows a user to specify a starting point for the following invocation of themethod solve.For all variables in var, x[i] specifies the starting value for the variable var[i].Similarly, dj[i] specifies the starting reduced cost for variable var[i]. For allranged constraints specified in rng, slack[i] specifies the starting slack value forrng[i]. Similarly, pi[i] specifies the starting dual value for rng[i].Zero can be passed for any individual parameter. However, the arrays x and var mustbe the same length. Likewise, pi and rng must be the same length.In other words, you must provide starting values for either the primal or dual variablesx and pi. If you provide values for dj, then you must provide the corresponding valuesfor x. If you provide values for slack, then you must provide the correspondingvalues for pi.This information is exploited at the next call to solve, to construct a starting point forthe algorithm, provided that the AdvInd parameter is set to a value greater than orequal to one. In particular, if the extracted model is an LP, and the root algorithm is dualor primal, the information is used to construct a starting basis for the simplex method forthe original model, if AdvInd is set to 1 (one). If AdvInd is set to 2, the informationis used to construct a starting basis for the presolved model.If the extracted model is a MIP, only x values can be used. Values may be specified forany subset of the integer and continuous variables in the model, either through a singleinvocation of setVectors, or incrementally through multiple calls. Whenoptimization commences or resumes, <strong>CPLEX</strong> will attempt to find a feasible MIPsolution that is compatible with the set of specified x values. When start values are notprovided for all integer variables, <strong>CPLEX</strong> tries to extend the partial solution to acomplete solution by solving a MIP on the unspecified variables. The parameterSubMIPNodeLim controls the amount of effort <strong>CPLEX</strong> expends in trying to solve thissecondary MIP. If <strong>CPLEX</strong> finds a complete feasible solution, that solution becomes theincumbent. If the specified values are infeasible, they are retained for use in a<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 552


IloCplexsubsequent solution repair heuristic. The amount of effort spent in this heuristic can becontrolled by the parameter RepairTries.public IloBool solve(IloCplex::Goal goal)This method initializes the goal stack of the root node with goal before starting thebranch & cut search. The search tree will be defined by the execute method of goal andits subgoals. See the concept Goals and the nested class IloCplex::GoalI formore information.public IloBool solve()This method solves the model currently extracted to the invoking IloCplex object.The method returns IloTrue if it finds a solution (not necessarily an optimal one).public IloBool solveFixed(IloInt soln=-1)After the invoking algorithm has solved the extracted MIP model to a feasible (but notnecessarily optimal) solution as a MIP, this member function solves the relaxation of themodel obtained by fixing all the integer variables of the extracted MIP to the values of asolution. The current solution is used if the soln argument is omitted or given thevalue -1; otherwise, the solution pool member indexed by soln is used.public IloInt tuneParam(IloArray< const char *> filename,IloCplex::ParameterSet fixedset)The method tuneParam tunes the parameters of an instance of IloCplex forimproved optimizer performance on the current model, or a set of models if thefilename argument is used. Tuning is carried out by <strong>CPLEX</strong> making a number oftrial runs with a variety parameter settings. Parameters and associated values whichshould not be changed by the tuning process are specified in the parameter setfixedset.After tuneParam has finished, the IloCplex parameters will be set to the tuned andfixed settings which can be queried or written to a file. There will not be a solution tothe current model.The parameter TuningRepeat specifies how many problem variations for <strong>CPLEX</strong> totry while tuning when tuning the current model. Using a number of variations can givemore robust results when tuning is applied to a single model.Note that the tuning evaluation measure is meaningful only when TuningRepeat islarger than one or when a set of models is being tuned.A few of the parameter settings control the tuning process. They are specified in thetable below; other parameter settings are ignored.ParameterUse<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 553


IloCplexTiLimTuningTiLimTuningMeasureTuningRepeatTuningDisplayLimits the total time spent tuningLimits the time of each trial runControls the tuning evaluation measureSets the number of repeated problemvariationsControls the level of the tuning displayAll callbacks, except the tuning callback, will be ignored. Tuning will monitor themethod abort and terminate when an abort has been issued.Returns :IloInt value specifying the completion status of the tuning. The values returned arefrom the enumeration TuningStatus.public IloCplex::Callback use(IloCplex::Callback cb)This method instructs the invoking IloCplex object to use cb as a callback. If acallback of the same type as cb is already being used by the invoking IloCplexobject, the previously used callback will be overridden. If the callback object cb isalready being used by another IloCplex object, a copy of cb will be used instead. Ahandle to the callback that is installed in the invoking IloCplex object is returned. SeeIloCplex::CallbackI for a discussion of how to implement callbacks.public IloCplex::Aborter use(IloCplex::Aborter abort)This method instructs the invoking IloCplex object to use the aborter object abortto control termination of its solving and tuning methods. If an aborter is already beingused by the invoking IloCplex object, the previously used aborter will be overridden.A handle to the aborter that is installed in the invoking IloCplex object is returned.See AlsoIloCplex::Aborterpublic void writeBasis(const char * name) constWrites the current simplex basis to the file specified by name.By convention, the file extension is .bas. The BAS file format is documented in thereference manual <strong>ILOG</strong> <strong>CPLEX</strong> File Formats.public void writeConflict(const char * filename) constWrites a conflict file named filename.public void writeFilters(const char * name)Writes filters from the invoking model to a file in FLT format. This format isdocumented in the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> File Formats.public void writeMIPStart(const char * name,IloInt soln=-1) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 554


IloCplexWrites MIP start information to the file denoted by name. The MIP start writtencorresponds to the current solution if the soln parameter is omitted; otherwise, itcorresponds to the solution pool member indexed by soln.By convention, the file extension is .mst. The MST file format is documented in thereference manual <strong>ILOG</strong> <strong>CPLEX</strong> File Formats as well as the stylesheetsolution.xsl and schema solution.xsd found in the include directory ofthe product.public void writeMIPStarts(const char * name) constWrites MIP start information with all members of the solution pool to the file denotedby name.By convention, the file extension is .mst. The MST file format is documented in thereference manual <strong>ILOG</strong> <strong>CPLEX</strong> File Formats as well as the stylesheetsolution.xsl and schema solution.xsd found in the include directory ofthe product.public void writeOrder(const char * filename) constWrites a priority order to the file filename.If a priority order has been associated with the <strong>CPLEX</strong> problem object, or theparameter MipOrdType is nonzero, this method writes the priority order into thespecified file.By convention, the file extension is .ord. The ORD file format is documented in thereference manual <strong>ILOG</strong> <strong>CPLEX</strong> File Formats.public void writeParam(const char * name) constWrites the parameter name and its current setting into the file specified by name for allthe <strong>CPLEX</strong> parameters that are not currently set at their default.By convention, the file extension is .prm. The PRM file format is documented in thereference manual <strong>ILOG</strong> <strong>CPLEX</strong> File Formats.public void writeSolution(const char * name,IloInt soln=-1) constWrites a solution file for the current problem into the file specified by name. Thesolution written is the current solution if the soln parameter is omitted; otherwise, it isthe solution pool member indexed by soln.By convention, the file extension is .sol. The SOL file format is documented in thereference manual <strong>ILOG</strong> <strong>CPLEX</strong> File Formats as well as the stylesheetsolution.xsl and schema solution.xsd found in the include directory of theproduct.public void writeSolutions(const char * name) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 555


IloCplexWrites a solution file with all members of the solution pool for the current problem intothe file specified by name.By convention, the file extension is .sol. The SOL file format is documented in thereference manual <strong>ILOG</strong> <strong>CPLEX</strong> File Formats as well as the stylesheetsolution.xsl and schema solution.xsd found in the include directory of theproduct.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 556


IloCplex::AborterIloCplex::AborterCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicAborter(IloEnv env)Method Summarypublic voidpublic voidpublic voidpublic IloBoolabort()clear()end()isAborted() constDescriptionAn instance of this class gracefully terminates the solving and tuning methods ofIloCplex. You can pass an instance of this class to one or more IloCplex objects.Calling the method abort will then terminate the solve or tuning method of theIloCplex object.In particular, if you install an instance of this class in an instance of IloCplex, callthe method IloCplex::solve, and later call the methodIloCplex::Aborter::abort, then the solve will gracefully terminate, even ifthe methods are in separate threads. This convention makes it possible, for example, ina GUI application to terminate <strong>ILOG</strong> <strong>CPLEX</strong> when an end user presses a stop button.Constructorspublic Aborter(IloEnv env)Constructs an instance of the Aborter class. It requires an instance of the same IloEnvas the IloCplex object with which to use the aborter.Methodspublic void abort()<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 557


IloCplex::AborterAborts the solving and tuning methods.public void clear()Clears the aborter.public void end()Ends the aborter.public IloBool isAborted() constReturns IloTrue if abort has been called.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 558


IloCplex::AlgorithmIloCplex::AlgorithmCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hAlgorithm{NoAlg,AutoAlg,Primal,Dual,Barrier,Sifting,Concurrent,Network,FeasOpt,MIP};The enumeration IloCplex::Algorithm lists the algorithms available in <strong>CPLEX</strong>to solve continuous models as controlled by the parameters IloCplex::RootAlgand IloCplex::NodeAlg.These values are also returned by IloCplex::getAlgorithm to specify thealgorithm used to generate the current solution. The values FeasOpt and MIP arereturned by IloCplex::getAlgorithm but should not be used withIloCplex::RootAlg nor with IloCplex::NodeAlg.IloCplex, getAlgorithm, getSubAlgorithm, IloCplex::IntParam,RootAlg, NodeAlgNoAlg= CPX_ALG_NONEAutoAlg= CPX_ALG_AUTOMATICPrimal= CPX_ALG_PRIMALDual= CPX_ALG_DUALBarrier= CPX_ALG_BARRIERSifting<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 559


IloCplex::Algorithm= CPX_ALG_SIFTINGConcurrent= CPX_ALG_CONCURRENTNetwork= CPX_ALG_NETFeasOpt= CPX_ALG_FEASOPTMIP= CPX_ALG_MIP<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 560


IloCplex::BarrierCallbackIIloCplex::BarrierCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedBarrierCallbackI(IloEnv env)Method Summaryprotected IloNumgetDualObjValue() constInherited methods from IloCplex::ContinuousCallbackIContinuousCallbackI::getDualInfeasibility,ContinuousCallbackI::getInfeasibility,ContinuousCallbackI::getNiterations, ContinuousCallbackI::getObjValue,ContinuousCallbackI::isDualFeasible, ContinuousCallbackI::isFeasibleInherited methods fromIloCplex::OptimizationCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 561


IloCplex::BarrierCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoConstructorsMethodsAn instance of the class IloCplex::BarrierCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a problem bymeans of the barrier optimizer. IloCplex calls the user-written callback after eachiteration during optimization with the barrier method. If an attempt is made to accessinformation not available to an instance of this class, an exception is thrown.The constructor and methods of this class are for use in deriving a user-written callbackclass and in implementing the main method there.For more information about the barrier optimizer, see the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong>.ILOBARRIERCALLBACK0, IloCplex, IloCplex::Callback,IloCplex::CallbackI, IloCplex::ContinuousCallbackI,IloCplex::OptimizationCallbackIprotected BarrierCallbackI(IloEnv env)This constructor creates a callback for use in an application of the barrier optimizer.protected IloNum getDualObjValue() constThis method returns the current dual objective value of the solution in the instance ofIloCplex at the time the invoking callback is executed.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 562


IloCplex::BasisStatusIloCplex::BasisStatusCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hBasisStatus{NotABasicStatus,Basic,AtLower,AtUpper,FreeOrSuperbasic};The enumeration IloCplex::BasisStatus lists values that the status of variablesor range constraints may assume in a basis. NotABasicStatus is not a valid statusfor a variable. A basis containing such a status does not constitute a valid basis. Thebasis status of a ranged constraint corresponds to the basis status of the correspondingslack or artificial variable that IloCplex manages for it. FreeOrSuperbasicspecifies that the variable is nonbasic, but not at a bound.IloCplex, IloCplex::BasisStatusArrayNotABasicStatusBasicAtLowerAtUpperFreeOrSuperbasic<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 563


IloCplex::BasisStatusArrayIloCplex::BasisStatusArrayCategoryDefinition FileSynopsisDescriptionSee AlsoInner Type Definitionilcplex/ilocplexi.hIloArray< BasisStatus > BasisStatusArrayThis type defines an array-type for IloCplex::BasisStatus. The fully qualifiedname of a basis status array is IloCplex::BasisStatusArray.IloCplex, IloCplex::BasisStatus<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 564


IloCplex::BoolParamIloCplex::BoolParamCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hBoolParam{PreInd,ReverseInd,XXXInd,MIPOrdInd,MPSLongNum,LBHeur,PerInd,PreLinear,DataCheck,QPmakePSDInd,MemoryEmphasis,NumericalEmphasis};The enumeration IloCplex::BoolParam lists the parameters of <strong>CPLEX</strong> thatrequire Boolean values. Boolean values are also known in certain contexts as binaryvalues or as zero-one (0-1) values. Use these values with the methods that acceptBoolean parameters: IloCplex::getParam and IloCplex::setParam.See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameters for more information about theseparameters. Also see the user's manual for examples of their use.IloCplexPreInd= CPX_PARAM_PREINDReverseInd= deprecatedXXXInd= deprecatedMIPOrdInd= CPX_PARAM_MIPORDINDMPSLongNum= CPX_PARAM_MPSLONGNUMLBHeur<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 565


IloCplex::BoolParam= CPX_PARAM_LBHEURPerInd= CPX_PARAM_PERINDPreLinear= CPX_PARAM_PRELINEARDataCheck= CPX_PARAM_DATACHECKQPmakePSDInd= CPX_PARAM_QPMAKEPSDINDMemoryEmphasis= CPX_PARAM_MEMORYEMPHASISNumericalEmphasis= CPX_PARAM_NUMERICALEMPHASIS<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 566


IloCplex::BranchCallbackIIloCplex::BranchCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedBranchCallbackI(IloEnv env)Method Summaryprotected IloNumprotectedBranchCallbackI::BranchTypeprotected IloIntprotected NodeIdprotected IloBoolprotected NodeIdprotected NodeIdprotected NodeIdprotected NodeIdprotected NodeIdprotected NodeIdgetBranch(IloNumVarArray vars,IloNumArraybounds,IloCplex::BranchDirectionArraydirs,IloInt i) constgetBranchType() constgetNbranches() constgetNodeId() constisIntegerFeasible() constmakeBranch(const IloConstraintArraycons,const IloIntVarArray vars,constIloNumArray bounds,constIloCplex::BranchDirectionArray dirs,IloNumobjestimate,NodeData * data=0)makeBranch(const IloConstraintArraycons,const IloNumVarArray vars,constIloNumArray bounds,constIloCplex::BranchDirectionArray dirs,IloNumobjestimate,NodeData * data=0)makeBranch(const IloConstraint con,IloNumobjestimate,NodeData * data=0)makeBranch(const IloConstraintArraycons,IloNum objestimate,NodeData * data=0)makeBranch(const IloIntVar var,IloNumbound,IloCplex::BranchDirection dir,IloNumobjestimate,NodeData * data=0)makeBranch(const IloNumVar var,IloNumbound,IloCplex::BranchDirection dir,IloNumobjestimate,NodeData * data=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 567


IloCplex::BranchCallbackIprotected NodeIdprotected NodeIdprotected voidmakeBranch(const IloIntVarArray vars,constIloNumArray bounds,constIloCplex::BranchDirectionArray dirs,IloNumobjestimate,NodeData * data=0)makeBranch(const IloNumVarArray vars,constIloNumArray bounds,constIloCplex::BranchDirectionArray dirs,IloNumobjestimate,NodeData * data=0)prune()Inherited methods from IloCplex::ControlCallbackIControlCallbackI::getDownPseudoCost, ControlCallbackI::getDownPseudoCost,ControlCallbackI::getFeasibilities, ControlCallbackI::getFeasibilities,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getLB, ControlCallbackI::getLB,ControlCallbackI::getLBs, ControlCallbackI::getLBs,ControlCallbackI::getNodeData, ControlCallbackI::getObjValue,ControlCallbackI::getSlack, ControlCallbackI::getSlacks,ControlCallbackI::getUB, ControlCallbackI::getUB,ControlCallbackI::getUBs, ControlCallbackI::getUBs,ControlCallbackI::getUpPseudoCost, ControlCallbackI::getUpPseudoCost,ControlCallbackI::getValue, ControlCallbackI::getValue,ControlCallbackI::getValue, ControlCallbackI::getValues,ControlCallbackI::getValues, ControlCallbackI::isSOSFeasible,ControlCallbackI::isSOSFeasibleInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 568


IloCplex::BranchCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainInner EnumerationBranchCallbackI::BranchTypeDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::BranchCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a mixed integer<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 569


IloCplex::BranchCallbackIprogram (MIP). The user-written callback is called prior to branching at a node in thebranch & cut tree during the optimization of a MIP. It allows you to query how theinvoking instance of IloCplex is about to create subnodes at the current node andgives you the option to override the selection made by the invoking instance ofIloCplex. You can create zero, one, or two branches.◆◆◆The method prune removes the current node from the search tree. No subnodesfrom the current node will be added to the search tree.The method makeBranch tells an instance of IloCplex how to create asubproblem. You may call this method zero, one, or two times in every invocation ofthe branch callback. If you call it once, it creates one node; it you call it twice, itcreates two nodes (one node at each call).If you call neither IloCplex::BranchCallBackI::prune norIloCplex::BranchCallBackI::makeBranch, the instance of IloCplexproceeds with its own selection.◆ Calling both IloCplex::BranchCallBackI::prune andIloCplex::BranchCallBackI::makeBranch in one invocation of abranch callback is an error and results in unspecified behavior.The methods of this class are for use in deriving a user-written callback class and inimplementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.See AlsoConstructorsMethodsILOBRANCHCALLBACK0, IloCplex::BranchDirection,IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPCallbackI, IloCplex::ControlCallbackI,IloCplex::OptimizationCallbackIprotected BranchCallbackI(IloEnv env)This constructor creates a branch callback, that is, a control callback for splitting a nodeinto two branches.protected IloNum getBranch(IloNumVarArray vars,IloNumArray bounds,IloCplex::BranchDirectionArray dirs,IloInt i) constThis method accesses branching information for the i-th branch that the invokinginstance of IloCplex is about to create. The parameter i must be between 0 (zero)and (getNbranches - 1); that is, it must be a valid index of a branch; normally, itwill be zero or one.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 570


IloCplex::BranchCallbackIA branch is normally defined by a set of variables and the bounds for these variables.Branches that are more complex cannot be queried. The return value is the node estimatefor that branch.◆◆The parameter vars contains the variables for which new bounds will be set in thei-th branch.The parameter bounds contains the new bounds for the variables listed in vars;that is, bounds[j] is the new bound for vars[j].◆ The parameter dirs specifies the branching direction for the variables in vars.dir[j] == IloCplex::BranchUpmeans that bounds[j] specifies a lower bound for vars[j].dirs[j] == IloCplex::BranchDownmeans that bounds[j] specifies an upper bound for vars[j].protected BranchCallbackI::BranchType getBranchType() constThis method returns the type of branchingnode.protected IloInt getNbranches() constIloCplex is going to do for the currentThis method returns the number of branches IloCplex is going to create at the currentnode.protected NodeId getNodeId() constReturns the NodeId of the current node.protected IloBool isIntegerFeasible() constThis method returns IloTrue if the solution of the current node is integer feasible.protected NodeId makeBranch(const IloConstraintArray cons,const IloIntVarArray vars,const IloNumArray bounds,const IloCplex::BranchDirectionArray dirs,IloNum objestimate,NodeData * data=0)This method offers the same facilities as the other methodsIloCplex::BranchCallbackI::makeBranch, but for a branch specified by aset of constraints and a set of variables.protected NodeId makeBranch(const IloConstraintArray cons,const IloNumVarArray vars,const IloNumArray bounds,const IloCplex::BranchDirectionArray dirs,IloNum objestimate,NodeData * data=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 571


IloCplex::BranchCallbackIThis method offers the same facilities as the other methodsIloCplex::BranchCallbackI::makeBranch, but for a branch specified by aset of constraints and a set of variables.protected NodeId makeBranch(const IloConstraint con,IloNum objestimate,NodeData * data=0)This method offers the same facilities for a branch specified by only one constraint asIloCplex::BranchCallbackI::makeBranch does for a branch specified by aset of constraints.protected NodeId makeBranch(const IloConstraintArray cons,IloNum objestimate,NodeData * data=0)This method overrides the branch chosen by an instance of IloCplex, by specifying abranch on constraints. A method named makeBranch can be called zero, one, or twotimes in every invocation of the branch callback. If you call it once, it creates one node;it you call it twice, it creates two nodes (one node at each call). If you call it more thantwice, it throws an exception.◆◆◆The parameter cons specifies an array of constraints that are to be added for thesubnode being created.The parameter objestimate provides an estimate of the resulting optimalobjective value for the subnode specified by this branch. The invoking instance ofIloCplex may use this estimate to select nodes to process. Providing a wrongestimate will not influence the correctness of the solution, but it may influenceperformance. Using the objective value of the current node is usually a safe choice.The parameter data allows you to add an object of typeIloCplex::MIPCallbackI::NodeData to the node representing the branchcreated by the makeBranch call. Such data objects must be instances of a userwrittensubclass of IloCplex::MIPCallbackI::NodeData.protected NodeId makeBranch(const IloIntVar var,IloNum bound,IloCplex::BranchDirection dir,IloNum objestimate,NodeData * data=0)For a branch specified by only one variable, this method offers the same facilities asIloCplex::BranchCallbackI::makeBranch for a branch specified by a setof variables.protected NodeId makeBranch(const IloNumVar var,IloNum bound,IloCplex::BranchDirection dir,IloNum objestimate,NodeData * data=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 572


IloCplex::BranchCallbackIFor a branch specified by only one variable, this method offers the same facilities asIloCplex::BranchCallbackI::makeBranch for a branch specified by a setof variables.protected NodeId makeBranch(const IloIntVarArray vars,const IloNumArray bounds,const IloCplex::BranchDirectionArray dirs,IloNum objestimate,NodeData * data=0)This method overrides the branch chosen by an instance of IloCplex. A methodnamed makeBranch can be called zero, one, or two times in every invocation of thebranch callback. If you call it once, it creates one node; it you call it twice, it creates twonodes (one node at each call). If you call it more than twice, it throws an exception.Each call specifies a branch; in other words, it instructs the invoking IloCplex objecthow to create a subnode from the current node by specifying new, tighter bounds for aset of variables.◆◆The parameter vars contains the variables for which new bounds will be set in thebranch.The parameter bounds contains the new bounds for the variables listed in vars;that is, bounds[j] is the new bound to be set for vars[j].◆ The parameter dirs specifies the branching direction for the variables in vars.dir[j] == IloCplex::BranchUpmeans that bounds[j] specifies a lower bound for vars[j].dirs[j] == IloCplex::BranchDownmeans that bounds[j] specifies an upper bound for vars[j].◆◆The parameter objestimate provides an estimate of the resulting optimalobjective value for the subnode specified by this branch. The invoking instance ofIloCplex may use this estimate to select nodes to process. Providing a wrongestimate will not influence the correctness of the solution, but it may influenceperformance. Using the objective value of the current node is usually a safe choice.The parameter data allows you to add an object of typeIloCplex::MIPCallbackI::NodeData to the node representing the branchcreated by the makeBranch call. Such data objects must be instances of a userwrittensubclass of IloCplex::MIPCallbackI::NodeData.protected NodeId makeBranch(const IloNumVarArray vars,const IloNumArray bounds,const IloCplex::BranchDirectionArray dirs,IloNum objestimate,NodeData * data=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 573


IloCplex::BranchCallbackIThis method overrides the branch chosen by an instance of IloCplex. A methodnamed makeBranch can be called zero, one, or two times in every invocation of thebranch callback. If you call it once, it creates one node; it you call it twice, it creates twonodes (one node at each call). If you call it more than twice, it throws an exception.Each call specifies a branch; in other words, it instructs the invoking IloCplex objecthow to create a subnode from the current node by specifying new, tighter bounds for aset of variables.◆◆The parameter vars contains the variables for which new bounds will be set in thebranch.The parameter bounds contains the new bounds for the variables listed in vars;that is, bounds[j] is the new bound to be set for vars[j].◆ The parameter dirs specifies the branching direction for the variables in vars.dir[j] == IloCplex::BranchUpmeans that bounds[j] specifies a lower bound for vars[j].dirs[j] == IloCplex::BranchDownmeans that bounds[j] specifies an upper bound for vars[j].◆◆The parameter objestimate provides an estimate of the resulting optimalobjective value for the subnode specified by this branch. The invoking instance ofIloCplex may use this estimate to select nodes to process. Providing a wrongestimate will not influence the correctness of the solution, but it may influenceperformance. Using the objective value of the current node is usually a safe choice.The parameter data allows you to add an object of typeIloCplex::MIPCallbackI::NodeData to the node representing the branchcreated by the makeBranch call. Such data objects must be instances of a userwrittensubclass of IloCplex::MIPCallbackI::NodeData.protected void prune()By calling this method, you instruct the <strong>CPLEX</strong> branch & cut search not to create anychild nodes from the current node, or, in other words, to discard nodes below the currentnode; it does not revisit the discarded nodes below the current node. In short, it createsno branches. It is an error to call both prune and makeBranch in one invocation of acallback.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 574


BranchCallbackI::BranchTypeBranchCallbackI::BranchTypeCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hBranchType{BranchOnVariable,BranchOnSOS1,BranchOnSOS2,BranchOnAny,UserBranch};IloCplex::BranchCallbackI::BranchType is an enumeration limited inscope to the class IloCplex::BranchCallbackI. This enumeration is used bythe method IloCplex::BranchCallbackI::getBranchType to tell whatkind of branch IloCplex is about to do:◆◆BranchOnVariable specifies branching on a single variable.BranchOnAny specifies multiple bound changes and constraints will be used forbranching.◆ BranchOnSOS1 specifies branching on an SOS of type 1.◆ BranchOnSOS2 specifies branching on an SOS of type 2.IloCplex::BranchCallbackIBranchOnVariable= CPX_TYPE_VARBranchOnSOS1= CPX_TYPE_SOS1BranchOnSOS2= CPX_TYPE_SOS2BranchOnAny= CPX_TYPE_ANYUserBranch<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 575


IloCplex::BranchDirectionIloCplex::BranchDirectionCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hBranchDirection{BranchGlobal,BranchDown,BranchUp};The enumeration IloCplex::BranchDirection lists values that can be used forspecifying branch directions either with the branch direction parameterIloCplex::BrDir or with the methods IloCplex::setDirection andIloCplex::setDirections. The branch direction specifies which direction toexplore first after branching on one variable.See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameters and the <strong>ILOG</strong> <strong>CPLEX</strong> User's<strong>Manual</strong> for more information about these parameters. Also see the user's manual forexamples of their use.IloCplex, IloCplex::BranchDirectionArrayBranchGlobal= CPX_BRANCH_GLOBALBranchDown= CPX_BRANCH_DOWNBranchUp= CPX_BRANCH_UP<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 576


IloCplex::BranchDirectionArrayIloCplex::BranchDirectionArrayCategoryDefinition FileSynopsisDescriptionSee AlsoInner Type Definitionilcplex/ilocplexi.hIloArray< BranchDirection > BranchDirectionArrayThis type defines an array-type for IloCplex::BranchDirection. The fullyqualified name of a branch direction array isIloCplex::BranchDirectionArray.IloCplex, IloCplex::BranchDirection<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 577


IloCplex::CallbackIloCplex::CallbackCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicCallback(IloCplex::CallbackI * impl=0)Method Summarypublic voidpublic IloCplex::CallbackI *public Callback::Typeend()getImpl() constgetType() constInner EnumerationCallback::TypeDescriptionSee AlsoConstructorsMethodsThis class is the handle class for all callback implementation classes available forIloCplex. Callback implementation classes are user-defined classes derived from asubclass of IloCplex::CallbackI.IloCplex, IloCplex::CallbackIpublic Callback(IloCplex::CallbackI * impl=0)This constructor creates a callback handle object and initializes it to the implementationobject passed as the argument.public void end()<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 578


IloCplex::CallbackThis method deletes the implementation object pointed to by the invoking handle andsets the pointer to 0 (zero).public IloCplex::CallbackI * getImpl() constThis method returns a pointer to the implementation object of the invoking handle.public Callback::Type getType() constThis method returns the type of the callback implementation object referenced by theinvoking handle.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 579


IloCplex::CallbackIIloCplex::CallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summaryprotected voidprotected virtual CallbackI*protected IloEnvprotected virtual voidCallbackI::abort()CallbackI::duplicateCallback() constCallbackI::getEnv() constCallbackI::main()DescriptionThis is the abstract base class for user-written callback classes. It provides theircommon application programming interface (<strong>API</strong>). Callbacks may be called repeatedlyat various points during an optimization; for each place a callback is called, <strong>ILOG</strong><strong>CPLEX</strong> provides a separate callback class (derived from this class). Such a callbackclass provides the specific <strong>API</strong> as a protected method to use for the particularimplementation.You do not create instances of this class; rather, you use one of its child classes toimplement your own callback. In order to implement your user-written callbacks with aninstance of IloCplex, you should follow these steps:◆◆◆Determine which kind of callback you want to write, and choose the appropriateclass for it. The class hierarchy in Tree may give you some ideas here.Derive your own subclass, MyCallbackI, say, from the appropriate predefinedcallback class.In your subclass of the callback class, use the protected <strong>API</strong> defined in the baseclass to implement the main routine of your user-written callback. (All constructorsof predefined callback classes are protected; they can be called only from userwrittenderived subclasses.)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 580


IloCplex::CallbackI◆ In your subclass, implement the method duplicateCallback.◆◆Write a function myCallback, say, that creates an instance of yourimplementation class in the Concert Technology environment and returns it as ahandle of IloCplex::Callback.Create an instance of your callback class and pass it to the member function use.Note: Macros ILOXXXCALLBACKn (for n from 0 to 7) are available to facilitatesteps 2 through 5, where XXX stands for the particular callback under constructionand n stands for the number of parameters that the function written in step 5 is toreceive in addition to the environment parameter.You can use one instance of a callback with only one instance of IloCplex. When youuse a callback with a second instance of IloCplex, a copy will be automaticallycreated using the method duplicateCallback, and that copy will be used instead.Also, an instance of IloCplex takes account of only one instance of a particularcallback at any given time. That is, if you call use more than once with the same classof callback, the last call overrides any previous one. For example, you can use only oneprimal simplex callback at a time, or you can use only one network callback at a time;and so forth.There are two varieties of callbacks:◆ Query callbacks enable your application to retrieve information about the currentsolution in an instance of IloCplex. The information available depends on thealgorithm (primal simplex, dual simplex, barrier, mixed integer, or network) that youare using. For example, a query callback can return the current objective value, thenumber of simplex iterations that have been completed, and other details. Querycallbacks can also be called from presolve, probing, fractional cuts, and disjunctivecuts.◆ Control callbacks enable you to direct the search when you are solving a MIP in aninstance of IloCplex. For example, control callbacks enable you to select the nextnode to process or to control the creation of subnodes (among other possibilities).Existing extractables should never be modified within a callback. Temporaryextractables, such as arrays, expressions, and range constraints, can be created andmodified. Temporary extractables are often useful, for example, for computing cuts.See AlsoILOBARRIERCALLBACK0, ILOBRANCHCALLBACK0, IloCplex,IloCplex::BarrierCallbackI, IloCplex::BranchCallbackI,IloCplex::Callback, IloCplex::ControlCallbackI,IloCplex::CrossoverCallbackI, IloCplex::CutCallbackI,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 581


IloCplex::CallbackIIloCplex::DisjunctiveCutCallbackI,IloCplex::FlowMIRCutCallbackI,IloCplex::FractionalCutCallbackI,IloCplex::HeuristicCallbackI, IloCplex::IncumbentCallbackI,IloCplex::ContinuousCallbackI, IloCplex::MIPCallbackI,IloCplex::NetworkCallbackI, IloCplex::NodeCallbackI,IloCplex::OptimizationCallbackI,IloCplex::PresolveCallbackI, IloCplex::ProbingCallbackI,IloCplex::SimplexCallbackI, IloCplex::SolveCallbackI,IloCplex::TuningCallbackI, ILOCROSSOVERCALLBACK0,ILOCUTCALLBACK0, ILOBRANCHCALLBACK0,ILODISJUNCTIVECUTCALLBACK0, ILOFLOWMIRCUTCALLBACK0,ILOFRACTIONALCUTCALLBACK0, ILOHEURISTICCALLBACK0,ILOINCUMBENTCALLBACK0, ILOCONTINUOUSCALLBACK0,ILOMIPCALLBACK0, ILONETWORKCALLBACK0, ILONODECALLBACK0,ILOPRESOLVECALLBACK0, ILOPROBINGCALLBACK0,ILOSIMPLEXCALLBACK0, ILOSOLVECALLBACK0, ILOTUNINGCALLBACK0Methodsprotected void abort()This method instructs <strong>CPLEX</strong> to stop the current optimization after the user callbackfinishes. Note that executing additional IloCplex callback methods in the callbackcan lead to unpredictable behavior. For example, callback methods such asIloCplex::SolveCallbackI::solve orIloCplex::BranchCallbackI::makeBranch can overwrite the callbackstatus and thus enable the optimization to continue. Therefore, to abort an optimizationeffectively, a user should exit the callback by one of the following ways:◆◆Call return immediately after the call of abort.Structure the callback so that it calls no additional methods ofIloCplex::CallbackI and its subclasses after abort.protected virtual CallbackI * duplicateCallback() constThis virtual method must be implemented to create a copy of the invoking callbackobject on the same environment. Typically the following implementation will work for acallback class called MyCallbackI:IloCplex::CallbackI* MyCallbackI::duplicateCallback() const {return (new (getEnv()) MyCallbackI(*this));}This method is called by an IloCplex object in two cases:◆When cplex.use(cb) is called for a callback object cb that is already used byanother instance of IloCplex, a copy of the implementation object of cb is<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 582


IloCplex::CallbackI◆created by calling duplicateCallback and used in its place. The method usewill return a handle to that copy.When a parallel optimizer is used, IloCplex creates copies of every callback thatit uses by calling duplicateCallback. One copy of a callback is created foreach additional thread being used in the parallel optimizer. During the optimization,each thread will invoke the copy corresponding to the thread number. The methodsprovided by the callback <strong>API</strong>s are guaranteed to be threadsafe. However, whenaccessing parameters passed to callbacks or members stored in a callback, it is up tothe user to make sure of thread safety by synchronizing access or creating distinctcopies of the data in the implementation of duplicateCallback.protected IloEnv getEnv() constThis method returns the environment belonging to the IloCplex object that invokedthe method main.protected virtual void main()This virtual method is to be implemented by the user in a derived callback class to definethe functionality of the callback. When an instance of IloCplex uses a callback (aninstance of IloCplex::CallbackI or one of its derived subclasses), IloCplexcalls this virtual method main at the point during the optimization at which the callbackis executed.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 583


Callback::TypeCallback::TypeCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hType{Presolve,Simplex,Barrier,Crossover,Network,MIP,Probing,FractionalCut,DisjunctiveCut,Branch,Cut,Node,Heuristic,Incumbent,Solve,FlowMIRCut,Continuous,MIPInfo,ProbingInfo,FractionalCutInfo,DisjunctiveCutInfo,FlowMIRCutInfo,Tuning,_Number};This enumeration type is used to identify the type of a callback implementation objectreferred to by an IloCplex::Callback handle.IloCplex::CallbackPresolveSimplexBarrierCrossoverNetworkMIPProbingFractionalCutDisjunctiveCutBranchCutNodeHeuristicIncumbent<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 584


Callback::TypeSolveFlowMIRCutContinuousMIPInfoProbingInfoFractionalCutInfoDisjunctiveCutInfoFlowMIRCutInfoTuning_Number<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 585


IloCplex::ConflictStatusIloCplex::ConflictStatusCategoryDefinition FileSynopsisInner Enumerationilcplex/ilocplexi.hConflictStatus{ConflictExcluded,ConflictPossibleMember,ConflictMember};Description This enumeration lists the values that tell the status of a constraint or bound withrespect to a conflict.◆ConflictPossibleMember◆ ConflictMemberThe value ConflictExcluded is internal, undocumented, not available to users.FieldsConflictExcludedConflictPossibleMemberConflictMember<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 586


IloCplex::ConflictStatusArrayIloCplex::ConflictStatusArrayCategoryDefinition FileSynopsisDescriptionSee AlsoInner Type Definitionilcplex/ilocplexi.hIloArray< ConflictStatus > ConflictStatusArrayThis type defines an array-type for IloCplex::ConflictStatus.IloCplex, IloCplex::ConflictStatus<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 587


IloCplex::ContinuousCallbackIIloCplex::ContinuousCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedContinuousCallbackI(IloEnv env)Method Summaryprotected IloNumprotected IloNumprotected IloIntprotected IloNumprotected IloBoolprotected IloBoolContinuousCallbackI::getDualInfeasibility()constContinuousCallbackI::getInfeasibility()constContinuousCallbackI::getNiterations() constContinuousCallbackI::getObjValue() constContinuousCallbackI::isDualFeasible() constContinuousCallbackI::isFeasible() constInherited methods fromIloCplex::OptimizationCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 588


IloCplex::ContinuousCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionAn instance of a class derived from IloCplex::ContinuousCallbackIrepresents a user-written callback in an <strong>ILOG</strong> <strong>CPLEX</strong> application that uses an instanceof IloCplex with the primal simplex, dual simplex, or barrier optimizer. IloCplexcalls the user-written callback after each iteration during an optimization of a problemsolved at a node. This class offers methods for use within the callbacks you write. Inparticular, there are methods in this class to access primal and dual feasibility, number ofiterations, and objective value.The methods of this class are protected for use in deriving a user-written callback classand in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.Note: There are special callbacks for simplex and barrier, that is,IloCplex::SimplexCallbackI andIloCplex::BarrierCallbackI, respectively. Using a continous callbacksets this callback in both of these algorithms. If a special callback was already setfor one of these algorithms, (for example, simplex) it is replaced by the generalcontinuous callback.See AlsoConstructorsMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::OptimizationCallbackI, ILOCONTINUOUSCALLBACK0protected ContinuousCallbackI(IloEnv env)This constructor creates a callback for use in an application that solves continuousmodels.protected IloNum getDualInfeasibility() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 589


IloCplex::ContinuousCallbackIThis method returns the current dual infeasibility measure of the solution in the instanceof IloCplex at the time the invoking callback is executed.protected IloNum getInfeasibility() constThis method returns the current primal infeasibility measure of the solution in theinstance of IloCplex at the time the invoking callback is executed.protected IloInt getNiterations() constThis method returns the number of iterations completed so far by an instance ofIloCplex at the invoking callback is executed.protected IloNum getObjValue() constThis method returns the current objective value of the solution in the instance ofIloCplex at the time the invoking callback is executed.If you need the object representing the objective itself, consider the methodgetObjective instead.protected IloBool isDualFeasible() constThis method returns IloTrue if the current solution is dual feasible.protected IloBool isFeasible() constThis method returns IloTrue if the current solution is primal feasible.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 590


IloCplex::ControlCallbackIIloCplex::ControlCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summaryprotected IloNumprotected IloNumprotected voidprotected voidprotectedControlCallbackI::IntegerFeasibilityprotectedControlCallbackI::IntegerFeasibilityprotectedControlCallbackI::IntegerFeasibilityprotectedControlCallbackI::IntegerFeasibilityprotected IloNumprotected IloNumprotected voidprotected voidprotected NodeData *protected IloNumprotected IloNumControlCallbackI::getDownPseudoCost(constIloIntVar var) constControlCallbackI::getDownPseudoCost(constIloNumVar var) constControlCallbackI::getFeasibilities(ControlCallbackI::IntegerFeasibilityArray stat,constIloIntVarArray var) constControlCallbackI::getFeasibilities(ControlCallbackI::IntegerFeasibilityArray stat,constIloNumVarArray var) constControlCallbackI::getFeasibility(constIloIntVar var) constControlCallbackI::getFeasibility(constIloNumVar var) constControlCallbackI::getFeasibility(constIloSOS2 sos) constControlCallbackI::getFeasibility(constIloSOS1 sos) constControlCallbackI::getLB(const IloIntVar var)constControlCallbackI::getLB(const IloNumVar var)constControlCallbackI::getLBs(IloNumArrayval,const IloIntVarArray vars) constControlCallbackI::getLBs(IloNumArrayval,const IloNumVarArray vars) constControlCallbackI::getNodeData() constControlCallbackI::getObjValue() constControlCallbackI::getSlack(const IloRangerng) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 591


IloCplex::ControlCallbackIprotected voidprotected IloNumprotected IloNumprotected voidprotected voidprotected IloNumprotected IloNumprotected IloNumprotected IloNumprotected IloNumprotected voidprotected voidprotected IloBoolprotected IloBoolControlCallbackI::getSlacks(IloNumArrayval,const IloRangeArray con) constControlCallbackI::getUB(const IloIntVar var)constControlCallbackI::getUB(const IloNumVar var)constControlCallbackI::getUBs(IloNumArrayval,const IloIntVarArray vars) constControlCallbackI::getUBs(IloNumArrayval,const IloNumVarArray vars) constControlCallbackI::getUpPseudoCost(constIloIntVar var) constControlCallbackI::getUpPseudoCost(constIloNumVar var) constControlCallbackI::getValue(const IloIntVarvar) constControlCallbackI::getValue(const IloNumVarvar) constControlCallbackI::getValue(const IloExprArgexpr) constControlCallbackI::getValues(IloNumArrayval,const IloIntVarArray vars) constControlCallbackI::getValues(IloNumArrayval,const IloNumVarArray vars) constControlCallbackI::isSOSFeasible(constIloSOS2 sos2) constControlCallbackI::isSOSFeasible(constIloSOS1 sos1) constInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 592


IloCplex::ControlCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainInner EnumerationControlCallbackI::IntegerFeasibilityInner ClassControlCallbackI::ControlCallbackI::PresolvedVariableException<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 593


IloCplex::ControlCallbackIInner Type DefControlCallbackI::ControlCallbackI::IntegerFeasibilityArrayDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.This class defines the common application programming interface (<strong>API</strong>) for thefollowing classes that allow you to control the MIP search:◆◆◆IloCplex::SolveCallbackIIloCplex::CutCallbackIIloCplex::HeuristicCallbackI◆ IloCplex::BranchCallbackIAn instance of one of these classes represents a user-written callback that intervenes inthe search for a solution at a given node in an application that uses an instance ofIloCplex to solve a mixed integer program (MIP). Control callbacks are tied to anode. They are called at each node during IloCplex branch & cut search. The usernever subclasses the IloCplex::ControlCallbackI class directly; it onlydefines the common interface of thosee listed callbacks.In particular, SolveCallbackI is called before solving the node relaxation andoptionally allows substitution of its solution. IloCplex does this by default. After thenode relaxation has been solved, either by an instance of SolveCallbackI or byIloCplex, the other control callbacks are called in the following order:◆◆IloCplex::CutCallbackIIloCplex::HeuristicCallbackI◆ IloCplex::BranchCallbackIIf the cut callback added new cuts to the node relaxation, the node relaxation will besolved again using the solve callback, if used. The same is true if IloCplex generatedits own cuts.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 594


IloCplex::ControlCallbackIThe methods of this class are protected and its constructor is private; you cannot directlysubclass this class; you must derive from its subclasses.If an attempt is made to access information not available to an instance of this class, anexception is thrown.See AlsoMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,ControlCallbackI::IntegerFeasibility,ControlCallbackI::IntegerFeasibilityArray,IloCplex::MIPCallbackI, IloCplex::OptimizationCallbackIprotected IloNum getDownPseudoCost(const IloIntVar var) constThis method returns the current pseudo cost for branching downward on the variablevar.protected IloNum getDownPseudoCost(const IloNumVar var) constThis method returns the current pseudo cost for branching downward on the variablevar.protected void getFeasibilities(ControlCallbackI::IntegerFeasibilityArraystat,const IloIntVarArray var) constThis method specifies whether each of the variables in the array vars is integerfeasible, integer infeasible, or implied integer feasible by putting the status in thecorresponding element of the array stats.protected void getFeasibilities(ControlCallbackI::IntegerFeasibilityArraystat,const IloNumVarArray var) constThis method specifies whether each of the variables in the array vars is integerfeasible, integer infeasible, or implied integer feasible by putting the status in thecorresponding element of the array stats.protected ControlCallbackI::IntegerFeasibility getFeasibility(constIloIntVar var) constThis method specifies whether the variable var is integer feasible, integer infeasible, orimplied integer feasible in the current node solution.protected ControlCallbackI::IntegerFeasibility getFeasibility(constIloNumVar var) constThis method specifies whether the variable var is integer feasible, integer infeasible, orimplied integer feasible in the current node solution.protected ControlCallbackI::IntegerFeasibility getFeasibility(constIloSOS2 sos) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 595


IloCplex::ControlCallbackIThis method specifies whether the Special Ordered Set sos is integer feasible, integerinfeasible, or implied integer feasible in the current node solution.protected ControlCallbackI::IntegerFeasibility getFeasibility(constIloSOS1 sos) constThis method specifies whether the Special Ordered Set sos is integer feasible, integerinfeasible, or implied integer feasible in the current node solution.protected IloNum getLB(const IloIntVar var) constThis method returns the lower bound of var at the current node. This bound is likely tobe different from the bound in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes. The correspondingsolution value from getValue may violate this bound at a node where a newincumbent has been found because the bound is tightened when an incumbent is found.Unbounded VariablesIf a variable lacks a lower bound, then getLB returns a value greater than or equal to -IloInfinity for greater than or equal to constraints with no lower bound.protected IloNum getLB(const IloNumVar var) constThis method returns the lower bound of var at the current node. This bound is likely tobe different from the bound in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes. The correspondingsolution value from getValue may violate this bound at a node where a newincumbent has been found because the bound is tightened when an incumbent is found.Unbounded VariablesIf a variable lacks a lower bound, then getLB returns a value greater than or equal to -IloInfinity for greater than or equal to constraints with no lower bound.protected void getLBs(IloNumArray val,const IloIntVarArray vars) constFor each element of the array vars, this method puts the lower bound at the currentnode into the corresponding element of the array vals. These bounds are likely to bedifferent from the bounds in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes. The correspondingsolution values from getValues may violate these bounds at a node where a newincumbent has been found because the bounds are tightened when an incumbent isfound.Unbounded VariablesIf a variable lacks a lower bound, then getLBs returns a value greater than or equal to-IloInfinity for greater than or equal to constraints with no lower bound.protected void getLBs(IloNumArray val,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 596


IloCplex::ControlCallbackIconst IloNumVarArray vars) constThis method puts the lower bound at the current node of each element of the array varsinto the corresponding element of the array vals. These bounds are likely to bedifferent from the bounds in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes. The correspondingsolution values from getValues may violate these bounds at a node where a newincumbent has been found because the bounds are tightened when an incumbent isfound.Unbounded VariablesIf a variable lacks a lower bound, then getLBs returns a value greater than or equal to-IloInfinity for greater than or equal to constraints with no lower bound.protected NodeData * getNodeData() constThis method retrieves the NodeData object that may have previously been assigned tothe current node by the user with the methodIloCplex::BranchCallbackI::makeBranch. If no data object has beenassigned to the current node, 0 (zero) will be returned.protected IloNum getObjValue() constThis method returns the objective value of the solution of the relaxation at the currentnode.If you need the object representing the objective itself, consider the methodgetObjective instead.protected IloNum getSlack(const IloRange rng) constThis method returns the slack value for the constraint specified by rng in the solutionof the relaxation at the current node.protected void getSlacks(IloNumArray val,const IloRangeArray con) constFor each of the constraints in the array of ranges rngs, this method puts the slack valuein the solution of the relaxation at the current node into the corresponding element ofthe array vals.protected IloNum getUB(const IloIntVar var) constThis method returns the upper bound of the variable var at the current node. Thisbound is likely to be different from the bound in the original model because an instanceof IloCplex tightens bounds when it branches from a node to its subnodes. Thecorresponding solution value from getValue may violate this bound at a node where anew incumbent has been found because the bound is tightened when an incumbent isfound.Unbounded Variables<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 597


IloCplex::ControlCallbackIIf a variable lacks an upper bound, then getUB returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.protected IloNum getUB(const IloNumVar var) constThis method returns the upper bound of the variable var at the current node. Thisbound is likely to be different from the bound in the original model because an instanceof IloCplex tightens bounds when it branches from a node to its subnodes. Thecorresponding solution value from getValue may violate this bound at a node where anew incumbent has been found because the bound is tightened when an incumbent isfound.Unbounded VariablesIf a variable lacks an upper bound, then getUB returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.protected void getUBs(IloNumArray val,const IloIntVarArray vars) constFor each element in the array vars, this method puts the upper bound at the currentnode into the corresponding element of the array vals. The bounds are those in therelaxation at the current node. These bounds are likely to be different from the boundsin the original model because an instance of IloCplex tightens bounds when itbranches from a node to its subnodes. The corresponding solution values fromgetValues may violate these bounds at a node where a new incumbent has beenfound because the bounds are tightened when an incumbent is found.Unbounded VariablesIf a variable lacks an upper bound, then getUBs returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.protected void getUBs(IloNumArray val,const IloNumVarArray vars) constFor each element in the array vars, this method puts the upper bound at the currentnode into the corresponding element of the array vals. The bounds are those in therelaxation at the current node. These bounds are likely to be different from the boundsin the original model because an instance of IloCplex tightens bounds when itbranches from a node to its subnodes. The corresponding solution values fromgetValues may violate these bounds at a node where a new incumbent has beenfound because the bounds are tightened when an incumbent is found.Unbounded VariablesIf a variable lacks an upper bound, then getUBs returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.protected IloNum getUpPseudoCost(const IloIntVar var) constThis method returns the current pseudo cost for branching upward on the variable var.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 598


IloCplex::ControlCallbackIprotected IloNum getUpPseudoCost(const IloNumVar var) constThis method returns the current pseudo cost for branching upward on the variable var.protected IloNum getValue(const IloIntVar var) constThis method returns the value of the variable var in the solution of the relaxation at thecurrent node.protected IloNum getValue(const IloNumVar var) constThis method returns the value of the variable var in the solution of the relaxation at thecurrent node.protected IloNum getValue(const IloExprArg expr) constThis method returns the value of the expression expr in the solution of the relaxationat the current node.protected void getValues(IloNumArray val,const IloIntVarArray vars) constFor each variable in the array vars, this method puts the value in the solution of therelaxation at the current node into the corresponding element of the array vals.protected void getValues(IloNumArray val,const IloNumVarArray vars) constFor each variable in the array vars, this method puts the value in the solution of therelaxation at the current node into the corresponding element of the array vals.protected IloBool isSOSFeasible(const IloSOS2 sos2) constThis method returns IloTrue if the solution of the LP at the current node is SOSfeasible for the special ordered set specified in its argument. The SOS set passed as aparameter to this method may be of type 2. See the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong> formore explanation of types of special ordered sets.protected IloBool isSOSFeasible(const IloSOS1 sos1) constThis method returns IloTrue if the solution of the LP at the current node is SOSfeasible for the special ordered set specified in its argument. The SOS set passed as aparameter to this method may be of type 1. See the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong> formore explanation about these types of special ordered sets.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 599


ControlCallbackI::IntegerFeasibilityControlCallbackI::IntegerFeasibilityCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hIntegerFeasibility{ImpliedInfeasible,Feasible,Infeasible,ImpliedFeasible};The enumeration IloCplex::ControlCallbackI::IntegerFeasibilityis an enumeration limited in scope to the class IloCplex::ControlCallbackI.This enumeration is used byIloCplex::ControlCallbackI::getFeasibility to represent the integerfeasibility of a variable or SOS in the current node solution:◆◆◆Feasible specifies the variable or SOS is integer feasible.ImpliedFeasible specifies the variable or SOS has been presolved out. It willbe feasible when all other integer variables or SOS are integer feasible.Infeasible specifies the variable or SOS is integer infeasible.IloCplex, ControlCallbackI::IntegerFeasibilityArrayImpliedInfeasibleFeasible= CPX_INTEGER_FEASIBLEInfeasible= CPX_INTEGER_INFEASIBLEImpliedFeasible= CPX_IMPLIED_INTEGER_FEASIBLE<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 600


ControlCallbackI::IntegerFeasibilityArrayControlCallbackI::IntegerFeasibilityArrayCategoryDefinition FileSynopsisDescriptionSee AlsoInner Type Definitionilcplex/ilocplexi.hIloArray< IntegerFeasibility > IntegerFeasibilityArrayThis type defines an array-type forIloCplex::ControlCallbackI::IntegerFeasibility. The fullyqualified name of an integer feasibility array isIloCplex::ControlCallbackI::IntegerFeasibility::Array.IloCplex, IloCplex::ControlCallbackI,ControlCallbackI::IntegerFeasibility<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 601


ControlCallbackI::PresolvedVariableExceptionControlCallbackI::PresolvedVariableExceptionCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summarypublic voidpublic voidend()getPresolvedVariables(IloNumVarArray vars)constInherited methods from IloCplex::ExceptionException::getStatusInherited methods from IloExceptionIloException::end, IloException::getMessageDescription Some operations within a control callback, in particular setting bounds in a heuristiccallback, are not possible to do on variables that have been taken out by presolve. Anexception of this type is thrown, if such an operation is attempted. Possible ways toavoid this exception are to avoid the operation on presolved variables, to use themethod IloCplex::protectVariables to protect the variables from beingtaken out by presolve, or to turn off presolve.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 602


ControlCallbackI::PresolvedVariableExceptionMethodspublic void end()This method must be called to free up the memory used by the exception when theinvoking exception object is no longer needed.public void getPresolvedVariables(IloNumVarArray vars) constThis methods copies the variables that caused the invoking exception into the arrayvars.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 603


IloCplex::CplexStatusIloCplex::CplexStatusCategoryDefinition FileSynopsisInner Enumerationilcplex/ilocplexi.hCplexStatus{Unknown,Optimal,Unbounded,Infeasible,InfOrUnbd,OptimalInfeas,NumBest,FeasibleRelaxedSum,OptimalRelaxedSum,FeasibleRelaxedInf,OptimalRelaxedInf,FeasibleRelaxedQuad,OptimalRelaxedQuad,AbortRelaxed,AbortObjLim,AbortPrimObjLim,AbortDualObjLim,AbortItLim,AbortTimeLim,AbortUser,OptimalFaceUnbounded,OptimalTol,SolLim,PopulateSolLim,NodeLimFeas,NodeLimInfeas,FailFeas,FailInfeas,MemLimFeas,MemLimInfeas,FailFeasNoTree,FailInfeasNoTree,ConflictFeasible,ConflictMinimal,ConflictAbortContradiction,ConflictAbortTimeLim,ConflictAbortItLim,ConflictAbortNodeLim,ConflictAbortObjLim,ConflictAbortMemLim,ConflictAbortUser,Feasible,OptimalPopulated,OptimalPopulatedTol<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 604


IloCplex::CplexStatus};DescriptionSee AlsoFieldsThe enumeration IloCplex::CplexStatus lists values that the status of anIloCplex algorithm can assume. The methods getCplexStatus andgetCplexSubStatus access the status values, providing information about whatthe algorithm learned about the active model in the most recent invocation of the methodsolve or feasOpt. The status may also tell why the algorithm terminated.See the group optim.cplex.solutionstatus in the Callable Library <strong>Reference</strong> <strong>Manual</strong>,where they are listed in alphabetic order, or the topic Interpreting Solution StatusCodes in the Overview of the <strong>API</strong>s, where they are listed in numeric order, for moreinformation about these values. Also see the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong> forexamples of their use.See also the enumeration IloAlgorithm::Status in the <strong>ILOG</strong> <strong>CPLEX</strong> <strong>Reference</strong><strong>Manual</strong>.IloCplexUnknownOptimal= CPX_STAT_OPTIMALUnbounded= CPX_STAT_UNBOUNDEDInfeasible= CPX_STAT_INFEASIBLEInfOrUnbd= CPX_STAT_INForUNBDOptimalInfeas= CPX_STAT_OPTIMAL_INFEASNumBest= CPX_STAT_NUM_BESTFeasibleRelaxedSum= CPX_STAT_FEASIBLE_RELAXED_SUMOptimalRelaxedSum= CPX_STAT_OPTIMAL_RELAXED_SUMFeasibleRelaxedInf= CPX_STAT_FEASIBLE_RELAXED_INFOptimalRelaxedInf<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 605


IloCplex::CplexStatus= CPX_STAT_OPTIMAL_RELAXED_INFFeasibleRelaxedQuad= CPX_STAT_FEASIBLE_RELAXED_QUADOptimalRelaxedQuad= CPX_STAT_OPTIMAL_RELAXED_QUADAbortRelaxed= CPXMIP_ABORT_RELAXEDAbortObjLim= CPX_STAT_ABORT_OBJ_LIMAbortPrimObjLim= CPX_STAT_ABORT_PRIM_OBJ_LIMAbortDualObjLim= CPX_STAT_ABORT_DUAL_OBJ_LIMAbortItLim= CPX_STAT_ABORT_IT_LIMAbortTimeLim= CPX_STAT_ABORT_TIME_LIMAbortUser= CPX_STAT_ABORT_USEROptimalFaceUnbounded= CPX_STAT_OPTIMAL_FACE_UNBOUNDEDOptimalTol= CPXMIP_OPTIMAL_TOLSolLim= CPXMIP_SOL_LIMPopulateSolLim= CPXMIP_POPULATESOL_LIMNodeLimFeas= CPXMIP_NODE_LIM_FEASNodeLimInfeas= CPXMIP_NODE_LIM_INFEASFailFeas= CPXMIP_FAIL_FEAS<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 606


IloCplex::CplexStatusFailInfeas= CPXMIP_FAIL_INFEASMemLimFeas= CPXMIP_MEM_LIM_FEASMemLimInfeas= CPXMIP_MEM_LIM_INFEASFailFeasNoTree= CPXMIP_FAIL_FEAS_NO_TREEFailInfeasNoTree= CPXMIP_FAIL_INFEAS_NO_TREEConflictFeasible= CPX_STAT_CONFLICT_FEASIBLEConflictMinimal= CPX_STAT_CONFLICT_MINIMALConflictAbortContradiction= CPX_STAT_CONFLICT_ABORT_CONTRADICTIONConflictAbortTimeLim= CPX_STAT_CONFLICT_ABORT_TIME_LIMConflictAbortItLim= CPX_STAT_CONFLICT_ABORT_IT_LIMConflictAbortNodeLim= CPX_STAT_CONFLICT_ABORT_NODE_LIMConflictAbortObjLim= CPX_STAT_CONFLICT_ABORT_OBJ_LIMConflictAbortMemLim= CPX_STAT_CONFLICT_ABORT_MEM_LIMConflictAbortUser= CPX_STAT_CONFLICT_ABORT_USERFeasible= CPX_STAT_FEASIBLEOptimalPopulated= CPXMIP_OPTIMAL_POPULATEDOptimalPopulatedTol<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 607


IloCplex::CplexStatus= CPXMIP_OPTIMAL_POPULATED_TOL<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 608


IloCplex::CrossoverCallbackIIloCplex::CrossoverCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedCrossoverCallbackI(IloEnv env)Method Summaryprotected IloIntprotected IloIntprotected IloIntprotected IloIntprotected IloIntgetNdualExchanges() constgetNdualPushes() constgetNprimalExchanges() constgetNprimalPushes() constgetNsuperbasics() constInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 609


IloCplex::CrossoverCallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoConstructorsMethodsAn instance of the class IloCplex::CrossoverCallbackI represents a userwrittencallback in an application that uses an instance of IloCplex to solve a problemby means of the barrier optimizer with the crossover option. An instance of IloCplexcalls this callback regularly during crossover. For details about the crossover option, seethe <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong>.The constructor and methods of this class are protected for use in deriving a user-writtencallback class and in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.IloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::OptimizationCallbackI, ILOCROSSOVERCALLBACK0protected CrossoverCallbackI(IloEnv env)This constructor creates a callback for use in an application with the crossover option ofthe barrier optimizer.protected IloInt getNdualExchanges() constThis method returns the number of dual exchange operations executed so far duringcrossover by the instance of IloCplex that executes the invoking callback.protected IloInt getNdualPushes() constThis method returns the number of dual push operations executed so far duringcrossover by the instance of IloCplex that executes the invoking callback.protected IloInt getNprimalExchanges() constThis method returns the number of primal exchange operations executed so far duringcrossover by the instance of IloCplex that executes the invoking callback.protected IloInt getNprimalPushes() constThis method returns the number of primal push operations executed so far duringcrossover by the instance of IloCplex that executes the invoking callback.protected IloInt getNsuperbasics() constThis method returns the number of super basics currently present in the basis beinggenerated with crossover by the instance of IloCplex that executes the invokingcallback.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 610


IloCplex::CutCallbackIIloCplex::CutCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedCutCallbackI(IloEnv env)Method Summaryprotected IloConstraintprotected IloConstraintadd(IloConstraint con)addLocal(IloConstraint con)Inherited methods from IloCplex::ControlCallbackIControlCallbackI::getDownPseudoCost, ControlCallbackI::getDownPseudoCost,ControlCallbackI::getFeasibilities, ControlCallbackI::getFeasibilities,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getLB, ControlCallbackI::getLB,ControlCallbackI::getLBs, ControlCallbackI::getLBs,ControlCallbackI::getNodeData, ControlCallbackI::getObjValue,ControlCallbackI::getSlack, ControlCallbackI::getSlacks,ControlCallbackI::getUB, ControlCallbackI::getUB,ControlCallbackI::getUBs, ControlCallbackI::getUBs,ControlCallbackI::getUpPseudoCost, ControlCallbackI::getUpPseudoCost,ControlCallbackI::getValue, ControlCallbackI::getValue,ControlCallbackI::getValue, ControlCallbackI::getValues,ControlCallbackI::getValues, ControlCallbackI::isSOSFeasible,ControlCallbackI::isSOSFeasibleInherited methods from IloCplex::MIPCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 611


IloCplex::CutCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::main<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 612


IloCplex::CutCallbackIDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::CutCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a mixed integerprogramming problem (a MIP). This class offers a method to add a local or global cut tothe current node LP subproblem from a user-written callback. More than one cut can beadded in this callback by calling the method add or addLocal multiple times. Alladded cuts must be linear.The constructor and methods of this class are protected for use in deriving a user-writtencallback class and in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.See AlsoConstructorsMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPCallbackI, IloCplex::ControlCallbackI,IloCplex::OptimizationCallbackI, ILOCUTCALLBACK0protected CutCallbackI(IloEnv env)This constructor creates a callback for use in an application with a user-defined cut tosolve a MIP.protected IloConstraint add(IloConstraint con)This method adds a cut to the current node LP subproblem for the constraint specified bycon. This cut must be globally valid; it will not be removed by backtracking or anyother means during the search. The added cut must be linear.protected IloConstraint addLocal(IloConstraint con)This method adds a local cut to the current node LP subproblem for the constraintspecified by con. IloCplex will manage the local cut in such a way that it will beactive only when processing nodes of this subtree. The added cut must be linear.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 613


IloCplex::CutTypeIloCplex::CutTypeCategoryDefinition FileSynopsisDescriptionFieldsInner Enumerationilcplex/ilocplexi.hCutType{CutCover,CutGubCover,CutFlowCover,CutClique,CutFrac,CutMir,CutFlowPath,CutDisj,CutImplBd,CutZeroHalf,CutLocalCover,CutTighten,CutObjDisj,CutUser,CutTable,CutSolnPool};The enumeration IloCplex::CutType lists the values that may be used in queryingthe number of cuts used in a mixed integer optimization with getNcuts().CutCoverCutGubCoverCutFlowCoverCutCliqueCutFracCutMirCutFlowPathCutDisjCutImplBdCutZeroHalfCutLocalCoverCutTightenCutObjDisjCutUserCutTableCutSolnPool<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 614


IloCplex::DeleteModeIloCplex::DeleteModeCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hDeleteMode{LeaveBasis,FixBasis};This enumeration lists the possible settings for the delete mode of IloCplex ascontrolled by the method setDeleteMode and queried by the methodgetDeleteMode.◆ IloCplex::LeaveBasisWith the default setting IloCplex::LeaveBasis, an existing basis will remainunchanged if variables or constraints are removed from the loaded LP model. Thischoice generally renders the basis unusable for a restart when <strong>CPLEX</strong> is solving themodified LP and the advanced indicator (parameter IloCplex::AdvInd) is set toIloTrue.◆ IloCplex::FixBasisIn contrast, with delete mode set to IloCplex::FixBasis, the invoking object willdo basis pivots in order to maintain a valid basis when variables or constraints areremoved. This choice makes the delete operation more computation-intensive, but maygive a better starting point for reoptimization after modification of the extracted model.If no basis is present in the invoking object, the setting of the delete mode has no effect.IloCplexLeaveBasisFixBasis<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 615


IloCplex::DisjunctiveCutCallbackIIloCplex::DisjunctiveCutCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedDisjunctiveCutCallbackI(IloEnv env)Method Summaryprotected IloNumgetProgress() constInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreads<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 616


IloCplex::DisjunctiveCutCallbackIInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoAn instance of the class IloCplex::DisjunctiveCutCallbackI represents auser-written callback in an application that uses an instance of IloCplex to solve amixed integer programming problem (a MIP). This class offers a method to check onthe progress of the generation of disjunctive cuts.The constructor and methods of this class are protected for use in deriving a user-writtencallback class and in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.IloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPCallbackI, IloCplex::OptimizationCallbackI,ILODISJUNCTIVECUTCALLBACK0<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 617


IloCplex::DisjunctiveCutCallbackIConstructorsMethodsprotected DisjunctiveCutCallbackI(IloEnv env)This constructor creates a callback for use in an application where disjunctive cuts aregenerated.protected IloNum getProgress() constThis method returns the fraction of completion of the disjunctive cut generation pass.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 618


IloCplex::DisjunctiveCutInfoCallbackIIloCplex::DisjunctiveCutInfoCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedDisjunctiveCutInfoCallbackI(IloEnv env)Method Summaryprotected IloNumgetProgress() constInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbent<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 619


IloCplex::DisjunctiveCutInfoCallbackIInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoConstructorsMethodsAn instance of the class IloCplex::DisjunctiveCutInfoCallbackIrepresents a user-written callback in an application that uses an instance of IloCplexto solve a mixed integer programming problem (a MIP). This class offers a method tocheck on the progress of the generation of disjunctive cuts.User-written callbacks of this class are compatible with MIP dynamic search.The constructor and methods of this class are protected for use in deriving a user-writtencallback class and in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.IloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPInfoCallbackI, IloCplex::OptimizationCallbackI,ILODISJUNCTIVECUTINFOCALLBACK0protected DisjunctiveCutInfoCallbackI(IloEnv env)This constructor creates a callback for use in an application where disjunctive cuts aregenerated.protected IloNum getProgress() constThis method returns the fraction of completion of the disjunctive cut generation pass.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 620


IloCplex::DualPricingIloCplex::DualPricingCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hDualPricing{DPriIndAuto,DPriIndFull,DPriIndSteep,DPriIndFullSteep,DPriIndSteepQStart,DPriIndDevex};The enumeration IloCplex::DualPricing lists values that the dual pricingparameter IloCplex:DPriInd can assume in IloCplex for use with the dualsimplex algorithm. Use these values with the methodIloCplex::setParam(IloCplex::DPriInd, value) when you set the dualpricing indicator.See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameters and the <strong>ILOG</strong> <strong>CPLEX</strong> User's<strong>Manual</strong> for more information about these parameters. Also see the user's manual forexamples of their use.IloCplexDPriIndAuto= CPX_DPRIIND_AUTODPriIndFull= CPX_DPRIIND_FULLDPriIndSteep= CPX_DPRIIND_STEEPDPriIndFullSteep= CPX_DPRIIND_FULLSTEEPDPriIndSteepQStart= CPX_DPRIIND_STEEPQSTARTDPriIndDevex= CPX_DPRIIND_DEVEX<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 621


IloCplex::ExceptionIloCplex::ExceptionCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summarypublic IloIntException::getStatus() constInherited methods from IloExceptionIloException::end, IloException::getMessageDescriptionMethodsThe class IloCplex::Exception, derived from the nested classIloAlgorithm::Exception, is the base class of exceptions thrown by classesderived from IloCplex.public IloInt getStatus() constThis method returns the <strong>ILOG</strong> <strong>CPLEX</strong> error code of an exception thrown by a memberof IloCplex. These error codes are detailed in the reference manual as the groupoptim.cplex.errorcodes.This method may also return negative values for subclasses ofIloCplex::Exception, which are not listed in the reference manual. The<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 622


IloCplex::Exceptionexceptions listed in the reference manual are always thrown as instances ofIloCplex::Exception and not as an instance of one of its derived classes.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 623


IloCplex::FlowMIRCutCallbackIIloCplex::FlowMIRCutCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedFlowMIRCutCallbackI(IloEnv env)Method Summaryprotected IloNumgetProgress() constInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreads<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 624


IloCplex::FlowMIRCutCallbackIInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoAn instance of the class IloCplex::FlowMIRCutCallbackI represents a userwrittencallback in an application that uses an instance of IloCplex to solve a mixedinteger programming problem (a MIP). This class offers a member function to check onthe progress of the generation of Flow MIR cuts.The constructor and methods of this class are protected for use in deriving a user-writtencallback class and in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.IloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPCallbackI, IloCplex::OptimizationCallbackI,ILOFLOWMIRCUTCALLBACK0<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 625


IloCplex::FlowMIRCutCallbackIConstructorsMethodsprotected FlowMIRCutCallbackI(IloEnv env)This constructor creates a callback for use in an application where flow MIR cuts aregenerated.protected IloNum getProgress() constThis method returns the fraction of completion of the cut generation pass for FlowMIRcuts.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 626


IloCplex::FlowMIRCutInfoCallbackIIloCplex::FlowMIRCutInfoCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedFlowMIRCutInfoCallbackI(IloEnv env)Method Summaryprotected IloNumgetProgress() constInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbent<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 627


IloCplex::FlowMIRCutInfoCallbackIInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoConstructorsMethodsAn instance of the class IloCplex::FlowMIRCutInfoCallbackI represents auser-written callback in an application that uses an instance of IloCplex to solve amixed integer programming problem (a MIP). This class offers a member function tocheck on the progress of the generation of Flow MIR cuts.User-written callbacks of this class are compatible with MIP dynamic search.The constructor and methods of this class are protected for use in deriving a user-writtencallback class and in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.IloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPInfoCallbackI, IloCplex::OptimizationCallbackI,ILOFLOWMIRCUTINFOCALLBACK0protected FlowMIRCutInfoCallbackI(IloEnv env)This constructor creates a callback for use in an application where flow MIR cuts aregenerated.protected IloNum getProgress() constThis method returns the fraction of completion of the cut generation pass for FlowMIRcuts.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 628


IloCplex::FractionalCutCallbackIIloCplex::FractionalCutCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedFractionalCutCallbackI(IloEnv env)Method Summaryprotected IloNumgetProgress() constInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreads<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 629


IloCplex::FractionalCutCallbackIInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoAn instance of the class IloCplex::FractionalCutCallbackI represents auser-written callback in an application that uses an instance of IloCplex to solve amixed integer programming problem (a MIP). This class offers a method to check onthe progress of the generation of fractional cuts.The constructor and methods of this class are protected for use in deriving a user-writtencallback class and in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.IloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPCallbackI, IloCplex::OptimizationCallbackI,ILOFRACTIONALCUTCALLBACK0<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 630


IloCplex::FractionalCutCallbackIConstructorsMethodsprotected FractionalCutCallbackI(IloEnv env)This constructor creates a callback for use in an application where fractional cuts aregenerated.protected IloNum getProgress() constThis method returns the fraction of completion of the fractional cut generation pass.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 631


IloCplex::FractionalCutInfoCallbackIIloCplex::FractionalCutInfoCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedFractionalCutInfoCallbackI(IloEnv env)Method Summaryprotected IloNumgetProgress() constInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbent<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 632


IloCplex::FractionalCutInfoCallbackIInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoConstructorsMethodsAn instance of the class IloCplex::FractionalCutInfoCallbackIrepresents a user-written callback in an application that uses an instance of IloCplexto solve a mixed integer programming problem (a MIP). This class offers a method tocheck on the progress of the generation of fractional cuts.User-written callbacks of this class are compatible with MIP dynamic search.The constructor and methods of this class are protected for use in deriving a user-writtencallback class and in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.IloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPInfoCallbackI, IloCplex::OptimizationCallbackI,ILOFRACTIONALCUTINFOCALLBACK0protected FractionalCutInfoCallbackI(IloEnv env)This constructor creates a callback for use in an application where fractional cuts aregenerated.protected IloNum getProgress() constThis method returns the fraction of completion of the fractional cut generation pass.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 633


IloCplex::GoalIloCplex::GoalCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicpublicpublicpublicpublicGoal(GoalBaseI * goalI)Goal(const Goal & goal)Goal()Goal(IloConstraint cut)Goal(IloConstraintArray cut)Method Summarypublic Goaloperator=(const Goal & goal)DescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.Goals can be used to control the branch & cut search in IloCplex. Goals areimplemented in the class IloCplex::GoalI. This is the handle class for <strong>CPLEX</strong>goals.Goal objects are reference-counted. This means every instance of IloCplex::GoalIkeeps track about how many handle objects refer to it. If this number drops to 0 (zero)the IloCplex::GoalI object is automatically deleted. As a consequence, wheneveryou deal with a goal, you must keep a handle object around, rather than only a pointer tothe implementation object. Otherwise, you risk ending up with a pointer to animplementation object that has already been deleted.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 634


IloCplex::GoalSee Goals among the Concepts in this manual. See also goals in the <strong>ILOG</strong> <strong>CPLEX</strong>User's <strong>Manual</strong>.Constructorspublic Goal(GoalBaseI * goalI)Creates a new goal from a pointer to the implementation object.public Goal(const Goal & goal)This is the copy constructor of the goal.public Goal()Creates a 0 goal handle, that is, a goal with a 0 implementation object pointer. This isalso referred to as an empty goal.public Goal(IloConstraint cut)Creates a new goal that will add the constraint cut as a local cut to the node where thegoal is executed. As a local cut, the constraint will be active only in the subtree rootedat the node where the goal was executed. The lifetime of the constraint passed to a goalis tied to the lifetime of the Goal. That is, the constraint's method end is called whenthe goal's implementation object is deleted. As a consequence, the method end must notbe called for constraints passed to this constructor explicitly.public Goal(IloConstraintArray cut)Creates a new goal that adds the constraints given in the array cut as local cuts to thenode where the goal is executed. As local cuts, the constraints will be active only in thesubtree rooted at the node where the goal was executed. The lifetime of the constraintsand the array passed to a goal is tied to the lifetime of the Goal. That is, the constraint'smethod end is called when the goal's implementation object is deleted. As aconsequence, method end must not be called for the constraints and the array passed tothis constructor explicitly.Methodspublic Goal operator=(const Goal & goal)This is the assignment operator. It increases the reference count of the implementationobject of goal. If the invoking handle referred to an implementation object before theassignment operation, its reference count is decreased. If thereby the reference countbecomes 0, the implementation object is deleted.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 635


IloCplex::GoalIIloCplex::GoalICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicGoalI(IloEnv env)Method Summarypublic voidpublic static IloCplex::Goalpublic static IloCplex::Goalpublic virtualIloCplex::Goalpublic virtualIloCplex::Goalpublic static IloCplex::Goalpublic IloNumpublic IloNumpublic GoalI::BranchTypepublic IloNumpublicIloCplex::BranchDirectionpublicIloCplex::BranchDirectionpublic IloNumpublic IloNumpublic IloEnvpublic voidpublic voidabort()AndGoal(IloCplex::Goal goal1,IloCplex::Goalgoal2)BranchAsCplexGoal(IloEnv env)duplicateGoal()execute()FailGoal(IloEnv env)getBestObjValue() constgetBranch(IloNumVarArray vars,IloNumArraybounds,IloCplex::BranchDirectionArraydirs,IloInt i) constgetBranchType() constgetCutoff() constgetDirection(const IloIntVar var)getDirection(const IloNumVar var)getDownPseudoCost(const IloIntVar var) constgetDownPseudoCost(const IloNumVar var) constgetEnv() constgetFeasibilities(GoalI::IntegerFeasibilityArray stats,const IloIntVarArray vars) constgetFeasibilities(GoalI::IntegerFeasibilityArray stats,const IloNumVarArray vars) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 636


IloCplex::GoalIpublicGoalI::IntegerFeasibilitypublicGoalI::IntegerFeasibilitypublicGoalI::IntegerFeasibilitypublicGoalI::IntegerFeasibilitypublic IloNumpublic IloNumpublic IloNumpublic voidpublic voidpublic IloNumpublic IloNumpublic voidpublic voidpublic IloModelpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloNumpublic IloNumpublic voidpublic voidgetFeasibility(const IloSOS2 sos) constgetFeasibility(const IloSOS1 sos) constgetFeasibility(const IloIntVar var) constgetFeasibility(const IloNumVar var) constgetIncumbentObjValue() constgetIncumbentValue(const IloIntVar var) constgetIncumbentValue(const IloNumVar var) constgetIncumbentValues(IloNumArray val,constIloIntVarArray vars) constgetIncumbentValues(IloNumArray val,constIloNumVarArray vars) constgetLB(const IloIntVar var) constgetLB(const IloNumVar var) constgetLBs(IloNumArray vals,const IloIntVarArrayvars) constgetLBs(IloNumArray vals,const IloNumVarArrayvars) constgetModel() constgetMyThreadNum() constgetNbranches() constgetNcliques() constgetNcols() constgetNcovers() constgetNdisjunctiveCuts() constgetNflowCovers() constgetNflowPaths() constgetNfractionalCuts() constgetNGUBcovers() constgetNimpliedBounds() constgetNiterations() constgetNMIRs() constgetNnodes() constgetNremainingNodes() constgetNrows() constgetObjCoef(const IloIntVar var) constgetObjCoef(const IloNumVar var) constgetObjCoefs(IloNumArray vals,constIloIntVarArray vars) constgetObjCoefs(IloNumArray vals,constIloNumVarArray vars) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 637


IloCplex::GoalIpublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic voidpublic IloNumpublic IloNumpublic voidpublic voidpublic IloNumpublic IloNumpublic IloIntpublic IloNumpublic IloNumpublic IloNumpublic voidpublic voidpublic static IloCplex::Goalpublic static IloCplex::Goalpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic static IloCplex::Goalpublic static IloCplex::Goalpublic static IloCplex::GoalGoalI::getObjValue() constgetPriority(const IloIntVar var) constgetPriority(const IloNumVar var) constgetSlack(const IloRange rng) constgetSlacks(IloNumArray vals,constIloRangeArray rngs) constgetUB(const IloIntVar var) constgetUB(const IloNumVar var) constgetUBs(IloNumArray vals,const IloIntVarArrayvars) constgetUBs(IloNumArray vals,const IloNumVarArrayvars) constgetUpPseudoCost(const IloIntVar var) constgetUpPseudoCost(const IloNumVar var) constgetUserThreads() constgetValue(const IloIntVar var) constgetValue(const IloNumVar var) constgetValue(const IloExpr expr) constgetValues(IloNumArray vals,constIloIntVarArray vars) constgetValues(IloNumArray vals,constIloNumVarArray vars) constGlobalCutGoal(IloConstraintArray con)GlobalCutGoal(IloConstraint con)hasIncumbent() constisIntegerFeasible() constisSOSFeasible(const IloSOS2 sos2) constisSOSFeasible(const IloSOS1 sos1) constOrGoal(IloCplex::Goal goal1,IloCplex::Goalgoal2)SolutionGoal(const IloIntVarArray vars,constIloNumArray vals)SolutionGoal(const IloNumVarArray vars,constIloNumArray vals)Inner EnumerationGoalI::BranchTypeGoalI::IntegerFeasibility<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 638


IloCplex::GoalIInner Type DefGoalI::GoalI::IntegerFeasibilityArrayDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.Goals can be used to control the branch & cut search in IloCplex. Goals areimplemented in subclasses of the class IloCplex::GoalI. This is the base class foruser-written implementation classes of <strong>CPLEX</strong> goals.To implement your own goal you need to create a subclass of IloCplex::GoalI andimplement its pure virtual methods execute and duplicateGoal. You may useone of the ILO<strong>CPLEX</strong>GOAL0 macros to assist you in doing so. After implementingyour goal class, you use an instance of the class by passing it to the solve methodwhen solving the model.The method duplicateGoal may be called by IloCplex to create copies of a goalwhen needed for parallel branch & cut search. Thus the implementation of this methodmust create and return an exact copy of the invoked object itself.The method execute controls the branch & cut search of IloCplex by the goal itreturns. When IloCplex processes a node, it pops the top goal from the node's goalstack and calls method execute of that goal. It continues executing the top goal fromthe stack until the node is deactivated or the goal stack is empty. If the goal stack isempty, IloCplex proceeds with the built-in search strategy for the subtree rooted atthe current node.The class IloCplex::GoalI provides several methods for querying informationabout the current node. The method execute controls how to proceed with the branch& cut search via the goal it returns. The returned goal, unless it is the 0 goal, is pushedon the goal stack and will thus be executed next.See also the chapter about goals in the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong>.Constructorspublic GoalI(IloEnv env)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 639


IloCplex::GoalIThe goal constructor. It requires an instance of the same IloEnv as the IloCplexobject with which to use the goal. The environment can later be queried by callingmethod getEnv.Methodspublic void abort()Abort the optimization, that is, the execution of method solve currently in process.public static IloCplex::Goal AndGoal(IloCplex::Goal goal1,IloCplex::Goal goal2)The static methods AndGoal all return a goal that pushes the goals passed asparameters onto the goal stack in reverse order. As a consequence, the goals will beexecuted in the order they are passed as parameters to the AndGoal function.public static IloCplex::Goal BranchAsCplexGoal(IloEnv env)This static function returns a goal that creates the same branches as the currentlyselected built-in branch strategy of IloCplex would choose at the current node. Thisgoal allows you to proceed with the IloCplex search strategy, but keeps the searchunder goal control, thereby giving you the option to intervene at any point.This goal is also important when you use node evaluators while you use a built-inbranching strategy.For example, consider the execute method of a goal starting like this:if (!isIntegerFeasible())return AndGoal(BranchAsCplexGoal(getEnv()), this);// do somethingIt would do something only when IloCplex found a solution it considers to be acandidate for a new incumbent. Note there is a test of integer feasibility before returningBranchAsCplexGoal. Without the test, BranchAsCplex would be executed for asolution IloCplex considers to be feasible, but IloCplex would not know how tobranch on it. An endless loop would result.public virtual IloCplex::Goal duplicateGoal()This virtual method must be implemented by the user. It must return a copy of theinvoking goal object. This method may be called by IloCplex when doing parallelbranch & cut search.public virtual IloCplex::Goal execute()This virtual method must be implemented by the user to specify the logic of the goal.The instance of IloCplex::Goal returned by this method will be added to the goalstack of the node where the invoking goal is being executed for further execution.public static IloCplex::Goal FailGoal(IloEnv env)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 640


IloCplex::GoalIThis static method creates a goal that fails. That means that the branch where the goal isexecuted will be pruned or, equivalently, the search is discontinued at that node and thenode is discarded.public IloNum getBestObjValue() constThis method returns the currently best known bound on the optimal solution value of theproblem at the time the invoking goal is executed by an instance of IloCplex whilesolving a MIP. When a model has been solved to optimality, this value matches theoptimal solution value. Otherwise, this value is computed for a minimization(maximization) problem as the minimum (maximum) objective function value of allremaining unexplored nodes.public IloNum getBranch(IloNumVarArray vars,IloNumArray bounds,IloCplex::BranchDirectionArray dirs,IloInt i) constThis method accesses branching information for the i-th branch that the invokinginstance of IloCplex is about to create. The parameter i must be between 0 (zero)and getNbranches - 1; that is, it must be a valid index of a branch; normally, itwill be zero or one.A branch is normally defined by a set of variables and the bounds for these variables.Branches that are more complex cannot be queried. The return value is the node estimatefor that branch.◆◆The parameter vars contains the variables for which new bounds will be set in thei-th branch.The parameter bounds contains the new bounds for the variables listed in vars;that is, bounds[j] is the new bound for vars[j].◆ The parameter dirs specifies the branching direction for the variables in vars.dir[j] == IloCplex::BranchUpmeans that bounds[j] specifies a lower bound for vars[j].dirs[j] == IloCplex::BranchDownmeans that bounds[j] specifies an upper bound for vars[j].public GoalI::BranchType getBranchType() constThis method returns the type of branchingnode.public IloNum getCutoff() constIloCplex is going to do for the currentThe method returns the current cutoff value. An instance of IloCplex uses the cutoffvalue (the value of the objective function of the subproblem at a node in the search tree)to decide when to prune nodes from the search tree (that is, when to cut off that node<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 641


IloCplex::GoalIand discard the nodes beyond it). The cutoff value is updated whenever a new incumbentis found.public IloCplex::BranchDirection getDirection(const IloIntVar var)This method returns the branch direction previously assigned to variable var withmethod IloCplex::setDirection or IloCplex::setDirections. Ifnodirection has been assigned, IloCplex::BranchGlobal will be returned.public IloCplex::BranchDirection getDirection(const IloNumVar var)This method returns the branch direction previously assigned to variable var withmethod IloCplex::setDirection or IloCplex::setDirections. Ifnodirection has been assigned, IloCplex::BranchGlobal will be returned.public IloNum getDownPseudoCost(const IloIntVar var) constThis method returns the current pseudo cost for branching downward on the variablevar.public IloNum getDownPseudoCost(const IloNumVar var) constThis method returns the current pseudo cost for branching downward on the variablevar.public IloEnv getEnv() constReturns the instance of IloEnv passed to the constructor of the goal.public void getFeasibilities(GoalI::IntegerFeasibilityArray stats,const IloIntVarArray vars) constThis method considers whether each of the variables in the array vars is integerfeasible, integer infeasible, or implied integer feasible and puts the status in thecorresponding element of the array stats.public void getFeasibilities(GoalI::IntegerFeasibilityArray stats,const IloNumVarArray vars) constThis method considers whether each of the variables in the array vars is integerfeasible, integer infeasible, or implied integer feasible and puts the status in thecorresponding element of the array stats.public GoalI::IntegerFeasibility getFeasibility(const IloSOS2 sos) constThis method specifies whether the SOS sos is integer feasible, integer infeasible, orimplied integer feasible in the current node solution.public GoalI::IntegerFeasibility getFeasibility(const IloSOS1 sos) constThis method specifies whether the SOS sos is integer feasible, integer infeasible, orimplied integer feasible in the current node solution.public GoalI::IntegerFeasibility getFeasibility(const IloIntVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 642


IloCplex::GoalIThis method specifies whether the variable var is integer feasible, integer infeasible, orimplied integer feasible in the current node solution.public GoalI::IntegerFeasibility getFeasibility(const IloNumVar var) constThis method specifies whether the variable var is integer feasible, integer infeasible, orimplied integer feasible in the current node solution.public IloNum getIncumbentObjValue() constThis method returns the value of the objective function of the incumbent solution (thatis, the best integer solution found so far). If there is no incumbent, this method throws anexception.public IloNum getIncumbentValue(const IloIntVar var) constThis method returns the value of var in the incumbent solution. If there is noincumbent, this method throws an exception.public IloNum getIncumbentValue(const IloNumVar var) constThis method returns the value of var in the incumbent solution. If there is noincumbent, this method throws an exception.public void getIncumbentValues(IloNumArray val,const IloIntVarArray vars) constReturns the value of each variable in the array vars with respect to the currentincumbent solution, and it puts those values into the corresponding array vals. Ifthere is no incumbent, this method throws an exception.public void getIncumbentValues(IloNumArray val,const IloNumVarArray vars) constReturns the value of each variable in the array vars with respect to the currentincumbent solution, and it puts those values into the corresponding array vals. Ifthere is no incumbent, this method throws an exception.public IloNum getLB(const IloIntVar var) constThis method returns the lower bound of var in the current node relaxation. This boundis likely to be different from the bound in the original model because an instance ofIloCplex tightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks a lower bound, then getLB returns a value greater than or equal to -IloInfinity for greater than or equal to constraints with no lower bound.public IloNum getLB(const IloNumVar var) constThis method returns the lower bound of var in the current node relaxation. This boundis likely to be different from the bound in the original model because an instance ofIloCplex tightens bounds when it branches from a node to its subnodes.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 643


IloCplex::GoalIUnbounded VariablesIf a variable lacks a lower bound, then getLB returns a value greater than or equal to -IloInfinity for greater than or equal to constraints with no lower bound.public void getLBs(IloNumArray vals,const IloIntVarArray vars) constThis method puts the lower bound in the current node relaxation of each element of thearray vars into the corresponding element of the array vals. These bounds are likelyto be different from the bounds in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks a lower bound, then getLBs returns a value greater than or equal to-IloInfinity for greater than or equal to constraints with no lower bound.public void getLBs(IloNumArray vals,const IloNumVarArray vars) constThis method puts the lower bound in the current node relaxation of each element of thearray vars into the corresponding element of the array vals. These bounds are likelyto be different from the bounds in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks a lower bound, then getLBs returns a value greater than or equal to-IloInfinity for greater than or equal to constraints with no lower bound.public IloModel getModel() constThis method returns the model currently extracted for the instance of IloCplex wherethe invoking goal applies.public IloInt getMyThreadNum() constReturns the identifier of the parallel thread being currently executed. This number isbetween 0 (zero) and the value returned by the method getUserThreads()-1.public IloInt getNbranches() constThis method returns the number of branches IloCplex is going to create at the currentnode.public IloInt getNcliques() constReturns the total number of clique cuts that have been added to the model so far duringthe current optimization.public IloInt getNcols() constThis method returns the number of columns in the current optimization model.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 644


IloCplex::GoalIpublic IloInt getNcovers() constReturns the total number of cover cuts that have been added to the model so far duringthe current optimization.public IloInt getNdisjunctiveCuts() constReturns the total number of disjunctive cuts that have been added to the model so farduring the current optimization.public IloInt getNflowCovers() constReturns the total number of flow cover cuts that have been added to the model so farduring the current optimization.public IloInt getNflowPaths() constReturns the total number of flow path cuts that have been added to the model so farduring the current optimization.public IloInt getNfractionalCuts() constReturns the total number of fractional cuts that have been added to the model so farduring the current optimization.public IloInt getNGUBcovers() constReturns the total number of GUB cover cuts that have been added to the model so farduring the current optimization.public IloInt getNimpliedBounds() constReturns the total number of implied bound cuts that have been added to the model so farduring the current optimization.public IloInt getNiterations() constReturns the total number of iterations executed so far during the current optimization tosolve the node relaxations.public IloInt getNMIRs() constReturns the total number of MIR cuts that have been added to the model so far duringthe current optimization.public IloInt getNnodes() constThis method returns the number of nodes already processed in the current optimization.public IloInt getNremainingNodes() constThis method returns the number of nodes left to explore in the current optimization.public IloInt getNrows() constThis method returns the number of rows in the current optimization model.public IloNum getObjCoef(const IloIntVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 645


IloCplex::GoalIReturns the linear objective coefficient for var in the model currently being solved.public IloNum getObjCoef(const IloNumVar var) constReturns the linear objective coefficient for var in the model currently being solved.public void getObjCoefs(IloNumArray vals,const IloIntVarArray vars) constThis method puts the linear objective coefficient of each of the variables in the arrayvars into the corresponding element of the array vals.public void getObjCoefs(IloNumArray vals,const IloNumVarArray vars) constThis method puts the linear objective coefficient of each of the variables in the arrayvars into the corresponding element of the array vals.public IloNum getObjValue() constThis method returns the objective value of the solution of the current node.If you need the object representing the objective itself, consider the methodgetObjective instead.public IloNum getPriority(const IloIntVar var) constReturns the branch priority used for variable var in the current optimization.public IloNum getPriority(const IloNumVar var) constReturns the branch priority used for variable var in the current optimization.public IloNum getSlack(const IloRange rng) constThis method returns the slack value for the constraint specified by rng in the solutionof the current node relaxation.public void getSlacks(IloNumArray vals,const IloRangeArray rngs) constThis method puts the slack value in the solution of the current node relaxation of eachof the constraints in the array of ranges rngs into the corresponding element of thearray vals.public IloNum getUB(const IloIntVar var) constThis method returns the upper bound of the variable var in the current node relaxation.This bound is likely to be different from the bound in the original model because aninstance of IloCplex tightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks an upper bound, then getUB returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.public IloNum getUB(const IloNumVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 646


IloCplex::GoalIThis method returns the upper bound of the variable var in the current node relaxation.This bound is likely to be different from the bound in the original model because aninstance of IloCplex tightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks an upper bound, then getUB returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.public void getUBs(IloNumArray vals,const IloIntVarArray vars) constThis method puts the upper bound in the current node relaxation of each element of thearray vars into the corresponding element of the array vals. These bounds are likelyto be different from the bounds in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks an upper bound, then getUBs returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.public void getUBs(IloNumArray vals,const IloNumVarArray vars) constThis method puts the upper bound in the current node relaxation of each element of thearray vars into the corresponding element of the array vals. These bounds are likelyto be different from the bounds in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks an upper bound, then getUBs returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.public IloNum getUpPseudoCost(const IloIntVar var) constThis method returns the current pseudo cost for branching upward on the variable var.public IloNum getUpPseudoCost(const IloNumVar var) constThis method returns the current pseudo cost for branching upward on the variable var.public IloInt getUserThreads() constThis method returns the total number of parallel threads currently running.public IloNum getValue(const IloIntVar var) constThis method returns the value of the variable var in the solution of the current noderelaxation.public IloNum getValue(const IloNumVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 647


IloCplex::GoalIThis method returns the value of the variable var in the solution of the current noderelaxation.public IloNum getValue(const IloExpr expr) constThis method returns the value of the expression expr in the solution of the current noderelaxation.public void getValues(IloNumArray vals,const IloIntVarArray vars) constThis method puts the current node relaxation solution value of each variable in the arrayvars into the corresponding element of the array vals.public void getValues(IloNumArray vals,const IloNumVarArray vars) constThis method puts the current node relaxation solution value of each variable in the arrayvars into the corresponding element of the array vals.public static IloCplex::Goal GlobalCutGoal(IloConstraintArray con)This method creates a goal that when executed adds the constraints (provided in theparamter array con) as global cuts to the model. These global cuts must be valid for theentire model, not only for the current subtree. In other words, these global cuts will berespected at every node.IloCplex takes over memory managment for the cuts passed to the methodGlobalCutGoal. Thus IloCplex will call the method end as soon as it can bediscarded after the goal executes. Calling end yourself or the constraints in the arraycon passed to method GlobalCutGoal or the array itself is an error and must beavoided.public static IloCplex::Goal GlobalCutGoal(IloConstraint con)This method creates a goal that when executed adds the constraint con (provided as aparameter) as global cuts to the model. These global cuts must be valid for the entiremodel, not only for the current subtree. In other words, these global cuts will berespected at every node.IloCplex takes over memory managment for the cut passed to the methodGlobalCutGoal. Thus IloCplex will call the method end as soon as it can bediscarded after the goal executes. Calling end yourself for the constraint passed tomethod GlobalCutGoal is an error and must be avoided.public IloBool hasIncumbent() constThis method returns IloTrue if an integer feasible solution has been found.public IloBool isIntegerFeasible() constThis method returns IloTrue if the solution of the current node is integer feasible.public IloBool isSOSFeasible(const IloSOS2 sos2) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 648


IloCplex::GoalIThis method returns IloTrue if the solution of the current node is SOS feasible for thespecial ordered set specified in its argument. The SOS passed as a parameter to thismethod must be of type 2; the equivalent method for an SOS of type 1 is also available.See the User's <strong>Manual</strong> for more about these types of special ordered sets.public IloBool isSOSFeasible(const IloSOS1 sos1) constThis method returns IloTrue if the solution of the current node is SOS feasible for thespecial ordered set specified in its argument. The SOS passed as a parameter to thismethod must be of type 1; the equivalent method for an SOS of type 2 is also available.See the User's <strong>Manual</strong> for more about these types of special ordered sets.public static IloCplex::Goal OrGoal(IloCplex::Goal goal1,IloCplex::Goal goal2)The static methods OrGoal all return a goal that creates as many branches (or,equivalently, subproblems) as there are parameters. Each of the subnodes will beinitialized with the remaining goal stack of the current node. In addition, the goalparameter will be pushed on the goal stack of the corresponding subgoal. If more thansix branches need to be created, instances of OrGoal can be combined.public static IloCplex::Goal SolutionGoal(const IloIntVarArray vars,const IloNumArray vals)This static method creates and returns a goal that attempts to inject a solution specifiedby setting the variables listed in array vars to the corresponding values listed in thearray vals.IloCplex will not blindly accept such a solution as a new incumbent. Instead, it willmake sure that this solution is compatible with both the model and the goals. Whenchecking feasibility with goals, it checks feasibility with both the goals that have alreadybeen executed and the goals that are still on the goal stack. Thus, in particular,IloCplex will reject any solution that is not compatible with the branching that hasbeen done so far.IloCplex takes over memory managment for arrays vars and vals passed toSolutionGoal. Thus IloCplex will call method end for these arrays as soon asthey can be discarded. Calling end for the arrays passed to SolutionGoal is anerror and must be avoided.public static IloCplex::Goal SolutionGoal(const IloNumVarArray vars,const IloNumArray vals)This static method creates and returns a goal that attempts to inject a solution specifiedby setting the variables listed in array vars to the corresponding values listed in thearray vals.IloCplex will not blindly accept such a solution as a new incumbent. Instead, it willmake sure that this solution is compatible with both the model and the goals. Whenchecking feasibility with goals, it checks feasibility with both the goals that have already<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 649


IloCplex::GoalIbeen executed and the goals that are still on the goal stack. Thus, in particular,IloCplex will reject any solution that is not compatible with the branching that hasbeen done so far.IloCplex takes over memory managment for arrays vars and vals passed toSolutionGoal. Thus IloCplex will call method end for these arrays as soon asthey can be discarded. Calling end for the arrays passed to SolutionGoal is anerror and must be avoided.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 650


GoalI::BranchTypeGoalI::BranchTypeCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hBranchType{BranchOnVariable,BranchOnSOS1,BranchOnSOS2,BranchOnAny,UserBranch};IloCplex::GoalI::BranchType is an enumeration limited in scope to the classIloCplex::GoalI. This enumeration is used by the methodIloCplex::GoalI::getBranchType to tell what kind of branch IloCplex isabout to make:◆◆BranchOnVariable specifies branching on a single variable.BranchOnAny specifies multiple bound changes and constraints will be used forbranching.◆ BranchOnSOS1 specifies branching on an SOS of type 1.◆ BranchOnSOS2 specifies branching on an SOS of type 2.IloCplex::GoalIBranchOnVariable= CPX_TYPE_VARBranchOnSOS1= CPX_TYPE_SOS1BranchOnSOS2= CPX_TYPE_SOS2BranchOnAny= CPX_TYPE_ANYUserBranch<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 651


GoalI::IntegerFeasibilityGoalI::IntegerFeasibilityCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hIntegerFeasibility{ImpliedInfeasible,Feasible,Infeasible,ImpliedFeasible};The enumeration IloCplex::GoalI::IntegerFeasibility is anenumeration limited in scope to the class IloCplex::GoalI. This enumeration isused by IloCplex::GoalI::getFeasibility to access the integer feasibilityof a variable or SOS in the current node solution:◆◆◆Feasible specifies the variable or SOS is integer feasible.ImpliedFeasible specifies the variable or SOS has been presolved out. It willbe feasible when all other integer variables or SOS are integer feasible.Infeasible specifies the variable or SOS is integer infeasible.IloCplex, GoalI::IntegerFeasibilityArray,ControlCallbackI::IntegerFeasibilityImpliedInfeasibleFeasible= CPX_INTEGER_FEASIBLEInfeasible= CPX_INTEGER_INFEASIBLEImpliedFeasible= CPX_IMPLIED_INTEGER_FEASIBLE<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 652


GoalI::IntegerFeasibilityArrayGoalI::IntegerFeasibilityArrayCategoryDefinition FileSynopsisDescriptionSee AlsoInner Type Definitionilcplex/ilocplexi.hIloArray< IntegerFeasibility > IntegerFeasibilityArrayThis type defines an array type for IloCplex::GoalI::IntegerFeasibility.The fully qualified name of an integer feasibility array isIloCplex::GoalI::IntegerFeasibilityArray.IloCplex, GoalI::IntegerFeasibility<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 653


IloCplex::HeuristicCallbackIIloCplex::HeuristicCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod SummaryprotectedIloCplex::CplexStatusprotectedIloAlgorithm::Statusprotected IloBoolprotected IloBoolprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected IloBoolgetCplexStatus() constgetStatus() constisDualFeasible() constisPrimalFeasible() constsetBounds(const IloIntVarArray var,constIloNumArray lb,const IloNumArray ub)setBounds(const IloNumVarArray var,constIloNumArray lb,const IloNumArray ub)setBounds(const IloIntVar var,IloNumlb,IloNum ub)setBounds(const IloNumVar var,IloNumlb,IloNum ub)setSolution(const IloIntVarArray vars,constIloNumArray vals,IloNum obj)setSolution(const IloIntVarArray vars,constIloNumArray vals)setSolution(const IloNumVarArray vars,constIloNumArray vals,IloNum obj)setSolution(const IloNumVarArray vars,constIloNumArray vals)solve(IloCplex::Algorithm alg=Dual)Inherited methods from IloCplex::ControlCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 654


IloCplex::HeuristicCallbackIControlCallbackI::getDownPseudoCost, ControlCallbackI::getDownPseudoCost,ControlCallbackI::getFeasibilities, ControlCallbackI::getFeasibilities,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getLB, ControlCallbackI::getLB,ControlCallbackI::getLBs, ControlCallbackI::getLBs,ControlCallbackI::getNodeData, ControlCallbackI::getObjValue,ControlCallbackI::getSlack, ControlCallbackI::getSlacks,ControlCallbackI::getUB, ControlCallbackI::getUB,ControlCallbackI::getUBs, ControlCallbackI::getUBs,ControlCallbackI::getUpPseudoCost, ControlCallbackI::getUpPseudoCost,ControlCallbackI::getValue, ControlCallbackI::getValue,ControlCallbackI::getValue, ControlCallbackI::getValues,ControlCallbackI::getValues, ControlCallbackI::isSOSFeasible,ControlCallbackI::isSOSFeasibleInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbent<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 655


IloCplex::HeuristicCallbackIInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::HeuristicCallbackI represents a userwrittencallback in an application that uses an instance of IloCplex to solve a mixedinteger programming problem (MIP). When you derive a user-defined class ofcallbacks, this class offers protected methods for you to:◆◆◆◆◆give the instance of IloCplex a potential new incumbent solution;query the instance of IloCplex about the solution status for the current node;query the instance of IloCplex about the variable bounds at the current node;change bounds temporarily on a variable or group of variables at the current node;re-solve the problem at the node with the changed bounds;◆ use all the query functions inherited from parent classes.During branching, the heuristic callback is called after each node subproblem has beensolved, including any cuts that may have been newly generated. Before branching, at theroot node, the heuristic callback is also called before each round of cuts is added to theproblem and re-solved.In short, this callback allows you to attempt to construct an integer feasible solution at anode and pass it to the invoking instance of IloCplex to use as its new incumbent.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 656


IloCplex::HeuristicCallbackIThe <strong>API</strong> supports you in finding such a solution by allowing you iteratively to changebounds of the variables and re-solve the node relaxation. Changing the bounds in theheuristic callback has no effect on the search beyond the termination of the callback.If an attempt is made to access information not available at the node for the invokinginstance of IloCplex, an exception is thrown.See AlsoMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::ControlCallbackI, IloCplex::MIPCallbackI,IloCplex::OptimizationCallbackI, ILOHEURISTICCALLBACK0protected IloCplex::CplexStatus getCplexStatus() constThis method returns the <strong>ILOG</strong> <strong>CPLEX</strong> status of the instance of IloCplex at thecurrent node (that is, the state of the optimizer at the node) during the last call tosolve (which may have been called directly in the callback or by IloCplex whenprocessing the node).The enumeration IloCplex::CplexStatus lists the possible status values.protected IloAlgorithm::Status getStatus() constThis method returns the status of the solution found by the instance of IloCplex at thecurrent node during the last call to solve (which may have been called directly in thecallback or by IloCplex when processing the node).The enumeration IloAlgorithm::Status lists the possible status values.protected IloBool isDualFeasible() constThis method returns IloTrue if the solution provided by the last solve call is dualfeasible. Note that an IloFalse return value does not necessarily mean that thesolution is not dual feasible. It simply means that the relevant algorithm was not able toconclude it was dual feasible when it terminated.protected IloBool isPrimalFeasible() constThis method returns IloTrue if the solution provided by the last solve call is primalfeasible. Note that an IloFalse return value does not necessarily mean that thesolution is not primal feasible. It simply means that the relevant algorithm was not ableto conclude it was primal feasible when it terminated.protected void setBounds(const IloIntVarArray var,const IloNumArray lb,const IloNumArray ub)For each variable in the array var, this method sets its upper bound to thecorresponding value in the array ub and its lower bound to the corresponding value inthe array lb, provided var has not been removed by presolve. Setting bounds has noeffect beyond the scope of the current invocation of the callback.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 657


IloCplex::HeuristicCallbackIWhen using this method, you must avoid changing the bounds of a variable that hasbeen removed by presolve. To check whether presolve is off, consider the parameterIloCplex::PreInd. Alternatively, you can check whether a particular variable hasbeen removed by presolve by checking the status of the variable. To do so, callIloCplex::ControlCallback::getFeasibilities. A variable that hasbeen removed by presolve will have the status ImpliedFeasible.protected void setBounds(const IloNumVarArray var,const IloNumArray lb,const IloNumArray ub)For each variable in the array var, this method sets its upper bound to thecorresponding value in the array ub and its lower bound to the corresponding value inthe array lb, provided the variable has not been removed by presolve. Setting boundshas no effect beyond the scope of the current invocation of the callback.protected void setBounds(const IloIntVar var,IloNum lb,IloNum ub)This method sets the lower bound to lb and the upper bound to ub for the variable varat the current node, provided var has not been removed by presolve. Setting boundshas no effect beyond the scope of the current invocation of the callback.When using this method, you must avoid changing the bounds of a variable that hasbeen removed by presolve. To check whether presolve is off, consider the parameterIloCplex::PreInd. Alternatively, you can check whether a particular variable hasbeen removed by presolve by checking the status of the variable. To do so, callIloCplex::ControlCallback::getFeasibilities. A variable that hasbeen removed by presolve will have the status ImpliedFeasible.protected void setBounds(const IloNumVar var,IloNum lb,IloNum ub)This method sets the lower bound to lb and the upper bound to ub for the variable varat the current node, provided var has not been removed by presolve. Setting boundshas no effect beyond the scope of the current invocation of the callback.When using this method, you must avoid changing the bounds of a variable that hasbeen removed by presolve. To check whether presolve is off, consider the parameterIloCplex::PreInd. Alternatively, you can check whether a particular variable hasbeen removed by presolve by checking the status of the variable. To do so, callIloCplex::ControlCallback::getFeasibilities. A variable that hasbeen removed by presolve will have the status ImpliedFeasible.protected void setSolution(const IloIntVarArray vars,const IloNumArray vals,IloNum obj)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 658


IloCplex::HeuristicCallbackIFor each variable in the array vars, this method uses the value in the correspondingelement of the array vals to define a heuristic solution to be considered as a newincumbent.If the user heuristic was successful in finding a new candidate for an incumbent,setSolution can be used to pass it over to IloCplex. IloCplex then analysesthe solution and, if it is both feasible and better than the current incumbent, uses it asthe new incumbent. A solution is specified using arrays vars and vals, wherevals[i] specifies the solution value for vars[i].The parameter obj is used to tell IloCplex the objective value of the injectedsolution. This allows IloCplex to skip the computation of that value, but care mustbe taken not to provide an incorrect value.Do not call this method multiple times. Calling it again will overwrite any previouslyspecified solution.protected void setSolution(const IloIntVarArray vars,const IloNumArray vals)For each variable in the array vars, this method uses the value in the correspondingelement of the array vals to define a heuristic solution to be considered as a newincumbent.If the user heuristic was successful in finding a new candidate for an incumbent,setSolution can be used to pass it over to IloCplex. IloCplex then analysesthe solution and, if it is both feasible and better than the current incumbent, uses it asthe new incumbent. A solution is specified using arrays vars and vals, wherevals[i] specifies the solution value for vars[i].Do not call this method multiple times. Calling it again will overwrite any previouslyspecified solution.protected void setSolution(const IloNumVarArray vars,const IloNumArray vals,IloNum obj)For each variable in the array vars, this method uses the value in the correspondingelement of the array vals to define a heuristic solution to be considered as a newincumbent.If the user heuristic was successful in finding a new candidate for an incumbent,setSolution can be used to pass it over to IloCplex. IloCplex then analysesthe solution and, if it is both feasible and better than the current incumbent, uses it asthe new incumbent. A solution is specified using arrays vars and vals, wherevals[i] specifies the solution value for vars[i].The parameter obj is used to tell IloCplex the objective value of the injectedsolution. This allows IloCplex to skip the computation of that value, but care mustbe taken not to provide an incorrect value.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 659


IloCplex::HeuristicCallbackIDo not call this method multiple times. Calling it again will overwrite any previouslyspecified solution.protected void setSolution(const IloNumVarArray vars,const IloNumArray vals)For each variable in the array vars, this method uses the value in the correspondingelement of the array vals to define a heuristic solution to be considered as a newincumbent.If the user heuristic was successful in finding a new candidate for an incumbent,setSolution can be used to pass it over to IloCplex. IloCplex then analysesthe solution and, if it is both feasible and better than the current incumbent,IloCplex uses it as the new incumbent. A solution is specified using arrays varsand vals, where vals[i] specifies the solution value for vars[i].Do not call this method multiple times. Calling it again will overwrite any previouslyspecified solution.protected IloBool solve(IloCplex::Algorithm alg=Dual)This method can be used to solve the current node relaxation, usually after some boundshave been changed by setBounds. By default it uses the dual simplex algorithm,but this behavior can be overridden by the optional parameter alg. See theenumeration IloCplex::Algorithm for a list of the available optimizers.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 660


IloCplex::IncumbentCallbackIIloCplex::IncumbentCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summaryprotected NodeData *protected NodeIdprotected IloNumprotected IloNumprotected voidprotected IloNumprotected IloNumprotected IloNumprotected voidprotected voidprotected voidgetNodeData() constgetNodeId() constIncumbentCallbackI::getObjValue() constgetSlack(const IloRange rng) constgetSlacks(IloNumArray val,constIloRangeArray con) constgetValue(const IloIntVar var) constgetValue(const IloNumVar var) constgetValue(const IloExprArg expr) constgetValues(IloNumArray val,constIloIntVarArray vars) constgetValues(IloNumArray val,constIloNumVarArray vars) constreject()Inherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 661


IloCplex::IncumbentCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.This callback is called whenever a new potential incumbent is found during branch &cut searches. It allows you to analyze the proposed incumbent and optionally reject it. Inthis case, <strong>CPLEX</strong> will continue the branch & cut search. This callback is thus typicallycombined with a branch callback that instructs <strong>CPLEX</strong> how to branch on a node after ithas found a potential incumbent and thus considered the node solution to be integerfeasible.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 662


IloCplex::IncumbentCallbackISee AlsoMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPCallbackI, IloCplex::OptimizationCallbackI,ILOINCUMBENTCALLBACK0protected NodeData * getNodeData() constThis method retrieves the NodeData object that may have previously been assigned tothe current node by the user with methodIloCplex::BranchCallbackI::makeBranch. If no data object has beenassigned to the current node, 0 will be returned.protected NodeId getNodeId() constThis method returns the NodeId of the current node.protected IloNum getObjValue() constThis method returns the query objective value of the potential incumbent.If you need the object representing the objective itself, consider the methodgetObjective instead.protected IloNum getSlack(const IloRange rng) constThis method returns the slack value for the range specified by rng for the potentialincumbent.protected void getSlacks(IloNumArray val,const IloRangeArray con) constThis method puts the slack value for each range in the array of ranges con into thecorresponding element of the array val for the potential incumbent. For this <strong>CPLEX</strong>resizes array val to match the size of array con.protected IloNum getValue(const IloIntVar var) constThis method returns the query value of the variable var in the potential incumbentsolution.protected IloNum getValue(const IloNumVar var) constThis method returns the value of the variable var in the potential incumbent solution.protected IloNum getValue(const IloExprArg expr) constThis method returns the value of the expr for the potential incumbent solution.protected void getValues(IloNumArray val,const IloIntVarArray vars) constThis method returns the query values of the variables in the array vars in the potentialincumbent solution and copies them to val. <strong>CPLEX</strong> automatically resizes the arrayval to match the size of the array vars.protected void getValues(IloNumArray val,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 663


IloCplex::IncumbentCallbackIconst IloNumVarArray vars) constThis method returns the query values of the variables in the array vars in the potentialincumbent solution and copies them to val. <strong>CPLEX</strong> automatically resizes the arrayval to match the length of the array vars.protected void reject()This method rejects the proposed incumbent.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 664


IloCplex::IntParamIloCplex::IntParamCategoryDefinition FileSynopsisInner Enumerationilcplex/ilocplexi.hIntParam{AdvInd,RootAlg,NodeAlg,MIPEmphasis,AggFill,AggInd,BasInterval,ClockType,CraInd,DepInd,PreDual,PrePass,RelaxPreInd,RepeatPresolve,Symmetry,DPriInd,PriceLim,SimDisplay,ItLim,NetFind,PerLim,PPriInd,ReInv,ScaInd,Threads,ParallelMode,SingLim,Reduce,NzReadLim,ColReadLim,RowReadLim,QPNzReadLim,SiftDisplay,SiftAlg,SiftItLim,BrDir,Cliques,CoeRedInd,Covers,MIPDisplay,MIPInterval,IntSolLim,NodeFileInd,NodeLim,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 665


IloCplex::IntParamNodeSel,VarSel,BndStrenInd,HeurFreq,RINSHeur,FPHeur,RepairTries,SubMIPNodeLim,MIPOrdType,BBInterval,FlowCovers,ImplBd,Probe,GUBCovers,StrongCandLim,StrongItLim,FracCand,FracCuts,FracPass,PreslvNd,FlowPaths,MIRCuts,DisjCuts,ZeroHalfCuts,AggCutLim,CutPass,EachCutLim,DiveType,MIPSearch,MIQCPStrat,SolnPoolCapacity,SolnPoolReplace,SolnPoolIntensity,PopulateLim,BarAlg,BarColNz,BarDisplay,BarItLim,BarMaxCor,BarOrder,BarCrossAlg,BarStartAlg,NetItLim,NetPPriInd,NetDisplay,ConflictDisplay,FeasOptMode,TuningMeasure,TuningRepeat,TuningDisplay};<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 666


IloCplex::IntParamDescriptionSee AlsoFieldsIloCplex is the class for the <strong>CPLEX</strong> algorithms in <strong>ILOG</strong> <strong>CPLEX</strong>. The enumerationIloCplex::IntParam lists the parameters of <strong>CPLEX</strong> that require integer values.Use these values with the methods IloCplex::getParam andIloCplex::setParam.See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameters and the <strong>ILOG</strong> <strong>CPLEX</strong> User's<strong>Manual</strong> for more information about these parameters. Also see the user's manual forexamples of their use.IloCplexAdvInd= CPX_PARAM_ADVINDRootAlg= CPX_PARAM_STARTALG, CPX_PARAM_LPMETHOD,CPX_PARAM_QPMETHODNodeAlg= CPX_PARAM_SUBALGMIPEmphasis= CPX_PARAM_MIPEMPHASISAggFill= CPX_PARAM_AGGFILLAggInd= CPX_PARAM_AGGINDBasInterval= CPX_PARAM_BASINTERVALClockType= CPX_PARAM_CLOCKTYPECraInd= CPX_PARAM_CRAINDDepInd= CPX_PARAM_DEPINDPreDual= CPX_PARAM_PREDUALPrePass= CPX_PARAM_PREPASS<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 667


IloCplex::IntParamRelaxPreInd= CPX_PARAM_RELAXPREINDRepeatPresolve= CPX_PARAM_REPEATPRESOLVESymmetry= CPX_PARAM_SYMMETRYDPriInd= CPX_PARAM_DPRIINDPriceLim= CPX_PARAM_PRICELIMSimDisplay= CPX_PARAM_SIMDISPLAYItLim= CPX_PARAM_ITLIMNetFind= CPX_PARAM_NETFINDPerLim= CPX_PARAM_PERLIMPPriInd= CPX_PARAM_PPRIINDReInv= CPX_PARAM_REINVScaInd= CPX_PARAM_SCAINDThreads= CPX_PARAM_THREADSParallelMode= CPX_PARAM_PARALLELMODESingLim= CPX_PARAM_SINGLIMReduce= CPX_PARAM_REDUCENzReadLim<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 668


IloCplex::IntParam= CPX_PARAM_NZREADLIMColReadLim= CPX_PARAM_COLREADLIMRowReadLim= CPX_PARAM_ROWREADLIMQPNzReadLim= CPX_PARAM_QPNZREADLIMSiftDisplay= CPX_PARAM_SIFTDISPLAYSiftAlg= CPX_PARAM_SIFTALGSiftItLim= CPX_PARAM_SIFTITLIMBrDir= CPX_PARAM_BRDIRCliques= CPX_PARAM_CLIQUESCoeRedInd= CPX_PARAM_COEREDINDCovers= CPX_PARAM_COVERSMIPDisplay= CPX_PARAM_MIPDISPLAYMIPInterval= CPX_PARAM_MIPINTERVALIntSolLim= CPX_PARAM_INTSOLLIMNodeFileInd= CPX_PARAM_NODEFILEINDNodeLim= CPX_PARAM_NODELIMNodeSel= CPX_PARAM_NODESEL<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 669


IloCplex::IntParamVarSel= CPX_PARAM_VARSELBndStrenInd= CPX_PARAM_BNDSTRENINDHeurFreq= CPX_PARAM_HEURFREQRINSHeur= CPX_PARAM_RINSHEURFPHeur= CPX_PARAM_FPHEURRepairTries= CPX_PARAM_REPAIRTRIESSubMIPNodeLim= CPX_PARAM_SUBMIPNODELIMMIPOrdType= CPX_PARAM_MIPORDTYPEBBInterval= CPX_PARAM_BBINTERVALFlowCovers= CPX_PARAM_FLOWCOVERSImplBd= CPX_PARAM_IMPLBDProbe= CPX_PARAM_PROBEGUBCovers= CPX_PARAM_GUBCOVERSStrongCandLim= CPX_PARAM_STRONGCANDLIMStrongItLim= CPX_PARAM_STRONGITLIMFracCand= CPX_PARAM_FRACCANDFracCuts<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 670


IloCplex::IntParam= CPX_PARAM_FRACCUTSFracPass= CPX_PARAM_FRACPASSPreslvNd= CPX_PARAM_PRESLVNDFlowPaths= CPX_PARAM_FLOWPATHSMIRCuts= CPX_PARAM_MIRCUTSDisjCuts= CPX_PARAM_DISJCUTSZeroHalfCuts= CPX_PARAM_ZEROHALFCUTSAggCutLim= CPX_PARAM_AGGCUTLIMCutPass= CPX_PARAM_CUTPASSEachCutLim= CPX_PARAM_EACHCUTLIMDiveType= CPX_PARAM_DIVETYPEMIPSearch= CPX_PARAM_MIPSEARCHMIQCPStrat= CPX_PARAM_MIQCPSTRATSolnPoolCapacity= CPX_PARAM_SOLNPOOLCAPACITYSolnPoolReplace= CPX_PARAM_SOLNPOOLREPLACESolnPoolIntensity= CPX_PARAM_SOLNPOOLINTENSITYPopulateLim= CPX_PARAM_POPULATELIM<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 671


IloCplex::IntParamBarAlg= CPX_PARAM_BARALGBarColNz= CPX_PARAM_BARCOLNZBarDisplay= CPX_PARAM_BARDISPLAYBarItLim= CPX_PARAM_BARITLIMBarMaxCor= CPX_PARAM_BARMAXCORBarOrder= CPX_PARAM_BARORDERBarCrossAlg= CPX_PARAM_BARCROSSALGBarStartAlg= CPX_PARAM_BARSTARTALGNetItLim= CPX_PARAM_NETITLIMNetPPriInd= CPX_PARAM_NETPPRIINDNetDisplay= CPX_PARAM_NETDISPLAYConflictDisplay= CPX_PARAM_CONFLICTDISPLAYFeasOptMode= CPX_PARAM_FEASOPTMODETuningMeasure= CPX_PARAM_TUNINGMEASURETuningRepeat= CPX_PARAM_TUNINGREPEATTuningDisplay= CPX_PARAM_TUNINGDISPLAY<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 672


IloCplex::InvalidCutExceptionIloCplex::InvalidCutExceptionCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summarypublic IloConstraintgetCut() constInherited methods from IloCplex::ExceptionException::getStatusInherited methods from IloExceptionIloException::end, IloException::getMessageDescription An instance of this exception is thrown by IloCplex when an an attempt is made toadd a malformed cut. An example of a malformed cut is one that uses variables that havenot been extracted or a cut that is defined with an expression that is not linear.Methodspublic IloConstraint getCut() constReturns the invalid cut that triggered the invoking exception.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 673


IloCplex::LazyConstraintCallbackIIloCplex::LazyConstraintCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hInherited methods from IloCplex::CutCallbackIadd, addLocalInherited methods from IloCplex::ControlCallbackIControlCallbackI::getDownPseudoCost, ControlCallbackI::getDownPseudoCost,ControlCallbackI::getFeasibilities, ControlCallbackI::getFeasibilities,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getLB, ControlCallbackI::getLB,ControlCallbackI::getLBs, ControlCallbackI::getLBs,ControlCallbackI::getNodeData, ControlCallbackI::getObjValue,ControlCallbackI::getSlack, ControlCallbackI::getSlacks,ControlCallbackI::getUB, ControlCallbackI::getUB,ControlCallbackI::getUBs, ControlCallbackI::getUBs,ControlCallbackI::getUpPseudoCost, ControlCallbackI::getUpPseudoCost,ControlCallbackI::getValue, ControlCallbackI::getValue,ControlCallbackI::getValue, ControlCallbackI::getValues,ControlCallbackI::getValues, ControlCallbackI::isSOSFeasible,ControlCallbackI::isSOSFeasibleInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreads<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 674


IloCplex::LazyConstraintCallbackIInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::LazyConstraintCallbackI represents auser-written callback in an application that uses an instance of IloCplex to solve aMIP while generating lazy constraints. IloCplex calls the user-written callback aftersolving each node LP exactly like IloCplex::CutCallbackI. In fact, this<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 675


IloCplex::LazyConstraintCallbackIcallback is exactly equivalent to IloCplex::CutCallbackI but offers a namemore consistently pointing out the difference between lazy constraints and user cuts.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 676


IloCplex::MIPCallbackIIloCplex::MIPCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedMIPCallbackI(IloEnv env)Method Summaryprotected IloIntprotected IloIntprotected IloIntprotected IloIntprotected IloIntMIPCallbackI::getNcliques() constMIPCallbackI::getNcovers() constMIPCallbackI::getNdisjunctiveCuts() constMIPCallbackI::getNflowCovers() constMIPCallbackI::getNflowPaths() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 677


IloCplex::MIPCallbackIprotected IloIntprotected IloIntprotected IloIntprotected IloIntprotected IloNumprotected IloNumprotected voidprotected voidprotected IloIntMIPCallbackI::getNfractionalCuts() constMIPCallbackI::getNGUBcovers() constMIPCallbackI::getNimpliedBounds() constMIPCallbackI::getNMIRs() constMIPCallbackI::getObjCoef(const IloIntVarvar) constMIPCallbackI::getObjCoef(const IloNumVarvar) constMIPCallbackI::getObjCoefs(IloNumArrayval,const IloIntVarArray vars) constMIPCallbackI::getObjCoefs(IloNumArrayval,const IloNumVarArray vars) constMIPCallbackI::getUserThreads() constInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::main<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 678


IloCplex::MIPCallbackIInner ClassMIPCallbackI::MIPCallbackI::NodeDataDescriptionAn instance of the class IloCplex::MIPCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a mixed integerprogram (MIP). IloCplex calls the user-written callback prior to solving each nodein branch & cut search.User-written callbacks of this class or any of its subclasses are not compatible withMIP dynamic search. If you are looking for support for callbacks compatible withdynamic search, consider the class IloCplex::MIPInfoCallbackI instead.This class offers member functions for accessing an incumbent solution and itsobjective value from a user-written callback. It also offers methods for accessingpriority orders and statistical information, such as the number of cuts. Methods are alsoavailable to query the number of generated cuts for each type of cut <strong>CPLEX</strong> generates.See the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong> for more information about cuts.The methods of this class are protected for use in deriving a user-written callback classand in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown. For example, if there is no incumbent, the methods that query aboutincumbents will throw an exception.This class also provides the common application programming interface (<strong>API</strong>) for thesecallback classes:◆◆◆◆◆◆◆◆◆◆IloCplex::NodeCallbackIIloCplex::IncumbentCallbackIIloCplex::DisjunctiveCutCallbackIIloCplex::FlowMIRCutCallbackIIloCplex::FractionalCutCallbackIIloCplex::ProbingCallbackIIloCplex::CutCallbackIIloCplex::BranchCallbackIIloCplex::HeuristicCallbackIIloCplex::SolveCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 679


IloCplex::MIPCallbackISee AlsoConstructorsMethodsIloCplex, IloCplex::BranchCallbackI, IloCplex::Callback,IloCplex::CallbackI, IloCplex::CutCallbackI,IloCplex::DisjunctiveCutCallbackI,IloCplex::FlowMIRCutCallbackI,IloCplex::FractionalCutCallbackI,IloCplex::HeuristicCallbackI, IloCplex::IncumbentCallbackI,IloCplex::NodeCallbackI, IloCplex::OptimizationCallbackI,IloCplex::ProbingCallbackI, IloCplex::SolveCallbackI,ILOMIPCALLBACK0protected MIPCallbackI(IloEnv env)This constructor creates a callback for use in an application that uses an instance ofIloCplex to solve a mixed integer program (MIP).protected IloInt getNcliques() constReturns the total number of clique cuts that have been added to the model so far duringthe current optimization.protected IloInt getNcovers() constReturns the total number of cover cuts that have been added to the model so far duringthe current optimization.protected IloInt getNdisjunctiveCuts() constReturns the total number of disjunctive cuts that have been added to the model so farduring the current optimization.protected IloInt getNflowCovers() constReturns the total number of flow cover cuts that have been added to the model so farduring the current optimization.protected IloInt getNflowPaths() constReturns the total number of flow path cuts that have been added to the model so farduring the current optimization.protected IloInt getNfractionalCuts() constReturns the total number of fractional cuts that have been added to the model so farduring the current optimization.protected IloInt getNGUBcovers() constReturns the total number of GUB cover cuts that have been added to the model so farduring the current optimization.protected IloInt getNimpliedBounds() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 680


IloCplex::MIPCallbackIReturns the total number of implied bound cuts that have been added to the model so farduring the current optimization.protected IloInt getNMIRs() constReturns the total number of MIR cuts that have been added to the model so far duringthe current optimization.protected IloNum getObjCoef(const IloIntVar var) constReturns the linear objective coefficient for var in the model currently being solved.protected IloNum getObjCoef(const IloNumVar var) constReturns the linear objective coefficient for var in the model currently being solved.protected void getObjCoefs(IloNumArray val,const IloIntVarArray vars) constPuts the linear objective coefficient of each of the variables in the array vars into thecorresponding element of the array vals.protected void getObjCoefs(IloNumArray val,const IloNumVarArray vars) constPuts the linear objective coefficient of each of the variables in the array vars into thecorresponding element of the array vals.protected IloInt getUserThreads() constReturns the total number of parallel threads currently running.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 681


MIPCallbackI::NodeDataMIPCallbackI::NodeDataCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summarypublic virtual IloAnygetDataType() constDescriptionSee AlsoMethodsObjects of (a subclass of) this class can be attached to created nodes in a branch callbackwith one of the IloCplex::BranchCallbackI::makeBranch methods. Thisallows the user to associate arbitrary data with the nodes. The destructor must beimplemented to delete all such data. It will typically be called by IloCplex when anode is discarded, either because it has been processed or because it is pruned.IloCplex::MIPCallbackI, ILOBRANCHCALLBACK0public virtual IloAny getDataType() constIloCplex does not use this method. It is provided as a convenience for the user to helpmanage different types of NodeData subclasses.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 682


IloCplex::MIPEmphasisTypeIloCplex::MIPEmphasisTypeCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hMIPEmphasisType{MIPEmphasisBalanced,MIPEmphasisOptimality,MIPEmphasisFeasibility,MIPEmphasisBestBound,MIPEmphasisHiddenFeas};The enumeration IloCplex::MIPEmphasisType lists the values that the MIPemphasis parameter IloCplex::MIPEmphasis can assume in an instance ofIloCplex for use when it is solving MIP problems. Use these values with the methodIloCplex::setParam(IloCplex::MIPEmphasis, value) when you setMIP emphasis.With the default setting of IloCplex::MIPEmphasisBalance, IloCplex triesto compute the branch & cut algorithm in such a way as to find a proven optimalsolution quickly. For a discussion about various settings, refer to the <strong>ILOG</strong> <strong>CPLEX</strong>User's <strong>Manual</strong>.See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameters and the <strong>ILOG</strong> <strong>CPLEX</strong> User's<strong>Manual</strong> for more information about these parameters. Also see the user's manual forexamples of their use.IloCplexMIPEmphasisBalanced= CPX_MIPEMPHASIS_BALANCEDMIPEmphasisOptimality= CPX_MIPEMPHASIS_OPTIMALITYMIPEmphasisFeasibility= CPX_MIPEMPHASIS_FEASIBILITYMIPEmphasisBestBound= CPX_MIPEMPHASIS_BESTBOUNDMIPEmphasisHiddenFeas= CPX_MIPEMPHASIS_HIDDENFEAS<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 683


IloCplex::MIPInfoCallbackIIloCplex::MIPInfoCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedMIPInfoCallbackI(IloEnv env)Method Summaryprotected IloNumprotected IloNumprotectedIloCplex::BranchDirectionprotectedIloCplex::BranchDirectionprotected IloNumprotected IloNumMIPInfoCallbackI::getBestObjValue() constMIPInfoCallbackI::getCutoff() constMIPInfoCallbackI::getDirection(constIloIntVar var) constMIPInfoCallbackI::getDirection(constIloNumVar var) constMIPInfoCallbackI::getIncumbentObjValue()constMIPInfoCallbackI::getIncumbentSlack(constIloRange rng) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 684


IloCplex::MIPInfoCallbackIprotected voidprotected IloNumprotected IloNumprotected voidprotected voidprotected IloIntprotected IloIntprotected IloIntprotected IloIntprotected IloNumprotected IloNumprotected IloBoolMIPInfoCallbackI::getIncumbentSlacks(IloNumArray vals,const IloRangeArray cons) constMIPInfoCallbackI::getIncumbentValue(constIloIntVar var) constMIPInfoCallbackI::getIncumbentValue(constIloNumVar var) constMIPInfoCallbackI::getIncumbentValues(IloNumArray val,const IloIntVarArray vars) constMIPInfoCallbackI::getIncumbentValues(IloNumArray val,const IloNumVarArray vars) constMIPInfoCallbackI::getMyThreadNum() constMIPInfoCallbackI::getNiterations() constMIPInfoCallbackI::getNnodes() constMIPInfoCallbackI::getNremainingNodes() constMIPInfoCallbackI::getPriority(constIloIntVar sos) constMIPInfoCallbackI::getPriority(constIloNumVar sos) constMIPInfoCallbackI::hasIncumbent() constInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionAn instance of the class IloCplex::MIPInfoCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a mixed integerprogram (MIP). IloCplex calls the user-written callback regularly during the branch& cut search.User-written callbacks of this class are compatible with MIP dynamic search.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 685


IloCplex::MIPInfoCallbackIThis class offers methods for accessing an incumbent solution and its objective valuefrom a user-written callback. It also offers methods for accessing priority orders andprogress information, such as the number of nodes solved.The methods of this class are protected for use in deriving a user-written callback classand in implementing the main method there.If an attempt is made in a user-written callback to access information not available to aninstance of this class, an exception is raised. For example, if there is no incumbent, themethods that query about incumbents will throw an exception.This class also provides the common application programming interface (<strong>API</strong>) for thesecallback classes:◆◆◆◆IloCplex::DisjunctiveCutInfoCallbackIIloCplex::FlowMIRCutInfoCallbackIIloCplex::FractionalCutInfoCallbackIIloCplex::ProbingInfoCallbackISee AlsoConstructorsMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::DisjunctiveCutInfoCallbackI,IloCplex::FlowMIRCutInfoCallbackI,IloCplex::FractionalCutInfoCallbackI,IloCplex::OptimizationCallbackI,IloCplex::ProbingInfoCallbackI, ILOMIPINFOCALLBACK0protected MIPInfoCallbackI(IloEnv env)This constructor creates a callback for use in an application that uses an instance ofIloCplex to solve a mixed integer program (MIP).protected IloNum getBestObjValue() constThis method returns the currently best known bound on the optimal solution value of theproblem at the time the invoking callback is called by an instance of IloCplex whilesolving a MIP. When a model has been solved to optimality, this value matches theoptimal solution value. Otherwise, this value is computed for a minimization(maximization) problem as the minimum (maximum) objective function value of allremaining unexplored nodes.protected IloNum getCutoff() constReturns the current cutoff value.An instance of IloCplex uses the cutoff value (the value of the objective function ofthe subproblem at a node in the search tree) to decide when to prune nodes from the<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 686


IloCplex::MIPInfoCallbackIsearch tree (that is, when to cut off that node and discard the nodes beyond it). Thecutoff value is updated whenever a new incumbent is found.protected IloCplex::BranchDirection getDirection(const IloIntVar var)constThis method returns the branch direction previously assigned to variable var withmethod IloCplex::setDirection or IloCplex::setDirections. Ifnodirection has been assigned, IloCplex::BranchGlobal will be returned.protected IloCplex::BranchDirection getDirection(const IloNumVar var)constThis method returns the branch direction previously assigned to variable var withmethod IloCplex::setDirection or IloCplex::setDirections. Ifnodirection has been assigned, IloCplex::BranchGlobal will be returned.protected IloNum getIncumbentObjValue() constReturns the value of the objective function of the incumbent solution (that is, the bestinteger solution found so far) at the time the invoking callback is called by an instance ofIloCplex while solving a MIP. If there is no incumbent, this method throws anexception.protected IloNum getIncumbentSlack(const IloRange rng) constThis method returns the slack value for the range specified by rng for the incumbent. Ifthere is no incumbent, this method throws an exception.protected void getIncumbentSlacks(IloNumArray vals,const IloRangeArray cons) constThis method puts the slack value for each range in the array of ranges cons into thecorresponding element of the array vals for the incumbent. <strong>CPLEX</strong> resizes arrayvals to match the size of array cons. If there is no incumbent, this method throws anexception.protected IloNum getIncumbentValue(const IloIntVar var) constReturns the solution value of var in the incumbent solution at the time the invokingcallback is called by an instance of IloCplex while solving a MIP. If there is noincumbent, this method throws an exception.protected IloNum getIncumbentValue(const IloNumVar var) constReturns the solution value of var in the incumbent solution at the time the invokingcallback is called by an instance of IloCplex while solving a MIP. If there is noincumbent, this method throws an exception.protected void getIncumbentValues(IloNumArray val,const IloIntVarArray vars) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 687


IloCplex::MIPInfoCallbackIReturns the value of each variable in the array vars with respect to the currentincumbent solution, and it puts those values into the corresponding array vals. Ifthere is no incumbent, this method throws an exception.protected void getIncumbentValues(IloNumArray val,const IloNumVarArray vars) constReturns the value of each variable in the array vars with respect to the currentincumbent solution, and it puts those values into the corresponding array vals. Ifthere is no incumbent, this method throws an exception.protected IloInt getMyThreadNum() constReturns the identifier of the parallel thread being currently executed. This number isbetween 0 (zero) and the value returned by the method getUserThreads()-1.This method returns a nonzero value only for the class IloCplex::MIPCallbackIand its subclasses. In other words, this method is valid only for query, diagnostic, andcontrol callbacks. It is not valid for informational callbacks.protected IloInt getNiterations() constReturns the total number of iterations executed so far during the current optimization tosolve the node relaxations.protected IloInt getNnodes() constReturns the number of nodes already processed in the current optimization.protected IloInt getNremainingNodes() constReturns the number of nodes left to explore in the current optimization.protected IloNum getPriority(const IloIntVar sos) constReturns the branch priority used for variable var in the current optimization.protected IloNum getPriority(const IloNumVar sos) constReturns the branch priority used for variable var in the current optimization.protected IloBool hasIncumbent() constReturns IloTrue if an integer feasible solution has been found, or, equivalenty, if anincumbent solution is available at the time the invoking callback is called by an instanceof IloCplex while solving a MIP.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 688


IloCplex::MIPsearchIloCplex::MIPsearchCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hMIPsearch{AutoSearch,Traditional,Dynamic};The enumeration IloCplex::MIPsearch lists values that the dynamic searchparameter IloCplex::MIPSearch can assume in IloCplex. Use these valueswith the method IloCplex::setParam(IloCplex::MIPSearch, value).See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameters and the <strong>ILOG</strong> <strong>CPLEX</strong> User's<strong>Manual</strong> for more information about this parameter. Also see the user's manual forexamples of their use.IloCplexAutoSearch= CPX_MIPSEARCH_AUTOTraditional= CPX_MIPSEARCH_TRADITIONALDynamic= CPX_MIPSEARCH_DYNAMIC<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 689


IloCplex::MultipleConversionExceptionIloCplex::MultipleConversionExceptionCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summarypublic IloConversionpublic const IloNumVarArraygetConversion() constgetVariables() constInherited methods from IloCplex::ExceptionException::getStatusInherited methods from IloExceptionIloException::end, IloException::getMessageDescription An instance of this exception is thrown by IloCplex when there is an attempt toconvert the type of a variable with more than one IloConversion object at a time,while it is being extracted by IloCplex.Methodspublic IloConversion getConversion() constThis method returns the offending IloConversion object.public const IloNumVarArray getVariables() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 690


IloCplex::MultipleConversionExceptionThis method returns an array of variables to which too many type conversions havebeen applied.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 691


IloCplex::MultipleObjExceptionIloCplex::MultipleObjExceptionCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hInherited methods from IloCplex::ExceptionException::getStatusInherited methods from IloExceptionIloException::end, IloException::getMessageDescriptionAn instance of this exception is thrown by IloCplex when there is an attempt to usemore than one objective function in a model extracted by IloCplex.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 692


IloCplex::NetworkCallbackIIloCplex::NetworkCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedNetworkCallbackI(IloEnv env)Method Summaryprotected IloNumprotected IloIntprotected IloNumprotected IloBoolgetInfeasibility() constgetNiterations() constNetworkCallbackI::getObjValue() constisFeasible() constInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 693


IloCplex::NetworkCallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoConstructorsMethodsAn instance of the class IloCplex::NetCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex with the networkoptimizer. The callback is executed each time the network optimizer issues a log filemessage.The methods of this class are protected for use in deriving a user-written callback classand in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.IloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::OptimizationCallbackI, ILONETWORKCALLBACK0protected NetworkCallbackI(IloEnv env)This constructor creates a callback for use with the network optimizer.protected IloNum getInfeasibility() constThis method returns the current primal infeasibility measure of the network solution inthe instance of IloCplex at the time the invoking callback is executed.protected IloInt getNiterations() constThis method returns the number of network simplex iterations completed so far by aninstance of IloCplex at the invoking callback is executed.protected IloNum getObjValue() constThis method returns the current objective value of the network solution in the instance ofIloCplex at the time the invoking callback is executed.If you need the object representing the objective itself, consider the methodgetObjective instead.protected IloBool isFeasible() constThis method returns IloTrue if the current network solution is primal feasible.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 694


IloCplex::NodeCallbackIIloCplex::NodeCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedNodeCallbackI(IloEnv env)Method Summaryprotected IloNumVarprotected IloNumVarprotected IloIntprotected IloIntprotected IloNumprotected IloNumprotected IloNumprotected IloNumprotected IloIntprotected IloIntprotected NodeData *protected NodeData *protected NodeIdprotected IloIntprotected IloNumprotected IloNumprotected voidprotected voidgetBranchVar(NodeId nodeid) constgetBranchVar(int node) constgetDepth(NodeId nodeid) constgetDepth(int node) constgetEstimatedObjValue(NodeId nodeid) constgetEstimatedObjValue(int node) constgetInfeasibilitySum(NodeId nodeid) constgetInfeasibilitySum(int node) constgetNinfeasibilities(NodeId nodeid) constgetNinfeasibilities(int node) constgetNodeData(NodeId nodeid) constgetNodeData(int node) constgetNodeId(int node) constgetNodeNumber(NodeId nodeid) constNodeCallbackI::getObjValue(NodeId nodeid)constgetObjValue(int node) constselectNode(NodeId nodeid)selectNode(int node)Inherited methods from IloCplex::MIPCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 695


IloCplex::NodeCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::main<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 696


IloCplex::NodeCallbackIDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::NodeCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a mixed integerprogramming problem (a MIP). The methods of this class enable you (from a userderivedcallback class) to query the instance of IloCplex about the next node that itplans to select in the branch & cut search, and optionally to override this selection byspecifying a different node.When an instance of this callback executes, the invoking instance of IloCplex stillhas n = getNremainingNodes (inherited fromIloCplex::MIPCallbackI) nodes left to process. These remaining nodes arenumbered from 0 (zero) to (n - 1). For that reason, the same node may have adifferent number each time an instance of NodeCallbackI is called. To identify anode uniquely, an instance of IloCplex also assigns a unique NodeId to each node.That unique identifier remains unchanged throughout the search. The methodgetNodeId(int i) allows you to access the NodeId for each of the remainingnodes (0 to n-1). Such a query allows you to associate data with individual nodes.The methods of this class are protected for use in deriving a user-written callback classand in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.See AlsoConstructorsMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPCallbackI, IloCplex::OptimizationCallbackI,ILONODECALLBACK0protected NodeCallbackI(IloEnv env)This constructor creates a callback for use in an application with user-defined nodeselection inquiry during branch & cut searches.protected IloNumVar getBranchVar(NodeId nodeid) constThis method returns the variable that was branched on last when <strong>CPLEX</strong> created thenode with the identifier nodeid. If that node has been created by branching on aconstraint or on multiple variables, 0 (zero) will be returned.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 697


IloCplex::NodeCallbackIprotected IloNumVar getBranchVar(int node) constReturns the variable that was branched on last when creating the node specified by theindex number node. If that node has been created by branching on a constraint or onmultiple variables, 0 (zero) will be returned.protected IloInt getDepth(NodeId nodeid) constThis method returns the depth of the node in the search tree for the node with theidentifier nodeid. The root node has depth 0 (zero). The depth of other nodes isdefined recursively as the depth of their parent node plus one. In other words, the depthof a node is its distance in terms of the number of branches from the root.protected IloInt getDepth(int node) constThis method returns the depth of the node in the search tree. The root node has depth 0(zero). The depth of other nodes is defined recursively as the depth of their parent nodeplus one. In other words, the depth of a node is its distance in terms of the number ofbranches from the root.protected IloNum getEstimatedObjValue(NodeId nodeid) constThis method returns the estimated objective value of the node with the identifier node.protected IloNum getEstimatedObjValue(int node) constThis method returns the estimated objective value of the node specified by the indexnumber node.protected IloNum getInfeasibilitySum(NodeId nodeid) constThis method returns the sum of infeasibility measures at the node with the identifiernodeid.protected IloNum getInfeasibilitySum(int node) constThis method returns the sum of infeasibility measures at the node specified by the indexnumber node.protected IloInt getNinfeasibilities(NodeId nodeid) constThis method returns the number of infeasibilities at the node with the identifiernodeid.protected IloInt getNinfeasibilities(int node) constThis method returns the number of infeasibilities at the node specified by the indexnumber node.protected NodeData * getNodeData(NodeId nodeid) constThis method retrieves the NodeData object that may have previously been assigned bythe user to the node with the identfier nodeid with one of the methodsIloCplex::BranchCallbackI::makeBranch. If no data object has beenassigned to the that node, 0 (zero) will be returned.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 698


IloCplex::NodeCallbackIprotected NodeData * getNodeData(int node) constThis method retrieves the NodeData object that may have previously been assigned tothe node with index node by the user with the methodIloCplex::BranchCallbackI::makeBranch. If no data object has beenassigned to the specified node, 0 (zero) will be returned.protected NodeId getNodeId(int node) constThis method returns the node identifier of the node specified by the index number node.During branch & cut, an instance of IloCplex assigns node identifiers sequentiallyfrom 0 (zero) to (getNodes - 1) as it creates nodes. Within a search, these nodeidentifiers are unique throughout the duration of that search. However, at any point, theremaining nodes, (that is, the nodes that have not yet been processed) are stored in anarray in an arbitrary order. This method returns the identifier of the node stored atposition node in that array.protected IloInt getNodeNumber(NodeId nodeid) constReturns the current index number of the node specified by the node identifier nodeid.protected IloNum getObjValue(NodeId nodeid) constThis method returns the objective value of the node with the identifier node.If you need the object representing the objective itself, consider the methodgetObjective instead.protected IloNum getObjValue(int node) constThis method returns the objective value of the node specified by the index numbernode.If you need the object representing the objective itself, consider the methodgetObjective instead.protected void selectNode(NodeId nodeid)This method selects the node with the identifier nodeid and sets it as the next node toprocess in the branch & cut search. The invoking instance of IloCplex uses thespecified node as the next node to process.protected void selectNode(int node)This method selects the node specified by its index number node and sets it as the nextnode to process in the branch & cut search. The parameter node must be an integerbetween 0 (zero) and (getNremainingNodes - 1).The invoking instance of IloCplex uses the specified node as the next node toprocess.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 699


IloCplex::NodeEvaluatorIloCplex::NodeEvaluatorCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicNodeEvaluator()public NodeEvaluator(IloCplex::NodeEvaluatorI *impl)publicNodeEvaluator(const NodeEvaluator & eval)Method SummarypublicIloCplex::NodeEvaluatorI *public NodeEvaluatorgetImpl() constoperator=(const NodeEvaluator & eval)Description This class is the handle class for objects of type IloCplex::NodeEvaluatorI.Node evaluators can be used to control the node selection strategy during goalcontrolledsearch. That is, node evaluators control the order in which nodes areprocessed during branch & cut search using IloCplex goals. Such objects allow youto control the node-selection scheme.IloCplex::NodeEvaluatorI objects are reference-counted. In other words,every instance of IloCplex::NodeEvaluatorI keeps track of how many handleobjects refer to it. When this number drops to 0 (zero), theIloCplex::NodeEvaluatorI object is automatically deleted. As a consequence,whenever you deal with node evaluators, you must maintain a handle object rather thanjust a pointer to the implementation object. Otherwise, you risk ending up with apointer to an implementation object that has already been deleted.See AlsoIloCplex, IloCplex::NodeEvaluatorI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 700


IloCplex::NodeEvaluatorConstructorspublic NodeEvaluator()The empty constructor creates a new evaluator containing no pointers to animplementation object.public NodeEvaluator(IloCplex::NodeEvaluatorI * impl)This constructor creates a new evaluator with a pointer to an implementation. Itincreases the reference count of impl by one.public NodeEvaluator(const NodeEvaluator & eval)This copy constructor increments the reference count of the implementation objectreferenced by eval by one.Methodspublic IloCplex::NodeEvaluatorI * getImpl() constQueries the implementation object.public NodeEvaluator operator=(const NodeEvaluator & eval)The assignment operator increases the reference count of the implementation object ofeval. If the invoking handle referred to an implementation object before theassignment operation, its reference count is decreased. If this decrement reduces thereference count to 0 (zero), the implementation object is deleted.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 701


IloCplex::NodeEvaluatorIIloCplex::NodeEvaluatorICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicNodeEvaluatorI()Method Summarypublic virtualNodeEvaluatorI *public virtual IloNumprotected IloNumVarprotected IloNumprotected IloNumprotected IloNumprotected IloIntprotected NodeIdprotected IloNumpublic virtual voidpublic virtual IloBoolduplicateEvaluator()evaluate() constgetBranchVar() constgetDepth() constgetEstimatedObjValue() constgetInfeasibilitySum() constgetNinfeasibilities() constgetNodeId() constNodeEvaluatorI::getObjValue() constinit()subsume(IloNum evalBest,IloNum evalCurrent)constDescriptionIloCplex::NodeEvaluatorI is the base class for implementing node evaluators.Node evaluators allow you to control the node selection strategy for a subtree byassigning values to the nodes. By default, IloCplex selects the node with the lowestvalue when choosing the next node to process during branch & cut search. This behaviorcan be altered by overwriting method subsume.To implement your own node evaluator, you need to create a subclass ofIloCplex::NodeEvaluatorI and implement methods evaluate andduplicateEvaluator. The method evaluate must be implemented to compute<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 702


IloCplex::NodeEvaluatorIand return a value for a given node. The protected methods of classIloCplex::NodeEvaluatorI can be called to query information about the nodein order to compute this value. Each node is evaluated only once, after which the value isattached to the node until the node is processed or pruned.The duplicateEvaluator method is called by IloCplex when a copy of theevaluator must be created for use in parallel branch & cut search. Thus theimplementation must simply create and return a copy of the evaluator itself—calling thecopy constructor will work in most circumstances.Node evaluators are applied to a search defined by a goal with the methodIloCplex::Apply. The node selection strategy will be applied only to the subtreedefined by the goal passed to Apply. Using IloCplex::Apply, you can assigndifferent node selection strategies to different subtrees. You can also assign multiplenode selection strategies to subtrees. In this case, node selection strategies applied firsthave precedence over those assigned later.If no node evaluators are added, IloCplex uses the node selection strategy ascontrolled by the NodeSel parameter.See AlsoConstructorsMethodsIloCplex, IloCplex::NodeEvaluatorpublic NodeEvaluatorI()This constructor creates a node selector for use in an application with a user-definednode selection strategy to solve a MIP.public virtual NodeEvaluatorI * duplicateEvaluator()This method must be implemented by the user to return a copy of the invoking object. Itis called internally to duplicate the current node evaluator for parallel branch & cutsearch. This method is not called for a particular node, so the get methods cannot beused.public virtual IloNum evaluate() constThis method must be implemented by the user to return a value for a given node. Whenthis method is called, the node evaluator is initialized to the node for which to computethe value. Information about this node can be obtained by the get methods ofIloCplex::NodeEvaluatorI. Returning IloInfinity instructs IloCplexto discard the node being evaluated.protected IloNumVar getBranchVar() constThis method returns the variable that IloCplex branched on when creating the nodebeing evaluated from its parent. If the node has been generated with a more complexbranch, 0 (zero) will be returned instead. This method can be called only from themethods init and evaluate.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 703


IloCplex::NodeEvaluatorIprotected IloNum getDepth() constThis method returns the depth in the search tree of the node currently being evaluated.The root node is depth 0 (zero); the depth of the current node is its distance from theroot, or equivalently, the number of branches taken to get from the root node to thecurrent node. This member function can be called only from the methods init andevaluate.protected IloNum getEstimatedObjValue() constThis method returns the estimated objective value for the node being evaluated. It can becalled only from the methods init and evaluate.protected IloNum getInfeasibilitySum() constThis method returns the sum of infeasibility measures at the node being evaluated. It canbe called only from the methods init and evaluate.protected IloInt getNinfeasibilities() constThis method returns the number of infeasibilities at the node being evaluated. It can becalled only from the methods init and evaluate.protected NodeId getNodeId() constThis method returns the node identifier of the node being evaluated. It can be called onlyfrom the methods init and evaluate.protected IloNum getObjValue() constThis method returns the objective value of the node being evaluated. It can be calledonly from the methods init and evaluate.If you need the object representing the objective itself, consider the methodgetObjective instead.public virtual void init()This method is called by IloCplex immediately before the first time evaluate iscalled for a node, allowing you to initialize the evaluator based on that node.Information about the current node can be queried by calling the get methods ofIloCplex::NodeEvaluatorI.public virtual IloBool subsume(IloNum evalBest,IloNum evalCurrent) constIloCplex maintains a candidate node for selection as the next node to process. Whenchoosing the next node, it compares the candidate to all other nodes. If a given node andthe candidate node are governed by the same evaluator, IloCplex calls subsume todetermine whether the node should become the new candidate. The arguments passed tothe subsume call are:◆the value previously assigned by the method evaluate to the candidate node asparameter evalBest, and<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 704


IloCplex::NodeEvaluatorI◆the value previously assigned by the method evaluate to the node underinvestigation as parameter evalCurrent.By default, this method returns IloTrue if evalCurrent>evalBest.Overwriting this function allows you to change this selection scheme.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 705


IloCplex::NodeSelectIloCplex::NodeSelectCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hNodeSelect{DFS,BestBound,BestEst,BestEstAlt};The enumeration IloCplex::NodeSelect lists values that the parameterIloCplex::NodeSel can assume in IloCplex. Use these values with the methodIloCplex::setParam(IloCplex::NodeSel, value).See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameters and the <strong>ILOG</strong> <strong>CPLEX</strong> User's<strong>Manual</strong> for more information about these parameters. Also see the user's manual forexamples of their use.IloCplexDFS= CPX_NODESEL_DFSBestBound= CPX_NODESEL_BESTBOUNDBestEst= CPX_NODESEL_BESTESTBestEstAlt= CPX_NODESEL_BESTEST_ALT<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 706


IloCplex::NumParamIloCplex::NumParamCategoryDefinition FileSynopsisDescriptionSee AlsoInner Enumerationilcplex/ilocplexi.hNumParam{EpMrk,EpOpt,EpPer,EpRHS,NetEpOpt,NetEpRHS,TiLim,TuningTiLim,BtTol,CutLo,CutUp,EpGap,EpInt,EpAGap,EpRelax,ObjDif,ObjLLim,ObjULim,PolishTime,ProbeTime,RelObjDif,CutsFactor,TreLim,SolnPoolGap,SolnPoolAGap,WorkMem,BarEpComp,BarQCPEpComp,BarGrowth,BarObjRng,EpLin};The enumeration IloCplex::NumParam lists the parameters of <strong>CPLEX</strong> that requirenumeric values. Use these values with the member functions:IloCplex::getParam and IloCplex::setParam.See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameters information about theseparameters. Also see the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong> for more examples of their use.IloCplex<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 707


IloCplex::NumParamFieldsEpMrk= CPX_PARAM_EPMRKEpOpt= CPX_PARAM_EPOPTEpPer= CPX_PARAM_EPPEREpRHS= CPX_PARAM_EPRHSNetEpOpt= CPX_PARAM_NETEPOPTNetEpRHS= CPX_PARAM_NETEPRHSTiLim= CPX_PARAM_TILIMTuningTiLim= CPX_PARAM_TUNINGTILIMBtTol= CPX_PARAM_BTTOLCutLo= CPX_PARAM_CUTLOCutUp= CPX_PARAM_CUTUPEpGap= CPX_PARAM_EPGAPEpInt= CPX_PARAM_EPINTEpAGap= CPX_PARAM_EPAGAPEpRelax= CPX_PARAM_EPRELAXObjDif= CPX_PARAM_OBJDIFObjLLim<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 708


IloCplex::NumParam= CPX_PARAM_OBJLLIMObjULim= CPX_PARAM_OBJULIMPolishTime= CPX_PARAM_POLISHTIMEProbeTime= CPX_PARAM_PROBETIMERelObjDif= CPX_PARAM_RELOBJDIFCutsFactor= CPX_PARAM_CUTSFACTORTreLim= CPX_PARAM_TRELIMSolnPoolGap= CPX_PARAM_SOLNPOOLGAPSolnPoolAGap= CPX_PARAM_SOLNPOOLAGAPWorkMem= CPX_PARAM_WORKMEMBarEpComp= CPX_PARAM_BAREPCOMPBarQCPEpComp= CPX_PARAM_BARQCPEPCOMPBarGrowth= CPX_PARAM_BARGROWTHBarObjRng= CPX_PARAM_BAROBJRNGEpLin= CPX_PARAM_EPLIN<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 709


IloCplex::OptimizationCallbackIIloCplex::OptimizationCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summarypublic IloModelpublic IloIntpublic IloIntpublic IloIntOptimizationCallbackI::getModel() constOptimizationCallbackI::getNcols() constOptimizationCallbackI::getNQCs() constOptimizationCallbackI::getNrows() constInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoMethodsThis is the abstract base class for user-written callback classes called by optimizationmethods. It provides their common application programming interface (<strong>API</strong>).IloCplex, IloCplex::Callback, IloCplex::CallbackIpublic IloModel getModel() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 710


IloCplex::OptimizationCallbackIThis method returns the model currently extracted for the instance of IloCplex wherethe invoking callback executed.public IloInt getNcols() constThis method returns the number of columns in the model currently being optimized.public IloInt getNQCs() constThis method returns the number of quadratic constraints in the model currently beingoptimized.public IloInt getNrows() constThis method returns the number of rows in the model currently being optimized.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 711


IloCplex::Parallel_ModeIloCplex::Parallel_ModeCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hParallel_Mode{Opportunistic,AutoParallel,Deterministic};The enumeration IloCplex::ParallelMode lists values that the parallel modeparameter IloCplex::ParallelMode can assume in IloCplex for use onmultiprocessor or multithread platforms, if your application is licensed for paralleloptimization. Use these values with the methodIloCplex::setParam(IloCplex::ParallelMode, value).See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameters and the <strong>ILOG</strong> <strong>CPLEX</strong> User's<strong>Manual</strong> for more information about this parameter. Also see the user's manual forexamples of their use.IloCplexOpportunistic= CPX_PARALLEL_OPPORTUNISTICAutoParallel= CPX_PARALLEL_AUTODeterministic= CPX_PARALLEL_DETERMINISTIC<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 712


IloCplex::ParameterSetIloCplex::ParameterSetCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summarypublic voidpublic voidpublic IloNumpublic IloBoolpublic char *public IloIntpublic voidpublic voidclear()end()getParam(IloCplex::NumParam which) constgetParam(IloCplex::BoolParam which) constgetParam(IloCplex::StringParam which) constgetParam(IloCplex::IntParam which) constsetParam(IloCplex::NumParam which,IloNumval)setParam(IloCplex::BoolParam which,IloBoolval)public void setParam(IloCplex::StringParam which,char *val)public voidsetParam(IloCplex::IntParam which,IloIntval)Inner ClassParameterSet::ParameterSet::IteratorDescriptionA parameter set for IloCplex, this class allows you to store and restore parametersthat are not at their default value.You can create empty IloCplex::ParameterSet objects with the constructor andthen modify them. Alternatively, you can create such objects with the methodIloCplex::getParameterSet.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 713


IloCplex::ParameterSetA parameter set can be applied to an instance of IloCplex by means of the methodIloCplex::setParameterSet(set).See AlsoMethodsgetParameterSet, setParameterSetpublic void clear()Clears the parameter set.public void end()Ends the parameter set.public IloNum getParam(IloCplex::NumParam which) constReturns the current value of a numeric parameter.If the method fails, an exception of type IloException, or one of its derivedclasses, is thrown.Parameters :whichThe identifier of the num parameter to be queried.Returns : The current value of the num parameter.public IloBool getParam(IloCplex::BoolParam which) constReturns the current value of a Boolean parameter.If the method fails, an exception of type IloException, or one of its derivedclasses, is thrown.Parameters :whichThe identifier of the Boolean parameter to be queried.Returns : The current value of the Boolean parameter.public char * getParam(IloCplex::StringParam which) constReturns the current value of a string parameter.If the method fails, an exception of type IloException, or one of its derivedclasses, is thrown.Parameters :whichThe identifier of the string parameter to be queried.Returns : The current value of the string parameter.public IloInt getParam(IloCplex::IntParam which) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 714


IloCplex::ParameterSetReturns the current value of an integer parameter.If the method fails, an exception of type IloException, or one of its derivedclasses, is thrown.Parameters :whichThe identifier of the integer parameter to be queried.Returns : The current value of the integer parameter.public void setParam(IloCplex::NumParam which,IloNum val)Sets a numeric parameter to the value val.Parameters :whichThe identifier of the num parameter to be set.valThe new value for the num parameterpublic void setParam(IloCplex::BoolParam which,IloBool val)Sets a Boolean parameter to the value val.Parameters :whichThe identifier of the Boolean parameter to be set.valThe new value for the Boolean parameter.public void setParam(IloCplex::StringParam which,char * val)Sets a string parameter to the value val.Parameters :whichThe identifier of the string parameter to set.valThe new value for the string parameter.public void setParam(IloCplex::IntParam which,IloInt val)Sets an integer parameter to the value val.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 715


IloCplex::ParameterSetParameters :whichThe identifier of the parameter to set.valThe new value for the integer parameter.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 716


ParameterSet::IteratorParameterSet::IteratorCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicIterator(IloCplex::ParameterSet)Method Summarypublic boolpublic Parameterpublic Iteratorpublic Iterator &ok() constoperator *() constoperator++(int)operator++()DescriptionAn instance of this nested class is an iterator that traverses a set of parameters.The class includes operators to point to the current parameter in the set and to advance tothe next parameter in the set, and a method ok to verify that the iterator is still withinthe set.Constructorspublic Iterator(IloCplex::ParameterSet)Constructs an iterator capable of traversing the parameters in the designated parameterset.Methodspublic bool ok() constReturns true if the iterator points to a valid element of the the parameter set, and falseotherwise.public Parameter operator *() constReturns the parameter to which the iterator currently points.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 717


ParameterSet::Iteratorpublic Iterator operator++(int)Advances the iterator to the next element of the parameter set.public Iterator & operator++()Advances the iterator to the next element of the parameter set.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 718


IloCplex::PresolveCallbackIIloCplex::PresolveCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedPresolveCallbackI(IloEnv env)Method Summaryprotected IloIntprotected IloIntprotected IloIntprotected IloIntgetNaggregations() constgetNmodifiedCoeffs() constgetNremovedCols() constgetNremovedRows() constInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 719


IloCplex::PresolveCallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoConstructorsMethodsAn instance of a class derived from PresolveCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex. The callback is calledperiodically during presolve. This class enables you to access information about theeffects of presolve on the model extracted for the instance of IloCplex. For example,there are member functions that return the number of rows or columns removed from themodel, the number of variables that have been aggregated, and the number ofcoefficients that have changed as a result of presolve.The constructor and methods of this class are protected for use in deriving a user-writtencallback class and in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.IloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::OptimizationCallbackI, ILOPRESOLVECALLBACK0protected PresolveCallbackI(IloEnv env)This constructor creates a callback for use in presolve.protected IloInt getNaggregations() constThis method returns the number of aggregations performed by presolve at the time thecallback is executeed.protected IloInt getNmodifiedCoeffs() constThis method returns the number of coefficients modified by presolve at the time thecallback is executeed.protected IloInt getNremovedCols() constThis method returns the number of columns removed by presolve at the time thecallback is executeed.protected IloInt getNremovedRows() constThis method returns the number of rows removed by presolve at the time the callback isexecuteed.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 720


IloCplex::PrimalPricingIloCplex::PrimalPricingCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hPrimalPricing{PPriIndPartial,PPriIndAuto,PPriIndDevex,PPriIndSteep,PPriIndSteepQStart,PPriIndFull};The enumeration IloCplex::PrimalPricing lists values that the primal pricingparameter IloCplex::PPriInd can assume in IloCplex for use with the primalsimplex algorithm. Use these values with the methodIloCplex::setParam(IloCplex::PPriInd, value) when setting theprimal pricing indicator.See the reference manual ILGO <strong>CPLEX</strong> Parameters and the <strong>ILOG</strong> <strong>CPLEX</strong> User's<strong>Manual</strong> for more information about these parameters. Also see the user's manual forexamples of their use.IloCplexPPriIndPartial= CPX_PPRIIND_PARTIALPPriIndAuto= CPX_PPRIIND_AUTOPPriIndDevex= CPX_PPRIIND_DEVEXPPriIndSteep= CPX_PPRIIND_STEEPPPriIndSteepQStart= CPX_PPRIIND_STEEPQSTARTPPriIndFull= CPX_PPRIIND_FULL<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 721


IloCplex::ProbingCallbackIIloCplex::ProbingCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedProbingCallbackI(IloEnv env)Method Summaryprotected IloIntprotected IloNumgetPhase() constgetProgress() constInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreads<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 722


IloCplex::ProbingCallbackIInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionAn instance of the class IloCplex::ProbingCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a mixed integerprogramming problem (a MIP). This class offers a method to check on the progress of aprobing operation.This class is not compatible with dynamic search. If you are looking for support for auser-written callback compatible with dynamic search, consider instead the classIloCplex::ProbingInfoCallbackI.The methods of this class are protected for use in deriving a user-written callback classand in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 723


IloCplex::ProbingCallbackISee AlsoConstructorsMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPCallbackI, IloCplex::OptimizationCallbackI,ILOPROBINGCALLBACK0protected ProbingCallbackI(IloEnv env)This constructor creates a callback for use in an application when probing.protected IloInt getPhase() constThis method returns the current phase of probing.protected IloNum getProgress() constThis method returns the fraction of completion of the current probing phase.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 724


IloCplex::ProbingInfoCallbackIIloCplex::ProbingInfoCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedProbingInfoCallbackI(IloEnv env)Method Summaryprotected IloIntprotected IloNumgetPhase() constgetProgress() constInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbent<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 725


IloCplex::ProbingInfoCallbackIInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoConstructorsMethodsAn instance of the class IloCplex::ProbingInfoCallbackI represents a userwrittencallback in an application that uses an instance of IloCplex to solve a mixedinteger programming problem (a MIP). This class offers a method to check on theprogress of a probing operation.User-written callbacks of this class are compatible with MIP dynamic search.The methods of this class are protected for use in deriving a user-written callback classand in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.IloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPInfoCallbackI, IloCplex::OptimizationCallbackI,ILOPROBINGINFOCALLBACK0protected ProbingInfoCallbackI(IloEnv env)This constructor creates a callback for use in an application when probing.protected IloInt getPhase() constThis method returns the current phase of probing.protected IloNum getProgress() constThis method returns the fraction of completion of the current probing phase.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 726


IloCplex::QualityIloCplex::QualityCategoryDefinition FileSynopsisInner Enumerationilcplex/ilocplexi.hQuality{MaxPrimalInfeas,MaxScaledPrimalInfeas,SumPrimalInfeas,SumScaledPrimalInfeas,MaxDualInfeas,MaxScaledDualInfeas,SumDualInfeas,SumScaledDualInfeas,MaxIntInfeas,SumIntInfeas,MaxPrimalResidual,MaxScaledPrimalResidual,SumPrimalResidual,SumScaledPrimalResidual,MaxDualResidual,MaxScaledDualResidual,SumDualResidual,SumScaledDualResidual,MaxCompSlack,SumCompSlack,MaxX,MaxScaledX,MaxPi,MaxScaledPi,MaxSlack,MaxScaledSlack,MaxRedCost,MaxScaledRedCost,SumX,SumScaledX,SumPi,SumScaledPi,SumSlack,SumScaledSlack,SumRedCost,SumScaledRedCost,Kappa,ObjGap,DualObj,PrimalObj,ExactKappa};<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 727


IloCplex::QualityDescriptionSee AlsoFieldsThe enumeration IloCplex::Quality lists types of quality measures that can bequeried for a solution with method IloCplex::getQuality.See the group optim.cplex.solutionquality in the <strong>ILOG</strong> <strong>CPLEX</strong> Callable Library<strong>Reference</strong> <strong>Manual</strong> for more information about these values. Also see the <strong>ILOG</strong> <strong>CPLEX</strong>User's <strong>Manual</strong> for examples of their use.IloCplexMaxPrimalInfeas= CPX_MAX_PRIMAL_INFEASMaxScaledPrimalInfeas= CPX_MAX_SCALED_PRIMAL_INFEASSumPrimalInfeas= CPX_SUM_PRIMAL_INFEASSumScaledPrimalInfeas= CPX_SUM_SCALED_PRIMAL_INFEASMaxDualInfeas= CPX_MAX_DUAL_INFEASMaxScaledDualInfeas= CPX_MAX_SCALED_DUAL_INFEASSumDualInfeas= CPX_SUM_DUAL_INFEASSumScaledDualInfeas= CPX_SUM_SCALED_DUAL_INFEASMaxIntInfeas= CPX_MAX_INT_INFEASSumIntInfeas= CPX_SUM_INT_INFEASMaxPrimalResidual= CPX_MAX_PRIMAL_RESIDUALMaxScaledPrimalResidual= CPX_MAX_SCALED_PRIMAL_RESIDUALSumPrimalResidual= CPX_SUM_PRIMAL_RESIDUAL<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 728


IloCplex::QualitySumScaledPrimalResidual= CPX_SUM_SCALED_PRIMAL_RESIDUALMaxDualResidual= CPX_MAX_DUAL_RESIDUALMaxScaledDualResidual= CPX_MAX_SCALED_DUAL_RESIDUALSumDualResidual= CPX_SUM_DUAL_RESIDUALSumScaledDualResidual= CPX_SUM_SCALED_DUAL_RESIDUALMaxCompSlack= CPX_MAX_COMP_SLACKSumCompSlack= CPX_SUM_COMP_SLACKMaxX= CPX_MAX_XMaxScaledX= CPX_MAX_SCALED_XMaxPi= CPX_MAX_PIMaxScaledPi= CPX_MAX_SCALED_PIMaxSlack= CPX_MAX_SLACKMaxScaledSlack= CPX_MAX_SCALED_SLACKMaxRedCost= CPX_MAX_RED_COSTMaxScaledRedCost= CPX_MAX_SCALED_RED_COSTSumX= CPX_SUM_XSumScaledX<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 729


IloCplex::Quality= CPX_SUM_SCALED_XSumPi= CPX_SUM_PISumScaledPi= CPX_SUM_SCALED_PISumSlack= CPX_SUM_SLACKSumScaledSlack= CPX_SUM_SCALED_SLACKSumRedCost= CPX_SUM_RED_COSTSumScaledRedCost= CPX_SUM_SCALED_RED_COSTKappa= CPX_KAPPAObjGap= CPX_OBJ_GAPDualObj= CPX_DUAL_OBJPrimalObj= CPX_PRIMAL_OBJExactKappa= CPX_EXACT_KAPPA<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 730


IloCplex::RelaxationIloCplex::RelaxationCategoryDefinition FileSynopsisDescriptionInner Enumerationilcplex/ilocplexi.hRelaxation{MinSum,OptSum,MinInf,OptInf,MinQuad,OptQuad};The enumeration Relaxation lists the values that can be taken by the parameterFeasOptMode. This parameter controls several aspects of how the method feasOptperforms its relaxation.The method feasOpt works in two phases. In its first phase, it attempts to find aminimum-penalty relaxation of a given infeasible model. If you want feasOpt to stopafter this first phase, choose a value with Min in its symbolic name. If you wantfeasOpt to continue beyond its first phase to find a solution that is optimal withrespect to the original objective function, subject to the constraint that the penalty of therelaxation must not exceed the value found in the first phase, then choose a value withOpt in its symbolic name.In both phases, the suffixes Sum, Inf, and Quad specify the relaxation metric:◆◆Sum tells feasOpt to mimimize the weighted sum of the required relaxations ofbounds and constraints according to the formula penalty = sum (penalty_i timesrelaxation_amount_i)Inf tells feasOpt to minimize the weighted number of bounds and constraintsthat are relaxed according to the formula penalty = sum (penalty_i timesrelaxation_indicator_i)◆ Quad tells feasOpt to mimimize the weighted sum of the squares of requiredrelaxations of bounds and constraints according to the formula penalty = sum(penalty_i times relaxation_amount_i times relaxation_amount_i)Weights are determined by the preference values you provide as input to the methodfeasOpt.When IloAnd is used to group constraints as input to feasOpt, the relaxationpenalty is computed on groups instead of on individual constraints. For example, allconstraints in a group can be relaxed for a total penalty of one unit under the variousInf metrics.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 731


IloCplex::RelaxationFieldsMinSum= CPX_FEASOPT_MIN_SUMOptSum= CPX_FEASOPT_OPT_SUMMinInf= CPX_FEASOPT_MIN_INFOptInf= CPX_FEASOPT_OPT_INFMinQuad= CPX_FEASOPT_MIN_QUADOptQuad= CPX_FEASOPT_OPT_QUAD<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 732


IloCplex::SearchLimitIloCplex::SearchLimitCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicpublicpublicSearchLimit()SearchLimit(IloCplex::SearchLimitI * impl)SearchLimit(const SearchLimit & limit)Method SummarypublicIloCplex::SearchLimitI *public SearchLimitgetImpl() constoperator=(const SearchLimit & limit)DescriptionSearch limits can be used to impose limits on the exploration of certain subtrees duringbranch & cut search. Search limits are implemented in the classIloCplex::SearchLimitI. This is the handle class for <strong>CPLEX</strong> search limits.The search limit objects are reference-counted. This means an instance ofIloCplex::SearchLimitI keeps track of how many handle objects refer to it. Ifthis number drops to 0, the IloCplex::SearchLimitI object is automaticallydeleted. As a consequence, whenever you deal with a search limit, you must maintain ahandle object rather then only a pointer to the implementation object. Otherwise, yourisk ending up with a pointer to an implementation object that has already been deleted.See AlsoConstructorsIloCplex, IloCplex::SearchLimitIpublic SearchLimit()The default constructor creates a new search limit with 0 implementation object pointer.public SearchLimit(IloCplex::SearchLimitI * impl)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 733


IloCplex::SearchLimitThis constructor creates a new search limit with a pointer to an implementation. Itincreases the reference count of impl by one.public SearchLimit(const SearchLimit & limit)This copy constructor increments the reference count of the implementation objectreferenced by limit by one.Methodspublic IloCplex::SearchLimitI * getImpl() constQueries the implementation object of the invoking search limit.public SearchLimit operator=(const SearchLimit & limit)The assignment operator increases the reference count of the implementation object oflimit. If the invoking handle referred to an implementation object before theassignment operation, its reference count is decreased. If this reduces the referencecount to 0, the implementation object is deleted.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 734


IloCplex::SearchLimitIIloCplex::SearchLimitICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicSearchLimitI()Method Summarypublic virtual IloBoolpublic virtual SearchLimitI*public virtual voidcheck()duplicateLimit()init()DescriptionIloCplex::SearchLimitI is the base class for implementing user-defined searchlimits. To do so, you must subclass IloCplex::SearchLimitI and implementmethods check and duplicateLimit. You may optionally implement methodinit. The method check must return IloTrue when the limit is reached andIloFalse otherwise. The method duplicateLimit must return a copy of theinvoking object to be used in parallel search.Whenever method check is called by IloCplex, the search limit object is firstinitialized to a node, referred to as the current node. Information about the current nodecan be queried by calling the get methods of class IloCplex::SearchLimitI.Search limits are applied to subtrees defined by goals with methodIloCplex::LimitSearch. For example:IloGoal limitGoal = IloCplex::LimitSearch(cplex, goal1, limit);creates a goal limitGoal which branches as specified by goal1 until the limitspecified by limit is reached. Only the nodes created by goal1 (or any of the goals<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 735


IloCplex::SearchLimitIcreated by it later) are subjected to the search limit. For example, if you created twobranches with the goalOrGoal(limitGoal, goal2);only the subtree defined by goal1 is subject to the search limit limit; the subtreedefined by goal2 is not.The ability to specify search limits for subtrees means that it is possible for certainbranches to be subject to more than one search limit. Nodes with multiple search limitsattached to them are processed only if none of the search limits has been reached, or, inother words, if all the search limits return IloFalse when method check is called byIloCplex.Each time <strong>CPLEX</strong> uses a search limit, it is duplicated first. If you use the same instanceof your limit in different branches, it will be duplicated first, the copy will be passed tothe corresponding node, and init method will be called on the copy.See AlsoConstructorsMethodsIloCplex, IloCplex::SearchLimitpublic SearchLimitI()The default constructor creates a new instance of SearchLimitI.public virtual IloBool check()This method is called for every node subjected to the invoking search limit beforeevaluating the node. If it returns IloTrue, the node is pruned, or, equivalently, thesearch below that node is discontinued. Thus, users implementing search limits mustimplement this method to return IloTrue if the search limit has been reached andIloFalse otherwise.public virtual SearchLimitI * duplicateLimit()This method is called internally to duplicate the current search limit. Users mustimplement it in a subclass to return a copy of the invoking object.public virtual void init()This method is called by IloCplex right before the first time check is called for anode and allows you to initialize the limit based on that node.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 736


IloCplex::SimplexCallbackIIloCplex::SimplexCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedSimplexCallbackI(IloEnv env)Inherited methods from IloCplex::ContinuousCallbackIContinuousCallbackI::getDualInfeasibility,ContinuousCallbackI::getInfeasibility,ContinuousCallbackI::getNiterations, ContinuousCallbackI::getObjValue,ContinuousCallbackI::isDualFeasible, ContinuousCallbackI::isFeasibleInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 737


IloCplex::SimplexCallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoConstructorsAn instance of the class IloCplex::SimplexCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a problem bymeans of the simplex optimizer. For more information on the simplex optimizer, see the<strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong>. IloCplex calls the user-written callback after eachiteration during optimization with the simplex algorithm.The constructor of this class is protected for use in deriving a user-written callback classand in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.IloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::ContinuousCallbackI,IloCplex::OptimizationCallbackI, ILOSIMPLEXCALLBACK0protected SimplexCallbackI(IloEnv env)This constructor creates a callback for use in an application of the simplex optimizer.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 738


IloCplex::SolveCallbackIIloCplex::SolveCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedSolveCallbackI(IloEnv env)Method SummaryprotectedIloCplex::CplexStatusprotectedIloAlgorithm::Statusprotected IloBoolprotected IloBoolprotected voidprotected voidprotected IloBoolprotected voidgetCplexStatus() constgetStatus() constisDualFeasible() constisPrimalFeasible() constsetVectors(const IloNumArray x,constIloIntVarArray var,const IloNumArray pi,constIloRangeArray rng)setVectors(const IloNumArray x,constIloNumVarArray var,const IloNumArray pi,constIloRangeArray rng)solve(IloCplex::Algorithm alg=Dual)useSolution()Inherited methods from IloCplex::ControlCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 739


IloCplex::SolveCallbackIControlCallbackI::getDownPseudoCost, ControlCallbackI::getDownPseudoCost,ControlCallbackI::getFeasibilities, ControlCallbackI::getFeasibilities,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getLB, ControlCallbackI::getLB,ControlCallbackI::getLBs, ControlCallbackI::getLBs,ControlCallbackI::getNodeData, ControlCallbackI::getObjValue,ControlCallbackI::getSlack, ControlCallbackI::getSlacks,ControlCallbackI::getUB, ControlCallbackI::getUB,ControlCallbackI::getUBs, ControlCallbackI::getUBs,ControlCallbackI::getUpPseudoCost, ControlCallbackI::getUpPseudoCost,ControlCallbackI::getValue, ControlCallbackI::getValue,ControlCallbackI::getValue, ControlCallbackI::getValues,ControlCallbackI::getValues, ControlCallbackI::isSOSFeasible,ControlCallbackI::isSOSFeasibleInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbent<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 740


IloCplex::SolveCallbackIInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::SolveCallbackI can be used to solve noderelaxations during branch & cut search. It allows you to set a starting point for the solveor to select the algorithm on a per-node basis.The methods of this class are protected for use in deriving a user-written callback classand in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.See AlsoConstructorsMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::ControlCallbackI, IloCplex::OptimizationCallbackI,ILOSOLVECALLBACK0protected SolveCallbackI(IloEnv env)This constructor creates a callback for use in an application for solving the node LPsduring branch & cut searches.protected IloCplex::CplexStatus getCplexStatus() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 741


IloCplex::SolveCallbackIThis method returns the <strong>ILOG</strong> <strong>CPLEX</strong> status of the instance of IloCplex at thecurrent node (that is, the state of the optimizer at the node) during the last call tosolve (which may have been called directly in the callback or by IloCplex whenprocessing the node).The enumeration IloCplex::CplexStatus lists the possible status values.protected IloAlgorithm::Status getStatus() constThis method returns the status of the solution found by the instance of IloCplex atthe current node during the last call to solve (which may have been called directly inthe callback or by IloCplex when processing the node).The enumeration IloAlgorithm::Status lists the possible status values.protected IloBool isDualFeasible() constThis method returns IloTrue if the solution provided by the last solve call is dualfeasible. Note that an IloFalse return value does not necessarily mean that thesolution is not dual feasible. It simply means that the relevant algorithm was not able toconclude it was dual feasible when it terminated.protected IloBool isPrimalFeasible() constThis method returns IloTrue if the solution provided by the last solve call is primalfeasible. Note that an IloFalse return value does not necessarily mean that thesolution is not primal feasible. It simply means that the relevant algorithm was not ableto conclude it was primal feasible when it terminated.protected void setVectors(const IloNumArray x,const IloIntVarArray var,const IloNumArray pi,const IloRangeArray rng)This method allows a user to specify a starting point for the following invocation of thesolve method in a solve callback. Zero can be passed for any of the parameters.However, if x is not zero, then var must not be zero either. Similarly, if pi is not zero,then rng must not be zero either.For all variables in var, x[i] specifies the starting value for the variable var[i].Similarly, for all ranged constraints specified in rng, pi[i] specifies the starting dualvalue for rng[i].This information is exploited at the next call to solve, to construct a starting point forthe algorithm.protected void setVectors(const IloNumArray x,const IloNumVarArray var,const IloNumArray pi,const IloRangeArray rng)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 742


IloCplex::SolveCallbackIThis method allows a user to specify a starting point for the following invocation of thesolve method in a solve callback. Zero can be passed for any of the parameters.However, if x is not zero, then var must not be zero either. Similarly, if pi is not zero,then rng must not be zero either.For all variables in var, x[i] specifies the starting value for the variable var[i].Similarly, for all ranged constraints specified in rng, pi[i] specifies the starting dualvalue for rng[i].This information is exploited at the next call to solve, to construct a starting point forthe algorithm.protected IloBool solve(IloCplex::Algorithm alg=Dual)This method uses the algorithm alg to solve the current node LP. SeeIloCplex::Algorithm for a choice of algorithms to use.protected void useSolution()A call to this method instructs IloCplex to use the solution generated with thiscallback.If useSolution is not called, IloCplex uses the algorithm selected with theparameters IloCplex::RootAlg for the solution of the root, orIloCplex::NodeAlg to solve the node.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 743


IloCplex::StringParamIloCplex::StringParamCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hStringParam{WorkDir};The enumeration IloCplex::StringParam lists the parameters of <strong>CPLEX</strong> thatrequire a character string as a value. Use these values with the methodsIloCplex::getParam and IloCplex::setParam.See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameter Table and the <strong>ILOG</strong> <strong>CPLEX</strong> User's<strong>Manual</strong> for more information about these parameters. Also see the user's manual forexamples of their use.IloCplexWorkDir= CPX_PARAM_WORKDIR<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 744


IloCplex::TuningCallbackIIloCplex::TuningCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedTuningCallbackI(IloEnv env)Method Summaryprotected IloNumgetProgress() constInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionSee AlsoConstructorsAn instance of a class derived from TuningCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex. The callback is calledperiodically during tuning. This class enables you to access information on the progressof tuning.IloCplex, IloCplex::Callback, IloCplex::CallbackI,ILOTUNINGCALLBACK0protected TuningCallbackI(IloEnv env)This constructor creates a callback for use in an application to monitor tuning progress.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 745


IloCplex::TuningCallbackIMethodsprotected IloNum getProgress() constThis method returns the fraction of completion of the tuning process.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 746


IloCplex::TuningStatusIloCplex::TuningStatusCategoryDefinition FileSynopsisInner Enumerationilcplex/ilocplexi.hTuningStatus{TuningComplete,TuningAbort,TuningTimeLim};Description This enumeration lists the values that are returned by tuneParam.◆ TuningComplete◆ TuningAbort◆ TuningTimeLimThe value ConflictExcluded is internal, undocumented, not available to users.FieldsTuningCompleteTuningAbortTuningTimeLim<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 747


IloCplex::UnknownExtractableExceptionIloCplex::UnknownExtractableExceptionCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summarypublic IloExtractablegetExtractable() constInherited methods from IloCplex::ExceptionException::getStatusInherited methods from IloExceptionIloException::end, IloException::getMessageDescriptionMethodsAn instance of this exception is thrown by IloCplex when an operation is attemptedusing an extractable that has not been extracted.public IloExtractable getExtractable() constThis method returns the offending extractable object.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 748


IloCplex::UserCutCallbackIIloCplex::UserCutCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hInherited methods from IloCplex::CutCallbackIadd, addLocalInherited methods from IloCplex::ControlCallbackIControlCallbackI::getDownPseudoCost, ControlCallbackI::getDownPseudoCost,ControlCallbackI::getFeasibilities, ControlCallbackI::getFeasibilities,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getLB, ControlCallbackI::getLB,ControlCallbackI::getLBs, ControlCallbackI::getLBs,ControlCallbackI::getNodeData, ControlCallbackI::getObjValue,ControlCallbackI::getSlack, ControlCallbackI::getSlacks,ControlCallbackI::getUB, ControlCallbackI::getUB,ControlCallbackI::getUBs, ControlCallbackI::getUBs,ControlCallbackI::getUpPseudoCost, ControlCallbackI::getUpPseudoCost,ControlCallbackI::getValue, ControlCallbackI::getValue,ControlCallbackI::getValue, ControlCallbackI::getValues,ControlCallbackI::getValues, ControlCallbackI::isSOSFeasible,ControlCallbackI::isSOSFeasibleInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreads<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 749


IloCplex::UserCutCallbackIInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::UserCutCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a MIP whilegenerating user cuts to tighten the LP relaxation. IloCplex calls the user-writtencallback after solving each node LP exactly like IloCplex::CutCallbackI. Itdiffers from IloCplex::CutCallbackI only in that constraints added in a<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 750


IloCplex::UserCutCallbackIUserCutCallbackI must be real cuts in the sense that omitting them does not affectthe feasible region of the model under consideration.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 751


IloCplex::VariableSelectIloCplex::VariableSelectCategoryDefinition FileSynopsisDescriptionSee AlsoFieldsInner Enumerationilcplex/ilocplexi.hVariableSelect{MinInfeas,DefaultVarSel,MaxInfeas,Pseudo,Strong,PseudoReduced};The enumeration IloCplex::VariableSelect lists values that the parameterIloCplex::VarSel can assume in IloCplex. Use these values with the methodIloCplex::setParam(IloCplex::VarSel, value).See the reference manual <strong>ILOG</strong> <strong>CPLEX</strong> Parameters and the <strong>ILOG</strong> <strong>CPLEX</strong> User's<strong>Manual</strong> for more information about these parameters. Also see the user's manual forexamples of their use.IloCplexMinInfeas= CPX_VARSEL_MININFEASDefaultVarSel= CPX_VARSEL_DEFAULTMaxInfeas= CPX_VARSEL_MAXINFEASPseudo= CPX_VARSEL_PSEUDOStrong= CPX_VARSEL_STRONGPseudoReduced= CPX_VARSEL_PSEUDOREDUCED<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 752


IloCplex::VariableSelectGroup optim.cplex.cpp.advancedThe advanced methods of the <strong>API</strong> of <strong>ILOG</strong> <strong>CPLEX</strong> for users of <strong>C++</strong>.Classes SummaryIloCplex::BranchCallbackIIloCplex::ControlCallbackIIloCplex::CutCallbackIIloCplex::GoalIloCplex::GoalIIloCplex::HeuristicCallbackIIloCplex::IncumbentCallbackIIloCplex::LazyConstraintCallbackIIloCplex::NodeCallbackIIloCplex::SolveCallbackIIloCplex::UserCutCallbackIDescriptionThese are advanced methods. Advanced methods typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higher risk ofincorrect behavior in your application, behavior that can be difficult to debug. Therefore,<strong>ILOG</strong> encourages you to consider carefully whether you can accomplish the same taskby means of other methods instead.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 753


IloCplex::BranchCallbackIIloCplex::BranchCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedBranchCallbackI(IloEnv env)Method Summaryprotected IloNumprotectedBranchCallbackI::BranchTypeprotected IloIntprotected NodeIdprotected IloBoolprotected NodeIdgetBranch(IloNumVarArray vars,IloNumArraybounds,IloCplex::BranchDirectionArraydirs,IloInt i) constgetBranchType() constgetNbranches() constgetNodeId() constisIntegerFeasible() constmakeBranch(const IloConstraintArraycons,const IloIntVarArray vars,constIloNumArray bounds,constIloCplex::BranchDirectionArray dirs,IloNumobjestimate,NodeData * data=0)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 754


IloCplex::BranchCallbackIprotected NodeIdprotected NodeIdprotected NodeIdprotected NodeIdprotected NodeIdprotected NodeIdprotected NodeIdprotected voidmakeBranch(const IloConstraintArraycons,const IloNumVarArray vars,constIloNumArray bounds,constIloCplex::BranchDirectionArray dirs,IloNumobjestimate,NodeData * data=0)makeBranch(const IloConstraint con,IloNumobjestimate,NodeData * data=0)makeBranch(const IloConstraintArraycons,IloNum objestimate,NodeData * data=0)makeBranch(const IloIntVar var,IloNumbound,IloCplex::BranchDirection dir,IloNumobjestimate,NodeData * data=0)makeBranch(const IloNumVar var,IloNumbound,IloCplex::BranchDirection dir,IloNumobjestimate,NodeData * data=0)makeBranch(const IloIntVarArray vars,constIloNumArray bounds,constIloCplex::BranchDirectionArray dirs,IloNumobjestimate,NodeData * data=0)makeBranch(const IloNumVarArray vars,constIloNumArray bounds,constIloCplex::BranchDirectionArray dirs,IloNumobjestimate,NodeData * data=0)prune()Inherited methods from IloCplex::ControlCallbackIControlCallbackI::getDownPseudoCost, ControlCallbackI::getDownPseudoCost,ControlCallbackI::getFeasibilities, ControlCallbackI::getFeasibilities,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getLB, ControlCallbackI::getLB,ControlCallbackI::getLBs, ControlCallbackI::getLBs,ControlCallbackI::getNodeData, ControlCallbackI::getObjValue,ControlCallbackI::getSlack, ControlCallbackI::getSlacks,ControlCallbackI::getUB, ControlCallbackI::getUB,ControlCallbackI::getUBs, ControlCallbackI::getUBs,ControlCallbackI::getUpPseudoCost, ControlCallbackI::getUpPseudoCost,ControlCallbackI::getValue, ControlCallbackI::getValue,ControlCallbackI::getValue, ControlCallbackI::getValues,ControlCallbackI::getValues, ControlCallbackI::isSOSFeasible,ControlCallbackI::isSOSFeasible<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 755


IloCplex::BranchCallbackIInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::main<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 756


IloCplex::BranchCallbackIInner EnumerationBranchCallbackI::BranchTypeDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::BranchCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a mixed integerprogram (MIP). The user-written callback is called prior to branching at a node in thebranch & cut tree during the optimization of a MIP. It allows you to query how theinvoking instance of IloCplex is about to create subnodes at the current node andgives you the option to override the selection made by the invoking instance ofIloCplex. You can create zero, one, or two branches.◆◆◆The method prune removes the current node from the search tree. No subnodesfrom the current node will be added to the search tree.The method makeBranch tells an instance of IloCplex how to create asubproblem. You may call this method zero, one, or two times in every invocation ofthe branch callback. If you call it once, it creates one node; it you call it twice, itcreates two nodes (one node at each call).If you call neither IloCplex::BranchCallBackI::prune norIloCplex::BranchCallBackI::makeBranch, the instance of IloCplexproceeds with its own selection.◆ Calling both IloCplex::BranchCallBackI::prune andIloCplex::BranchCallBackI::makeBranch in one invocation of abranch callback is an error and results in unspecified behavior.The methods of this class are for use in deriving a user-written callback class and inimplementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.See AlsoILOBRANCHCALLBACK0, IloCplex::BranchDirection,IloCplex::Callback, IloCplex::CallbackI,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 757


IloCplex::BranchCallbackIIloCplex::MIPCallbackI, IloCplex::ControlCallbackI,IloCplex::OptimizationCallbackIConstructorsMethodsprotected BranchCallbackI(IloEnv env)This constructor creates a branch callback, that is, a control callback for splitting a nodeinto two branches.protected IloNum getBranch(IloNumVarArray vars,IloNumArray bounds,IloCplex::BranchDirectionArray dirs,IloInt i) constThis method accesses branching information for the i-th branch that the invokinginstance of IloCplex is about to create. The parameter i must be between 0 (zero)and (getNbranches - 1); that is, it must be a valid index of a branch; normally, itwill be zero or one.A branch is normally defined by a set of variables and the bounds for these variables.Branches that are more complex cannot be queried. The return value is the node estimatefor that branch.◆◆The parameter vars contains the variables for which new bounds will be set in thei-th branch.The parameter bounds contains the new bounds for the variables listed in vars;that is, bounds[j] is the new bound for vars[j].◆ The parameter dirs specifies the branching direction for the variables in vars.dir[j] == IloCplex::BranchUpmeans that bounds[j] specifies a lower bound for vars[j].dirs[j] == IloCplex::BranchDownmeans that bounds[j] specifies an upper bound for vars[j].protected BranchCallbackI::BranchType getBranchType() constThis method returns the type of branchingnode.protected IloInt getNbranches() constIloCplex is going to do for the currentThis method returns the number of branches IloCplex is going to create at the currentnode.protected NodeId getNodeId() constReturns the NodeId of the current node.protected IloBool isIntegerFeasible() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 758


IloCplex::BranchCallbackIThis method returns IloTrue if the solution of the current node is integer feasible.protected NodeId makeBranch(const IloConstraintArray cons,const IloIntVarArray vars,const IloNumArray bounds,const IloCplex::BranchDirectionArray dirs,IloNum objestimate,NodeData * data=0)This method offers the same facilities as the other methodsIloCplex::BranchCallbackI::makeBranch, but for a branch specified by aset of constraints and a set of variables.protected NodeId makeBranch(const IloConstraintArray cons,const IloNumVarArray vars,const IloNumArray bounds,const IloCplex::BranchDirectionArray dirs,IloNum objestimate,NodeData * data=0)This method offers the same facilities as the other methodsIloCplex::BranchCallbackI::makeBranch, but for a branch specified by aset of constraints and a set of variables.protected NodeId makeBranch(const IloConstraint con,IloNum objestimate,NodeData * data=0)This method offers the same facilities for a branch specified by only one constraint asIloCplex::BranchCallbackI::makeBranch does for a branch specified by aset of constraints.protected NodeId makeBranch(const IloConstraintArray cons,IloNum objestimate,NodeData * data=0)This method overrides the branch chosen by an instance of IloCplex, by specifying abranch on constraints. A method named makeBranch can be called zero, one, or twotimes in every invocation of the branch callback. If you call it once, it creates one node;it you call it twice, it creates two nodes (one node at each call). If you call it more thantwice, it throws an exception.◆◆The parameter cons specifies an array of constraints that are to be added for thesubnode being created.The parameter objestimate provides an estimate of the resulting optimalobjective value for the subnode specified by this branch. The invoking instance ofIloCplex may use this estimate to select nodes to process. Providing a wrongestimate will not influence the correctness of the solution, but it may influenceperformance. Using the objective value of the current node is usually a safe choice.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 759


IloCplex::BranchCallbackI◆The parameter data allows you to add an object of typeIloCplex::MIPCallbackI::NodeData to the node representing the branchcreated by the makeBranch call. Such data objects must be instances of a userwrittensubclass of IloCplex::MIPCallbackI::NodeData.protected NodeId makeBranch(const IloIntVar var,IloNum bound,IloCplex::BranchDirection dir,IloNum objestimate,NodeData * data=0)For a branch specified by only one variable, this method offers the same facilities asIloCplex::BranchCallbackI::makeBranch for a branch specified by a setof variables.protected NodeId makeBranch(const IloNumVar var,IloNum bound,IloCplex::BranchDirection dir,IloNum objestimate,NodeData * data=0)For a branch specified by only one variable, this method offers the same facilities asIloCplex::BranchCallbackI::makeBranch for a branch specified by a setof variables.protected NodeId makeBranch(const IloIntVarArray vars,const IloNumArray bounds,const IloCplex::BranchDirectionArray dirs,IloNum objestimate,NodeData * data=0)This method overrides the branch chosen by an instance of IloCplex. A methodnamed makeBranch can be called zero, one, or two times in every invocation of thebranch callback. If you call it once, it creates one node; it you call it twice, it creates twonodes (one node at each call). If you call it more than twice, it throws an exception.Each call specifies a branch; in other words, it instructs the invoking IloCplex objecthow to create a subnode from the current node by specifying new, tighter bounds for aset of variables.◆◆The parameter vars contains the variables for which new bounds will be set in thebranch.The parameter bounds contains the new bounds for the variables listed in vars;that is, bounds[j] is the new bound to be set for vars[j].◆ The parameter dirs specifies the branching direction for the variables in vars.dir[j] == IloCplex::BranchUpmeans that bounds[j] specifies a lower bound for vars[j].dirs[j] == IloCplex::BranchDown<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 760


IloCplex::BranchCallbackImeans that bounds[j] specifies an upper bound for vars[j].◆◆The parameter objestimate provides an estimate of the resulting optimalobjective value for the subnode specified by this branch. The invoking instance ofIloCplex may use this estimate to select nodes to process. Providing a wrongestimate will not influence the correctness of the solution, but it may influenceperformance. Using the objective value of the current node is usually a safe choice.The parameter data allows you to add an object of typeIloCplex::MIPCallbackI::NodeData to the node representing the branchcreated by the makeBranch call. Such data objects must be instances of a userwrittensubclass of IloCplex::MIPCallbackI::NodeData.protected NodeId makeBranch(const IloNumVarArray vars,const IloNumArray bounds,const IloCplex::BranchDirectionArray dirs,IloNum objestimate,NodeData * data=0)This method overrides the branch chosen by an instance of IloCplex. A methodnamed makeBranch can be called zero, one, or two times in every invocation of thebranch callback. If you call it once, it creates one node; it you call it twice, it creates twonodes (one node at each call). If you call it more than twice, it throws an exception.Each call specifies a branch; in other words, it instructs the invoking IloCplex objecthow to create a subnode from the current node by specifying new, tighter bounds for aset of variables.◆◆The parameter vars contains the variables for which new bounds will be set in thebranch.The parameter bounds contains the new bounds for the variables listed in vars;that is, bounds[j] is the new bound to be set for vars[j].◆ The parameter dirs specifies the branching direction for the variables in vars.dir[j] == IloCplex::BranchUpmeans that bounds[j] specifies a lower bound for vars[j].dirs[j] == IloCplex::BranchDownmeans that bounds[j] specifies an upper bound for vars[j].◆The parameter objestimate provides an estimate of the resulting optimalobjective value for the subnode specified by this branch. The invoking instance ofIloCplex may use this estimate to select nodes to process. Providing a wrongestimate will not influence the correctness of the solution, but it may influenceperformance. Using the objective value of the current node is usually a safe choice.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 761


IloCplex::BranchCallbackI◆The parameter data allows you to add an object of typeIloCplex::MIPCallbackI::NodeData to the node representing the branchcreated by the makeBranch call. Such data objects must be instances of a userwrittensubclass of IloCplex::MIPCallbackI::NodeData.protected void prune()By calling this method, you instruct the <strong>CPLEX</strong> branch & cut search not to create anychild nodes from the current node, or, in other words, to discard nodes below the currentnode; it does not revisit the discarded nodes below the current node. In short, it createsno branches. It is an error to call both prune and makeBranch in one invocation of acallback.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 762


IloCplex::ControlCallbackIIloCplex::ControlCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summaryprotected IloNumprotected IloNumprotected voidprotected voidprotectedControlCallbackI::IntegerFeasibilityprotectedControlCallbackI::IntegerFeasibilityControlCallbackI::getDownPseudoCost(constIloIntVar var) constControlCallbackI::getDownPseudoCost(constIloNumVar var) constControlCallbackI::getFeasibilities(ControlCallbackI::IntegerFeasibilityArray stat,constIloIntVarArray var) constControlCallbackI::getFeasibilities(ControlCallbackI::IntegerFeasibilityArray stat,constIloNumVarArray var) constControlCallbackI::getFeasibility(constIloIntVar var) constControlCallbackI::getFeasibility(constIloNumVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 763


IloCplex::ControlCallbackIprotectedControlCallbackI::IntegerFeasibilityprotectedControlCallbackI::IntegerFeasibilityprotected IloNumprotected IloNumprotected voidprotected voidprotected NodeData *protected IloNumprotected IloNumprotected voidprotected IloNumprotected IloNumprotected voidprotected voidprotected IloNumprotected IloNumprotected IloNumprotected IloNumprotected IloNumprotected voidprotected voidprotected IloBoolprotected IloBoolControlCallbackI::getFeasibility(constIloSOS2 sos) constControlCallbackI::getFeasibility(constIloSOS1 sos) constControlCallbackI::getLB(const IloIntVar var)constControlCallbackI::getLB(const IloNumVar var)constControlCallbackI::getLBs(IloNumArrayval,const IloIntVarArray vars) constControlCallbackI::getLBs(IloNumArrayval,const IloNumVarArray vars) constControlCallbackI::getNodeData() constControlCallbackI::getObjValue() constControlCallbackI::getSlack(const IloRangerng) constControlCallbackI::getSlacks(IloNumArrayval,const IloRangeArray con) constControlCallbackI::getUB(const IloIntVar var)constControlCallbackI::getUB(const IloNumVar var)constControlCallbackI::getUBs(IloNumArrayval,const IloIntVarArray vars) constControlCallbackI::getUBs(IloNumArrayval,const IloNumVarArray vars) constControlCallbackI::getUpPseudoCost(constIloIntVar var) constControlCallbackI::getUpPseudoCost(constIloNumVar var) constControlCallbackI::getValue(const IloIntVarvar) constControlCallbackI::getValue(const IloNumVarvar) constControlCallbackI::getValue(const IloExprArgexpr) constControlCallbackI::getValues(IloNumArrayval,const IloIntVarArray vars) constControlCallbackI::getValues(IloNumArrayval,const IloNumVarArray vars) constControlCallbackI::isSOSFeasible(constIloSOS2 sos2) constControlCallbackI::isSOSFeasible(constIloSOS1 sos1) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 764


IloCplex::ControlCallbackIInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::main<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 765


IloCplex::ControlCallbackIInner EnumerationControlCallbackI::IntegerFeasibilityInner ClassControlCallbackI::ControlCallbackI::PresolvedVariableExceptionInner Type DefControlCallbackI::ControlCallbackI::IntegerFeasibilityArrayDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.This class defines the common application programming interface (<strong>API</strong>) for thefollowing classes that allow you to control the MIP search:◆◆◆IloCplex::SolveCallbackIIloCplex::CutCallbackIIloCplex::HeuristicCallbackI◆ IloCplex::BranchCallbackIAn instance of one of these classes represents a user-written callback that intervenes inthe search for a solution at a given node in an application that uses an instance ofIloCplex to solve a mixed integer program (MIP). Control callbacks are tied to anode. They are called at each node during IloCplex branch & cut search. The user<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 766


IloCplex::ControlCallbackInever subclasses the IloCplex::ControlCallbackI class directly; it onlydefines the common interface of thosee listed callbacks.In particular, SolveCallbackI is called before solving the node relaxation andoptionally allows substitution of its solution. IloCplex does this by default. After thenode relaxation has been solved, either by an instance of SolveCallbackI or byIloCplex, the other control callbacks are called in the following order:◆◆IloCplex::CutCallbackIIloCplex::HeuristicCallbackI◆ IloCplex::BranchCallbackIIf the cut callback added new cuts to the node relaxation, the node relaxation will besolved again using the solve callback, if used. The same is true if IloCplex generatedits own cuts.The methods of this class are protected and its constructor is private; you cannot directlysubclass this class; you must derive from its subclasses.If an attempt is made to access information not available to an instance of this class, anexception is thrown.See AlsoMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,ControlCallbackI::IntegerFeasibility,ControlCallbackI::IntegerFeasibilityArray,IloCplex::MIPCallbackI, IloCplex::OptimizationCallbackIprotected IloNum getDownPseudoCost(const IloIntVar var) constThis method returns the current pseudo cost for branching downward on the variablevar.protected IloNum getDownPseudoCost(const IloNumVar var) constThis method returns the current pseudo cost for branching downward on the variablevar.protected void getFeasibilities(ControlCallbackI::IntegerFeasibilityArraystat,const IloIntVarArray var) constThis method specifies whether each of the variables in the array vars is integerfeasible, integer infeasible, or implied integer feasible by putting the status in thecorresponding element of the array stats.protected void getFeasibilities(ControlCallbackI::IntegerFeasibilityArraystat,const IloNumVarArray var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 767


IloCplex::ControlCallbackIThis method specifies whether each of the variables in the array vars is integerfeasible, integer infeasible, or implied integer feasible by putting the status in thecorresponding element of the array stats.protected ControlCallbackI::IntegerFeasibility getFeasibility(constIloIntVar var) constThis method specifies whether the variable var is integer feasible, integer infeasible, orimplied integer feasible in the current node solution.protected ControlCallbackI::IntegerFeasibility getFeasibility(constIloNumVar var) constThis method specifies whether the variable var is integer feasible, integer infeasible, orimplied integer feasible in the current node solution.protected ControlCallbackI::IntegerFeasibility getFeasibility(constIloSOS2 sos) constThis method specifies whether the Special Ordered Set sos is integer feasible, integerinfeasible, or implied integer feasible in the current node solution.protected ControlCallbackI::IntegerFeasibility getFeasibility(constIloSOS1 sos) constThis method specifies whether the Special Ordered Set sos is integer feasible, integerinfeasible, or implied integer feasible in the current node solution.protected IloNum getLB(const IloIntVar var) constThis method returns the lower bound of var at the current node. This bound is likely tobe different from the bound in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes. The correspondingsolution value from getValue may violate this bound at a node where a newincumbent has been found because the bound is tightened when an incumbent is found.Unbounded VariablesIf a variable lacks a lower bound, then getLB returns a value greater than or equal to -IloInfinity for greater than or equal to constraints with no lower bound.protected IloNum getLB(const IloNumVar var) constThis method returns the lower bound of var at the current node. This bound is likely tobe different from the bound in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes. The correspondingsolution value from getValue may violate this bound at a node where a newincumbent has been found because the bound is tightened when an incumbent is found.Unbounded VariablesIf a variable lacks a lower bound, then getLB returns a value greater than or equal to -IloInfinity for greater than or equal to constraints with no lower bound.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 768


IloCplex::ControlCallbackIprotected void getLBs(IloNumArray val,const IloIntVarArray vars) constFor each element of the array vars, this method puts the lower bound at the currentnode into the corresponding element of the array vals. These bounds are likely to bedifferent from the bounds in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes. The correspondingsolution values from getValues may violate these bounds at a node where a newincumbent has been found because the bounds are tightened when an incumbent isfound.Unbounded VariablesIf a variable lacks a lower bound, then getLBs returns a value greater than or equal to-IloInfinity for greater than or equal to constraints with no lower bound.protected void getLBs(IloNumArray val,const IloNumVarArray vars) constThis method puts the lower bound at the current node of each element of the array varsinto the corresponding element of the array vals. These bounds are likely to bedifferent from the bounds in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes. The correspondingsolution values from getValues may violate these bounds at a node where a newincumbent has been found because the bounds are tightened when an incumbent isfound.Unbounded VariablesIf a variable lacks a lower bound, then getLBs returns a value greater than or equal to-IloInfinity for greater than or equal to constraints with no lower bound.protected NodeData * getNodeData() constThis method retrieves the NodeData object that may have previously been assigned tothe current node by the user with the methodIloCplex::BranchCallbackI::makeBranch. If no data object has beenassigned to the current node, 0 (zero) will be returned.protected IloNum getObjValue() constThis method returns the objective value of the solution of the relaxation at the currentnode.If you need the object representing the objective itself, consider the methodgetObjective instead.protected IloNum getSlack(const IloRange rng) constThis method returns the slack value for the constraint specified by rng in the solutionof the relaxation at the current node.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 769


IloCplex::ControlCallbackIprotected void getSlacks(IloNumArray val,const IloRangeArray con) constFor each of the constraints in the array of ranges rngs, this method puts the slack valuein the solution of the relaxation at the current node into the corresponding element ofthe array vals.protected IloNum getUB(const IloIntVar var) constThis method returns the upper bound of the variable var at the current node. Thisbound is likely to be different from the bound in the original model because an instanceof IloCplex tightens bounds when it branches from a node to its subnodes. Thecorresponding solution value from getValue may violate this bound at a node where anew incumbent has been found because the bound is tightened when an incumbent isfound.Unbounded VariablesIf a variable lacks an upper bound, then getUB returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.protected IloNum getUB(const IloNumVar var) constThis method returns the upper bound of the variable var at the current node. Thisbound is likely to be different from the bound in the original model because an instanceof IloCplex tightens bounds when it branches from a node to its subnodes. Thecorresponding solution value from getValue may violate this bound at a node where anew incumbent has been found because the bound is tightened when an incumbent isfound.Unbounded VariablesIf a variable lacks an upper bound, then getUB returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.protected void getUBs(IloNumArray val,const IloIntVarArray vars) constFor each element in the array vars, this method puts the upper bound at the currentnode into the corresponding element of the array vals. The bounds are those in therelaxation at the current node. These bounds are likely to be different from the boundsin the original model because an instance of IloCplex tightens bounds when itbranches from a node to its subnodes. The corresponding solution values fromgetValues may violate these bounds at a node where a new incumbent has beenfound because the bounds are tightened when an incumbent is found.Unbounded VariablesIf a variable lacks an upper bound, then getUBs returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.protected void getUBs(IloNumArray val,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 770


IloCplex::ControlCallbackIconst IloNumVarArray vars) constFor each element in the array vars, this method puts the upper bound at the currentnode into the corresponding element of the array vals. The bounds are those in therelaxation at the current node. These bounds are likely to be different from the boundsin the original model because an instance of IloCplex tightens bounds when itbranches from a node to its subnodes. The corresponding solution values fromgetValues may violate these bounds at a node where a new incumbent has beenfound because the bounds are tightened when an incumbent is found.Unbounded VariablesIf a variable lacks an upper bound, then getUBs returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.protected IloNum getUpPseudoCost(const IloIntVar var) constThis method returns the current pseudo cost for branching upward on the variable var.protected IloNum getUpPseudoCost(const IloNumVar var) constThis method returns the current pseudo cost for branching upward on the variable var.protected IloNum getValue(const IloIntVar var) constThis method returns the value of the variable var in the solution of the relaxation at thecurrent node.protected IloNum getValue(const IloNumVar var) constThis method returns the value of the variable var in the solution of the relaxation at thecurrent node.protected IloNum getValue(const IloExprArg expr) constThis method returns the value of the expression expr in the solution of the relaxationat the current node.protected void getValues(IloNumArray val,const IloIntVarArray vars) constFor each variable in the array vars, this method puts the value in the solution of therelaxation at the current node into the corresponding element of the array vals.protected void getValues(IloNumArray val,const IloNumVarArray vars) constFor each variable in the array vars, this method puts the value in the solution of therelaxation at the current node into the corresponding element of the array vals.protected IloBool isSOSFeasible(const IloSOS2 sos2) constThis method returns IloTrue if the solution of the LP at the current node is SOSfeasible for the special ordered set specified in its argument. The SOS set passed as a<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 771


IloCplex::ControlCallbackIparameter to this method may be of type 2. See the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong> formore explanation of types of special ordered sets.protected IloBool isSOSFeasible(const IloSOS1 sos1) constThis method returns IloTrue if the solution of the LP at the current node is SOSfeasible for the special ordered set specified in its argument. The SOS set passed as aparameter to this method may be of type 1. See the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong> formore explanation about these types of special ordered sets.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 772


IloCplex::CutCallbackIIloCplex::CutCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedCutCallbackI(IloEnv env)Method Summaryprotected IloConstraintprotected IloConstraintadd(IloConstraint con)addLocal(IloConstraint con)Inherited methods from IloCplex::ControlCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 773


IloCplex::CutCallbackIControlCallbackI::getDownPseudoCost, ControlCallbackI::getDownPseudoCost,ControlCallbackI::getFeasibilities, ControlCallbackI::getFeasibilities,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getLB, ControlCallbackI::getLB,ControlCallbackI::getLBs, ControlCallbackI::getLBs,ControlCallbackI::getNodeData, ControlCallbackI::getObjValue,ControlCallbackI::getSlack, ControlCallbackI::getSlacks,ControlCallbackI::getUB, ControlCallbackI::getUB,ControlCallbackI::getUBs, ControlCallbackI::getUBs,ControlCallbackI::getUpPseudoCost, ControlCallbackI::getUpPseudoCost,ControlCallbackI::getValue, ControlCallbackI::getValue,ControlCallbackI::getValue, ControlCallbackI::getValues,ControlCallbackI::getValues, ControlCallbackI::isSOSFeasible,ControlCallbackI::isSOSFeasibleInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbent<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 774


IloCplex::CutCallbackIInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::CutCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a mixed integerprogramming problem (a MIP). This class offers a method to add a local or global cut tothe current node LP subproblem from a user-written callback. More than one cut can beadded in this callback by calling the method add or addLocal multiple times. Alladded cuts must be linear.The constructor and methods of this class are protected for use in deriving a user-writtencallback class and in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.See AlsoConstructorsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPCallbackI, IloCplex::ControlCallbackI,IloCplex::OptimizationCallbackI, ILOCUTCALLBACK0protected CutCallbackI(IloEnv env)This constructor creates a callback for use in an application with a user-defined cut tosolve a MIP.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 775


IloCplex::CutCallbackIMethodsprotected IloConstraint add(IloConstraint con)This method adds a cut to the current node LP subproblem for the constraint specified bycon. This cut must be globally valid; it will not be removed by backtracking or anyother means during the search. The added cut must be linear.protected IloConstraint addLocal(IloConstraint con)This method adds a local cut to the current node LP subproblem for the constraintspecified by con. IloCplex will manage the local cut in such a way that it will beactive only when processing nodes of this subtree. The added cut must be linear.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 776


IloCplex::GoalIloCplex::GoalCategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicpublicpublicpublicpublicGoal(GoalBaseI * goalI)Goal(const Goal & goal)Goal()Goal(IloConstraint cut)Goal(IloConstraintArray cut)Method Summarypublic Goaloperator=(const Goal & goal)DescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.Goals can be used to control the branch & cut search in IloCplex. Goals areimplemented in the class IloCplex::GoalI. This is the handle class for <strong>CPLEX</strong>goals.Goal objects are reference-counted. This means every instance of IloCplex::GoalIkeeps track about how many handle objects refer to it. If this number drops to 0 (zero)the IloCplex::GoalI object is automatically deleted. As a consequence, wheneveryou deal with a goal, you must keep a handle object around, rather than only a pointer to<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 777


IloCplex::Goalthe implementation object. Otherwise, you risk ending up with a pointer to animplementation object that has already been deleted.See Goals among the Concepts in this manual. See also goals in the <strong>ILOG</strong> <strong>CPLEX</strong>User's <strong>Manual</strong>.Constructorspublic Goal(GoalBaseI * goalI)Creates a new goal from a pointer to the implementation object.public Goal(const Goal & goal)This is the copy constructor of the goal.public Goal()Creates a 0 goal handle, that is, a goal with a 0 implementation object pointer. This isalso referred to as an empty goal.public Goal(IloConstraint cut)Creates a new goal that will add the constraint cut as a local cut to the node where thegoal is executed. As a local cut, the constraint will be active only in the subtree rootedat the node where the goal was executed. The lifetime of the constraint passed to a goalis tied to the lifetime of the Goal. That is, the constraint's method end is called whenthe goal's implementation object is deleted. As a consequence, the method end must notbe called for constraints passed to this constructor explicitly.public Goal(IloConstraintArray cut)Creates a new goal that adds the constraints given in the array cut as local cuts to thenode where the goal is executed. As local cuts, the constraints will be active only in thesubtree rooted at the node where the goal was executed. The lifetime of the constraintsand the array passed to a goal is tied to the lifetime of the Goal. That is, the constraint'smethod end is called when the goal's implementation object is deleted. As aconsequence, method end must not be called for the constraints and the array passed tothis constructor explicitly.Methodspublic Goal operator=(const Goal & goal)This is the assignment operator. It increases the reference count of the implementationobject of goal. If the invoking handle referred to an implementation object before theassignment operation, its reference count is decreased. If thereby the reference countbecomes 0, the implementation object is deleted.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 778


IloCplex::GoalIIloCplex::GoalICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummarypublicGoalI(IloEnv env)Method Summarypublic voidpublic static IloCplex::Goalpublic static IloCplex::Goalpublic virtualIloCplex::Goalpublic virtualIloCplex::Goalpublic static IloCplex::Goalpublic IloNumpublic IloNumpublic GoalI::BranchTypepublic IloNumpublicIloCplex::BranchDirectionpublicIloCplex::BranchDirectionpublic IloNumpublic IloNumpublic IloEnvabort()AndGoal(IloCplex::Goal goal1,IloCplex::Goalgoal2)BranchAsCplexGoal(IloEnv env)duplicateGoal()execute()FailGoal(IloEnv env)getBestObjValue() constgetBranch(IloNumVarArray vars,IloNumArraybounds,IloCplex::BranchDirectionArraydirs,IloInt i) constgetBranchType() constgetCutoff() constgetDirection(const IloIntVar var)getDirection(const IloNumVar var)getDownPseudoCost(const IloIntVar var) constgetDownPseudoCost(const IloNumVar var) constgetEnv() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 779


IloCplex::GoalIpublic voidpublic voidpublicGoalI::IntegerFeasibilitypublicGoalI::IntegerFeasibilitypublicGoalI::IntegerFeasibilitypublicGoalI::IntegerFeasibilitypublic IloNumpublic IloNumpublic IloNumpublic voidpublic voidpublic IloNumpublic IloNumpublic voidpublic voidpublic IloModelpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloIntpublic IloNumpublic IloNumgetFeasibilities(GoalI::IntegerFeasibilityArray stats,const IloIntVarArray vars) constgetFeasibilities(GoalI::IntegerFeasibilityArray stats,const IloNumVarArray vars) constgetFeasibility(const IloSOS2 sos) constgetFeasibility(const IloSOS1 sos) constgetFeasibility(const IloIntVar var) constgetFeasibility(const IloNumVar var) constgetIncumbentObjValue() constgetIncumbentValue(const IloIntVar var) constgetIncumbentValue(const IloNumVar var) constgetIncumbentValues(IloNumArray val,constIloIntVarArray vars) constgetIncumbentValues(IloNumArray val,constIloNumVarArray vars) constgetLB(const IloIntVar var) constgetLB(const IloNumVar var) constgetLBs(IloNumArray vals,const IloIntVarArrayvars) constgetLBs(IloNumArray vals,const IloNumVarArrayvars) constgetModel() constgetMyThreadNum() constgetNbranches() constgetNcliques() constgetNcols() constgetNcovers() constgetNdisjunctiveCuts() constgetNflowCovers() constgetNflowPaths() constgetNfractionalCuts() constgetNGUBcovers() constgetNimpliedBounds() constgetNiterations() constgetNMIRs() constgetNnodes() constgetNremainingNodes() constgetNrows() constgetObjCoef(const IloIntVar var) constgetObjCoef(const IloNumVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 780


IloCplex::GoalIpublic voidpublic voidpublic IloNumpublic IloNumpublic IloNumpublic IloNumpublic voidpublic IloNumpublic IloNumpublic voidpublic voidpublic IloNumpublic IloNumpublic IloIntpublic IloNumpublic IloNumpublic IloNumpublic voidpublic voidpublic static IloCplex::Goalpublic static IloCplex::Goalpublic IloBoolpublic IloBoolpublic IloBoolpublic IloBoolpublic static IloCplex::Goalpublic static IloCplex::Goalpublic static IloCplex::GoalgetObjCoefs(IloNumArray vals,constIloIntVarArray vars) constgetObjCoefs(IloNumArray vals,constIloNumVarArray vars) constGoalI::getObjValue() constgetPriority(const IloIntVar var) constgetPriority(const IloNumVar var) constgetSlack(const IloRange rng) constgetSlacks(IloNumArray vals,constIloRangeArray rngs) constgetUB(const IloIntVar var) constgetUB(const IloNumVar var) constgetUBs(IloNumArray vals,const IloIntVarArrayvars) constgetUBs(IloNumArray vals,const IloNumVarArrayvars) constgetUpPseudoCost(const IloIntVar var) constgetUpPseudoCost(const IloNumVar var) constgetUserThreads() constgetValue(const IloIntVar var) constgetValue(const IloNumVar var) constgetValue(const IloExpr expr) constgetValues(IloNumArray vals,constIloIntVarArray vars) constgetValues(IloNumArray vals,constIloNumVarArray vars) constGlobalCutGoal(IloConstraintArray con)GlobalCutGoal(IloConstraint con)hasIncumbent() constisIntegerFeasible() constisSOSFeasible(const IloSOS2 sos2) constisSOSFeasible(const IloSOS1 sos1) constOrGoal(IloCplex::Goal goal1,IloCplex::Goalgoal2)SolutionGoal(const IloIntVarArray vars,constIloNumArray vals)SolutionGoal(const IloNumVarArray vars,constIloNumArray vals)Inner EnumerationGoalI::BranchType<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 781


IloCplex::GoalIGoalI::IntegerFeasibilityInner Type DefGoalI::GoalI::IntegerFeasibilityArrayDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.Goals can be used to control the branch & cut search in IloCplex. Goals areimplemented in subclasses of the class IloCplex::GoalI. This is the base class foruser-written implementation classes of <strong>CPLEX</strong> goals.To implement your own goal you need to create a subclass of IloCplex::GoalI andimplement its pure virtual methods execute and duplicateGoal. You may useone of the ILO<strong>CPLEX</strong>GOAL0 macros to assist you in doing so. After implementingyour goal class, you use an instance of the class by passing it to the solve methodwhen solving the model.The method duplicateGoal may be called by IloCplex to create copies of a goalwhen needed for parallel branch & cut search. Thus the implementation of this methodmust create and return an exact copy of the invoked object itself.The method execute controls the branch & cut search of IloCplex by the goal itreturns. When IloCplex processes a node, it pops the top goal from the node's goalstack and calls method execute of that goal. It continues executing the top goal fromthe stack until the node is deactivated or the goal stack is empty. If the goal stack isempty, IloCplex proceeds with the built-in search strategy for the subtree rooted atthe current node.The class IloCplex::GoalI provides several methods for querying informationabout the current node. The method execute controls how to proceed with the branch& cut search via the goal it returns. The returned goal, unless it is the 0 goal, is pushedon the goal stack and will thus be executed next.See also the chapter about goals in the <strong>ILOG</strong> <strong>CPLEX</strong> User's <strong>Manual</strong>.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 782


IloCplex::GoalIConstructorsMethodspublic GoalI(IloEnv env)The goal constructor. It requires an instance of the same IloEnv as the IloCplexobject with which to use the goal. The environment can later be queried by callingmethod getEnv.public void abort()Abort the optimization, that is, the execution of method solve currently in process.public static IloCplex::Goal AndGoal(IloCplex::Goal goal1,IloCplex::Goal goal2)The static methods AndGoal all return a goal that pushes the goals passed asparameters onto the goal stack in reverse order. As a consequence, the goals will beexecuted in the order they are passed as parameters to the AndGoal function.public static IloCplex::Goal BranchAsCplexGoal(IloEnv env)This static function returns a goal that creates the same branches as the currentlyselected built-in branch strategy of IloCplex would choose at the current node. Thisgoal allows you to proceed with the IloCplex search strategy, but keeps the searchunder goal control, thereby giving you the option to intervene at any point.This goal is also important when you use node evaluators while you use a built-inbranching strategy.For example, consider the execute method of a goal starting like this:if (!isIntegerFeasible())return AndGoal(BranchAsCplexGoal(getEnv()), this);// do somethingIt would do something only when IloCplex found a solution it considers to be acandidate for a new incumbent. Note there is a test of integer feasibility before returningBranchAsCplexGoal. Without the test, BranchAsCplex would be executed for asolution IloCplex considers to be feasible, but IloCplex would not know how tobranch on it. An endless loop would result.public virtual IloCplex::Goal duplicateGoal()This virtual method must be implemented by the user. It must return a copy of theinvoking goal object. This method may be called by IloCplex when doing parallelbranch & cut search.public virtual IloCplex::Goal execute()This virtual method must be implemented by the user to specify the logic of the goal.The instance of IloCplex::Goal returned by this method will be added to the goalstack of the node where the invoking goal is being executed for further execution.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 783


IloCplex::GoalIpublic static IloCplex::Goal FailGoal(IloEnv env)This static method creates a goal that fails. That means that the branch where the goal isexecuted will be pruned or, equivalently, the search is discontinued at that node and thenode is discarded.public IloNum getBestObjValue() constThis method returns the currently best known bound on the optimal solution value of theproblem at the time the invoking goal is executed by an instance of IloCplex whilesolving a MIP. When a model has been solved to optimality, this value matches theoptimal solution value. Otherwise, this value is computed for a minimization(maximization) problem as the minimum (maximum) objective function value of allremaining unexplored nodes.public IloNum getBranch(IloNumVarArray vars,IloNumArray bounds,IloCplex::BranchDirectionArray dirs,IloInt i) constThis method accesses branching information for the i-th branch that the invokinginstance of IloCplex is about to create. The parameter i must be between 0 (zero)and getNbranches - 1; that is, it must be a valid index of a branch; normally, itwill be zero or one.A branch is normally defined by a set of variables and the bounds for these variables.Branches that are more complex cannot be queried. The return value is the node estimatefor that branch.◆◆The parameter vars contains the variables for which new bounds will be set in thei-th branch.The parameter bounds contains the new bounds for the variables listed in vars;that is, bounds[j] is the new bound for vars[j].◆ The parameter dirs specifies the branching direction for the variables in vars.dir[j] == IloCplex::BranchUpmeans that bounds[j] specifies a lower bound for vars[j].dirs[j] == IloCplex::BranchDownmeans that bounds[j] specifies an upper bound for vars[j].public GoalI::BranchType getBranchType() constThis method returns the type of branchingnode.public IloNum getCutoff() constIloCplex is going to do for the current<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 784


IloCplex::GoalIThe method returns the current cutoff value. An instance of IloCplex uses the cutoffvalue (the value of the objective function of the subproblem at a node in the search tree)to decide when to prune nodes from the search tree (that is, when to cut off that nodeand discard the nodes beyond it). The cutoff value is updated whenever a new incumbentis found.public IloCplex::BranchDirection getDirection(const IloIntVar var)This method returns the branch direction previously assigned to variable var withmethod IloCplex::setDirection or IloCplex::setDirections. Ifnodirection has been assigned, IloCplex::BranchGlobal will be returned.public IloCplex::BranchDirection getDirection(const IloNumVar var)This method returns the branch direction previously assigned to variable var withmethod IloCplex::setDirection or IloCplex::setDirections. Ifnodirection has been assigned, IloCplex::BranchGlobal will be returned.public IloNum getDownPseudoCost(const IloIntVar var) constThis method returns the current pseudo cost for branching downward on the variablevar.public IloNum getDownPseudoCost(const IloNumVar var) constThis method returns the current pseudo cost for branching downward on the variablevar.public IloEnv getEnv() constReturns the instance of IloEnv passed to the constructor of the goal.public void getFeasibilities(GoalI::IntegerFeasibilityArray stats,const IloIntVarArray vars) constThis method considers whether each of the variables in the array vars is integerfeasible, integer infeasible, or implied integer feasible and puts the status in thecorresponding element of the array stats.public void getFeasibilities(GoalI::IntegerFeasibilityArray stats,const IloNumVarArray vars) constThis method considers whether each of the variables in the array vars is integerfeasible, integer infeasible, or implied integer feasible and puts the status in thecorresponding element of the array stats.public GoalI::IntegerFeasibility getFeasibility(const IloSOS2 sos) constThis method specifies whether the SOS sos is integer feasible, integer infeasible, orimplied integer feasible in the current node solution.public GoalI::IntegerFeasibility getFeasibility(const IloSOS1 sos) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 785


IloCplex::GoalIThis method specifies whether the SOS sos is integer feasible, integer infeasible, orimplied integer feasible in the current node solution.public GoalI::IntegerFeasibility getFeasibility(const IloIntVar var) constThis method specifies whether the variable var is integer feasible, integer infeasible, orimplied integer feasible in the current node solution.public GoalI::IntegerFeasibility getFeasibility(const IloNumVar var) constThis method specifies whether the variable var is integer feasible, integer infeasible, orimplied integer feasible in the current node solution.public IloNum getIncumbentObjValue() constThis method returns the value of the objective function of the incumbent solution (thatis, the best integer solution found so far). If there is no incumbent, this method throws anexception.public IloNum getIncumbentValue(const IloIntVar var) constThis method returns the value of var in the incumbent solution. If there is noincumbent, this method throws an exception.public IloNum getIncumbentValue(const IloNumVar var) constThis method returns the value of var in the incumbent solution. If there is noincumbent, this method throws an exception.public void getIncumbentValues(IloNumArray val,const IloIntVarArray vars) constReturns the value of each variable in the array vars with respect to the currentincumbent solution, and it puts those values into the corresponding array vals. Ifthere is no incumbent, this method throws an exception.public void getIncumbentValues(IloNumArray val,const IloNumVarArray vars) constReturns the value of each variable in the array vars with respect to the currentincumbent solution, and it puts those values into the corresponding array vals. Ifthere is no incumbent, this method throws an exception.public IloNum getLB(const IloIntVar var) constThis method returns the lower bound of var in the current node relaxation. This boundis likely to be different from the bound in the original model because an instance ofIloCplex tightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks a lower bound, then getLB returns a value greater than or equal to -IloInfinity for greater than or equal to constraints with no lower bound.public IloNum getLB(const IloNumVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 786


IloCplex::GoalIThis method returns the lower bound of var in the current node relaxation. This boundis likely to be different from the bound in the original model because an instance ofIloCplex tightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks a lower bound, then getLB returns a value greater than or equal to -IloInfinity for greater than or equal to constraints with no lower bound.public void getLBs(IloNumArray vals,const IloIntVarArray vars) constThis method puts the lower bound in the current node relaxation of each element of thearray vars into the corresponding element of the array vals. These bounds are likelyto be different from the bounds in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks a lower bound, then getLBs returns a value greater than or equal to-IloInfinity for greater than or equal to constraints with no lower bound.public void getLBs(IloNumArray vals,const IloNumVarArray vars) constThis method puts the lower bound in the current node relaxation of each element of thearray vars into the corresponding element of the array vals. These bounds are likelyto be different from the bounds in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks a lower bound, then getLBs returns a value greater than or equal to-IloInfinity for greater than or equal to constraints with no lower bound.public IloModel getModel() constThis method returns the model currently extracted for the instance of IloCplex wherethe invoking goal applies.public IloInt getMyThreadNum() constReturns the identifier of the parallel thread being currently executed. This number isbetween 0 (zero) and the value returned by the method getUserThreads()-1.public IloInt getNbranches() constThis method returns the number of branches IloCplex is going to create at the currentnode.public IloInt getNcliques() constReturns the total number of clique cuts that have been added to the model so far duringthe current optimization.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 787


IloCplex::GoalIpublic IloInt getNcols() constThis method returns the number of columns in the current optimization model.public IloInt getNcovers() constReturns the total number of cover cuts that have been added to the model so far duringthe current optimization.public IloInt getNdisjunctiveCuts() constReturns the total number of disjunctive cuts that have been added to the model so farduring the current optimization.public IloInt getNflowCovers() constReturns the total number of flow cover cuts that have been added to the model so farduring the current optimization.public IloInt getNflowPaths() constReturns the total number of flow path cuts that have been added to the model so farduring the current optimization.public IloInt getNfractionalCuts() constReturns the total number of fractional cuts that have been added to the model so farduring the current optimization.public IloInt getNGUBcovers() constReturns the total number of GUB cover cuts that have been added to the model so farduring the current optimization.public IloInt getNimpliedBounds() constReturns the total number of implied bound cuts that have been added to the model so farduring the current optimization.public IloInt getNiterations() constReturns the total number of iterations executed so far during the current optimization tosolve the node relaxations.public IloInt getNMIRs() constReturns the total number of MIR cuts that have been added to the model so far duringthe current optimization.public IloInt getNnodes() constThis method returns the number of nodes already processed in the current optimization.public IloInt getNremainingNodes() constThis method returns the number of nodes left to explore in the current optimization.public IloInt getNrows() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 788


IloCplex::GoalIThis method returns the number of rows in the current optimization model.public IloNum getObjCoef(const IloIntVar var) constReturns the linear objective coefficient for var in the model currently being solved.public IloNum getObjCoef(const IloNumVar var) constReturns the linear objective coefficient for var in the model currently being solved.public void getObjCoefs(IloNumArray vals,const IloIntVarArray vars) constThis method puts the linear objective coefficient of each of the variables in the arrayvars into the corresponding element of the array vals.public void getObjCoefs(IloNumArray vals,const IloNumVarArray vars) constThis method puts the linear objective coefficient of each of the variables in the arrayvars into the corresponding element of the array vals.public IloNum getObjValue() constThis method returns the objective value of the solution of the current node.If you need the object representing the objective itself, consider the methodgetObjective instead.public IloNum getPriority(const IloIntVar var) constReturns the branch priority used for variable var in the current optimization.public IloNum getPriority(const IloNumVar var) constReturns the branch priority used for variable var in the current optimization.public IloNum getSlack(const IloRange rng) constThis method returns the slack value for the constraint specified by rng in the solutionof the current node relaxation.public void getSlacks(IloNumArray vals,const IloRangeArray rngs) constThis method puts the slack value in the solution of the current node relaxation of eachof the constraints in the array of ranges rngs into the corresponding element of thearray vals.public IloNum getUB(const IloIntVar var) constThis method returns the upper bound of the variable var in the current node relaxation.This bound is likely to be different from the bound in the original model because aninstance of IloCplex tightens bounds when it branches from a node to its subnodes.Unbounded Variables<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 789


IloCplex::GoalIIf a variable lacks an upper bound, then getUB returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.public IloNum getUB(const IloNumVar var) constThis method returns the upper bound of the variable var in the current node relaxation.This bound is likely to be different from the bound in the original model because aninstance of IloCplex tightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks an upper bound, then getUB returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.public void getUBs(IloNumArray vals,const IloIntVarArray vars) constThis method puts the upper bound in the current node relaxation of each element of thearray vars into the corresponding element of the array vals. These bounds are likelyto be different from the bounds in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks an upper bound, then getUBs returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.public void getUBs(IloNumArray vals,const IloNumVarArray vars) constThis method puts the upper bound in the current node relaxation of each element of thearray vars into the corresponding element of the array vals. These bounds are likelyto be different from the bounds in the original model because an instance of IloCplextightens bounds when it branches from a node to its subnodes.Unbounded VariablesIf a variable lacks an upper bound, then getUBs returns a value less than or equal toIloInfinity for less than or equal to constraints with no lower bound.public IloNum getUpPseudoCost(const IloIntVar var) constThis method returns the current pseudo cost for branching upward on the variable var.public IloNum getUpPseudoCost(const IloNumVar var) constThis method returns the current pseudo cost for branching upward on the variable var.public IloInt getUserThreads() constThis method returns the total number of parallel threads currently running.public IloNum getValue(const IloIntVar var) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 790


IloCplex::GoalIThis method returns the value of the variable var in the solution of the current noderelaxation.public IloNum getValue(const IloNumVar var) constThis method returns the value of the variable var in the solution of the current noderelaxation.public IloNum getValue(const IloExpr expr) constThis method returns the value of the expression expr in the solution of the current noderelaxation.public void getValues(IloNumArray vals,const IloIntVarArray vars) constThis method puts the current node relaxation solution value of each variable in the arrayvars into the corresponding element of the array vals.public void getValues(IloNumArray vals,const IloNumVarArray vars) constThis method puts the current node relaxation solution value of each variable in the arrayvars into the corresponding element of the array vals.public static IloCplex::Goal GlobalCutGoal(IloConstraintArray con)This method creates a goal that when executed adds the constraints (provided in theparamter array con) as global cuts to the model. These global cuts must be valid for theentire model, not only for the current subtree. In other words, these global cuts will berespected at every node.IloCplex takes over memory managment for the cuts passed to the methodGlobalCutGoal. Thus IloCplex will call the method end as soon as it can bediscarded after the goal executes. Calling end yourself or the constraints in the arraycon passed to method GlobalCutGoal or the array itself is an error and must beavoided.public static IloCplex::Goal GlobalCutGoal(IloConstraint con)This method creates a goal that when executed adds the constraint con (provided as aparameter) as global cuts to the model. These global cuts must be valid for the entiremodel, not only for the current subtree. In other words, these global cuts will berespected at every node.IloCplex takes over memory managment for the cut passed to the methodGlobalCutGoal. Thus IloCplex will call the method end as soon as it can bediscarded after the goal executes. Calling end yourself for the constraint passed tomethod GlobalCutGoal is an error and must be avoided.public IloBool hasIncumbent() constThis method returns IloTrue if an integer feasible solution has been found.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 791


IloCplex::GoalIpublic IloBool isIntegerFeasible() constThis method returns IloTrue if the solution of the current node is integer feasible.public IloBool isSOSFeasible(const IloSOS2 sos2) constThis method returns IloTrue if the solution of the current node is SOS feasible for thespecial ordered set specified in its argument. The SOS passed as a parameter to thismethod must be of type 2; the equivalent method for an SOS of type 1 is also available.See the User's <strong>Manual</strong> for more about these types of special ordered sets.public IloBool isSOSFeasible(const IloSOS1 sos1) constThis method returns IloTrue if the solution of the current node is SOS feasible for thespecial ordered set specified in its argument. The SOS passed as a parameter to thismethod must be of type 1; the equivalent method for an SOS of type 2 is also available.See the User's <strong>Manual</strong> for more about these types of special ordered sets.public static IloCplex::Goal OrGoal(IloCplex::Goal goal1,IloCplex::Goal goal2)The static methods OrGoal all return a goal that creates as many branches (or,equivalently, subproblems) as there are parameters. Each of the subnodes will beinitialized with the remaining goal stack of the current node. In addition, the goalparameter will be pushed on the goal stack of the corresponding subgoal. If more thansix branches need to be created, instances of OrGoal can be combined.public static IloCplex::Goal SolutionGoal(const IloIntVarArray vars,const IloNumArray vals)This static method creates and returns a goal that attempts to inject a solution specifiedby setting the variables listed in array vars to the corresponding values listed in thearray vals.IloCplex will not blindly accept such a solution as a new incumbent. Instead, it willmake sure that this solution is compatible with both the model and the goals. Whenchecking feasibility with goals, it checks feasibility with both the goals that have alreadybeen executed and the goals that are still on the goal stack. Thus, in particular,IloCplex will reject any solution that is not compatible with the branching that hasbeen done so far.IloCplex takes over memory managment for arrays vars and vals passed toSolutionGoal. Thus IloCplex will call method end for these arrays as soon asthey can be discarded. Calling end for the arrays passed to SolutionGoal is anerror and must be avoided.public static IloCplex::Goal SolutionGoal(const IloNumVarArray vars,const IloNumArray vals)This static method creates and returns a goal that attempts to inject a solution specifiedby setting the variables listed in array vars to the corresponding values listed in thearray vals.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 792


IloCplex::GoalIIloCplex will not blindly accept such a solution as a new incumbent. Instead, it willmake sure that this solution is compatible with both the model and the goals. Whenchecking feasibility with goals, it checks feasibility with both the goals that have alreadybeen executed and the goals that are still on the goal stack. Thus, in particular,IloCplex will reject any solution that is not compatible with the branching that hasbeen done so far.IloCplex takes over memory managment for arrays vars and vals passed toSolutionGoal. Thus IloCplex will call method end for these arrays as soon asthey can be discarded. Calling end for the arrays passed to SolutionGoal is anerror and must be avoided.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 793


IloCplex::HeuristicCallbackIIloCplex::HeuristicCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod SummaryprotectedIloCplex::CplexStatusprotectedIloAlgorithm::Statusprotected IloBoolprotected IloBoolprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidgetCplexStatus() constgetStatus() constisDualFeasible() constisPrimalFeasible() constsetBounds(const IloIntVarArray var,constIloNumArray lb,const IloNumArray ub)setBounds(const IloNumVarArray var,constIloNumArray lb,const IloNumArray ub)setBounds(const IloIntVar var,IloNumlb,IloNum ub)setBounds(const IloNumVar var,IloNumlb,IloNum ub)setSolution(const IloIntVarArray vars,constIloNumArray vals,IloNum obj)setSolution(const IloIntVarArray vars,constIloNumArray vals)setSolution(const IloNumVarArray vars,constIloNumArray vals,IloNum obj)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 794


IloCplex::HeuristicCallbackIprotected voidprotected IloBoolsetSolution(const IloNumVarArray vars,constIloNumArray vals)solve(IloCplex::Algorithm alg=Dual)Inherited methods from IloCplex::ControlCallbackIControlCallbackI::getDownPseudoCost, ControlCallbackI::getDownPseudoCost,ControlCallbackI::getFeasibilities, ControlCallbackI::getFeasibilities,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getLB, ControlCallbackI::getLB,ControlCallbackI::getLBs, ControlCallbackI::getLBs,ControlCallbackI::getNodeData, ControlCallbackI::getObjValue,ControlCallbackI::getSlack, ControlCallbackI::getSlacks,ControlCallbackI::getUB, ControlCallbackI::getUB,ControlCallbackI::getUBs, ControlCallbackI::getUBs,ControlCallbackI::getUpPseudoCost, ControlCallbackI::getUpPseudoCost,ControlCallbackI::getValue, ControlCallbackI::getValue,ControlCallbackI::getValue, ControlCallbackI::getValues,ControlCallbackI::getValues, ControlCallbackI::isSOSFeasible,ControlCallbackI::isSOSFeasibleInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 795


IloCplex::HeuristicCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::HeuristicCallbackI represents a userwrittencallback in an application that uses an instance of IloCplex to solve a mixedinteger programming problem (MIP). When you derive a user-defined class ofcallbacks, this class offers protected methods for you to:◆◆◆give the instance of IloCplex a potential new incumbent solution;query the instance of IloCplex about the solution status for the current node;query the instance of IloCplex about the variable bounds at the current node;<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 796


IloCplex::HeuristicCallbackI◆◆change bounds temporarily on a variable or group of variables at the current node;re-solve the problem at the node with the changed bounds;◆ use all the query functions inherited from parent classes.During branching, the heuristic callback is called after each node subproblem has beensolved, including any cuts that may have been newly generated. Before branching, at theroot node, the heuristic callback is also called before each round of cuts is added to theproblem and re-solved.In short, this callback allows you to attempt to construct an integer feasible solution at anode and pass it to the invoking instance of IloCplex to use as its new incumbent.The <strong>API</strong> supports you in finding such a solution by allowing you iteratively to changebounds of the variables and re-solve the node relaxation. Changing the bounds in theheuristic callback has no effect on the search beyond the termination of the callback.If an attempt is made to access information not available at the node for the invokinginstance of IloCplex, an exception is thrown.See AlsoMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::ControlCallbackI, IloCplex::MIPCallbackI,IloCplex::OptimizationCallbackI, ILOHEURISTICCALLBACK0protected IloCplex::CplexStatus getCplexStatus() constThis method returns the <strong>ILOG</strong> <strong>CPLEX</strong> status of the instance of IloCplex at thecurrent node (that is, the state of the optimizer at the node) during the last call tosolve (which may have been called directly in the callback or by IloCplex whenprocessing the node).The enumeration IloCplex::CplexStatus lists the possible status values.protected IloAlgorithm::Status getStatus() constThis method returns the status of the solution found by the instance of IloCplex at thecurrent node during the last call to solve (which may have been called directly in thecallback or by IloCplex when processing the node).The enumeration IloAlgorithm::Status lists the possible status values.protected IloBool isDualFeasible() constThis method returns IloTrue if the solution provided by the last solve call is dualfeasible. Note that an IloFalse return value does not necessarily mean that thesolution is not dual feasible. It simply means that the relevant algorithm was not able toconclude it was dual feasible when it terminated.protected IloBool isPrimalFeasible() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 797


IloCplex::HeuristicCallbackIThis method returns IloTrue if the solution provided by the last solve call is primalfeasible. Note that an IloFalse return value does not necessarily mean that thesolution is not primal feasible. It simply means that the relevant algorithm was not ableto conclude it was primal feasible when it terminated.protected void setBounds(const IloIntVarArray var,const IloNumArray lb,const IloNumArray ub)For each variable in the array var, this method sets its upper bound to thecorresponding value in the array ub and its lower bound to the corresponding value inthe array lb, provided var has not been removed by presolve. Setting bounds has noeffect beyond the scope of the current invocation of the callback.When using this method, you must avoid changing the bounds of a variable that hasbeen removed by presolve. To check whether presolve is off, consider the parameterIloCplex::PreInd. Alternatively, you can check whether a particular variable hasbeen removed by presolve by checking the status of the variable. To do so, callIloCplex::ControlCallback::getFeasibilities. A variable that hasbeen removed by presolve will have the status ImpliedFeasible.protected void setBounds(const IloNumVarArray var,const IloNumArray lb,const IloNumArray ub)For each variable in the array var, this method sets its upper bound to thecorresponding value in the array ub and its lower bound to the corresponding value inthe array lb, provided the variable has not been removed by presolve. Setting boundshas no effect beyond the scope of the current invocation of the callback.protected void setBounds(const IloIntVar var,IloNum lb,IloNum ub)This method sets the lower bound to lb and the upper bound to ub for the variable varat the current node, provided var has not been removed by presolve. Setting boundshas no effect beyond the scope of the current invocation of the callback.When using this method, you must avoid changing the bounds of a variable that hasbeen removed by presolve. To check whether presolve is off, consider the parameterIloCplex::PreInd. Alternatively, you can check whether a particular variable hasbeen removed by presolve by checking the status of the variable. To do so, callIloCplex::ControlCallback::getFeasibilities. A variable that hasbeen removed by presolve will have the status ImpliedFeasible.protected void setBounds(const IloNumVar var,IloNum lb,IloNum ub)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 798


IloCplex::HeuristicCallbackIThis method sets the lower bound to lb and the upper bound to ub for the variable varat the current node, provided var has not been removed by presolve. Setting boundshas no effect beyond the scope of the current invocation of the callback.When using this method, you must avoid changing the bounds of a variable that hasbeen removed by presolve. To check whether presolve is off, consider the parameterIloCplex::PreInd. Alternatively, you can check whether a particular variable hasbeen removed by presolve by checking the status of the variable. To do so, callIloCplex::ControlCallback::getFeasibilities. A variable that hasbeen removed by presolve will have the status ImpliedFeasible.protected void setSolution(const IloIntVarArray vars,const IloNumArray vals,IloNum obj)For each variable in the array vars, this method uses the value in the correspondingelement of the array vals to define a heuristic solution to be considered as a newincumbent.If the user heuristic was successful in finding a new candidate for an incumbent,setSolution can be used to pass it over to IloCplex. IloCplex then analysesthe solution and, if it is both feasible and better than the current incumbent, uses it asthe new incumbent. A solution is specified using arrays vars and vals, wherevals[i] specifies the solution value for vars[i].The parameter obj is used to tell IloCplex the objective value of the injectedsolution. This allows IloCplex to skip the computation of that value, but care mustbe taken not to provide an incorrect value.Do not call this method multiple times. Calling it again will overwrite any previouslyspecified solution.protected void setSolution(const IloIntVarArray vars,const IloNumArray vals)For each variable in the array vars, this method uses the value in the correspondingelement of the array vals to define a heuristic solution to be considered as a newincumbent.If the user heuristic was successful in finding a new candidate for an incumbent,setSolution can be used to pass it over to IloCplex. IloCplex then analysesthe solution and, if it is both feasible and better than the current incumbent, uses it asthe new incumbent. A solution is specified using arrays vars and vals, wherevals[i] specifies the solution value for vars[i].Do not call this method multiple times. Calling it again will overwrite any previouslyspecified solution.protected void setSolution(const IloNumVarArray vars,const IloNumArray vals,<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 799


IloCplex::HeuristicCallbackIIloNum obj)For each variable in the array vars, this method uses the value in the correspondingelement of the array vals to define a heuristic solution to be considered as a newincumbent.If the user heuristic was successful in finding a new candidate for an incumbent,setSolution can be used to pass it over to IloCplex. IloCplex then analysesthe solution and, if it is both feasible and better than the current incumbent, uses it asthe new incumbent. A solution is specified using arrays vars and vals, wherevals[i] specifies the solution value for vars[i].The parameter obj is used to tell IloCplex the objective value of the injectedsolution. This allows IloCplex to skip the computation of that value, but care mustbe taken not to provide an incorrect value.Do not call this method multiple times. Calling it again will overwrite any previouslyspecified solution.protected void setSolution(const IloNumVarArray vars,const IloNumArray vals)For each variable in the array vars, this method uses the value in the correspondingelement of the array vals to define a heuristic solution to be considered as a newincumbent.If the user heuristic was successful in finding a new candidate for an incumbent,setSolution can be used to pass it over to IloCplex. IloCplex then analysesthe solution and, if it is both feasible and better than the current incumbent,IloCplex uses it as the new incumbent. A solution is specified using arrays varsand vals, where vals[i] specifies the solution value for vars[i].Do not call this method multiple times. Calling it again will overwrite any previouslyspecified solution.protected IloBool solve(IloCplex::Algorithm alg=Dual)This method can be used to solve the current node relaxation, usually after some boundshave been changed by setBounds. By default it uses the dual simplex algorithm,but this behavior can be overridden by the optional parameter alg. See theenumeration IloCplex::Algorithm for a list of the available optimizers.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 800


IloCplex::IncumbentCallbackIIloCplex::IncumbentCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hMethod Summaryprotected NodeData *protected NodeIdprotected IloNumprotected IloNumprotected voidprotected IloNumprotected IloNumprotected IloNumprotected voidprotected voidprotected voidgetNodeData() constgetNodeId() constIncumbentCallbackI::getObjValue() constgetSlack(const IloRange rng) constgetSlacks(IloNumArray val,constIloRangeArray con) constgetValue(const IloIntVar var) constgetValue(const IloNumVar var) constgetValue(const IloExprArg expr) constgetValues(IloNumArray val,constIloIntVarArray vars) constgetValues(IloNumArray val,constIloNumVarArray vars) constreject()Inherited methods from IloCplex::MIPCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 801


IloCplex::IncumbentCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::main<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 802


IloCplex::IncumbentCallbackIDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.This callback is called whenever a new potential incumbent is found during branch &cut searches. It allows you to analyze the proposed incumbent and optionally reject it. Inthis case, <strong>CPLEX</strong> will continue the branch & cut search. This callback is thus typicallycombined with a branch callback that instructs <strong>CPLEX</strong> how to branch on a node after ithas found a potential incumbent and thus considered the node solution to be integerfeasible.See AlsoMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPCallbackI, IloCplex::OptimizationCallbackI,ILOINCUMBENTCALLBACK0protected NodeData * getNodeData() constThis method retrieves the NodeData object that may have previously been assigned tothe current node by the user with methodIloCplex::BranchCallbackI::makeBranch. If no data object has beenassigned to the current node, 0 will be returned.protected NodeId getNodeId() constThis method returns the NodeId of the current node.protected IloNum getObjValue() constThis method returns the query objective value of the potential incumbent.If you need the object representing the objective itself, consider the methodgetObjective instead.protected IloNum getSlack(const IloRange rng) constThis method returns the slack value for the range specified by rng for the potentialincumbent.protected void getSlacks(IloNumArray val,const IloRangeArray con) constThis method puts the slack value for each range in the array of ranges con into thecorresponding element of the array val for the potential incumbent. For this <strong>CPLEX</strong>resizes array val to match the size of array con.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 803


IloCplex::IncumbentCallbackIprotected IloNum getValue(const IloIntVar var) constThis method returns the query value of the variable var in the potential incumbentsolution.protected IloNum getValue(const IloNumVar var) constThis method returns the value of the variable var in the potential incumbent solution.protected IloNum getValue(const IloExprArg expr) constThis method returns the value of the expr for the potential incumbent solution.protected void getValues(IloNumArray val,const IloIntVarArray vars) constThis method returns the query values of the variables in the array vars in the potentialincumbent solution and copies them to val. <strong>CPLEX</strong> automatically resizes the arrayval to match the size of the array vars.protected void getValues(IloNumArray val,const IloNumVarArray vars) constThis method returns the query values of the variables in the array vars in the potentialincumbent solution and copies them to val. <strong>CPLEX</strong> automatically resizes the arrayval to match the length of the array vars.protected void reject()This method rejects the proposed incumbent.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 804


IloCplex::LazyConstraintCallbackIIloCplex::LazyConstraintCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hInherited methods from IloCplex::CutCallbackIadd, addLocalInherited methods from IloCplex::ControlCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 805


IloCplex::LazyConstraintCallbackIControlCallbackI::getDownPseudoCost, ControlCallbackI::getDownPseudoCost,ControlCallbackI::getFeasibilities, ControlCallbackI::getFeasibilities,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getLB, ControlCallbackI::getLB,ControlCallbackI::getLBs, ControlCallbackI::getLBs,ControlCallbackI::getNodeData, ControlCallbackI::getObjValue,ControlCallbackI::getSlack, ControlCallbackI::getSlacks,ControlCallbackI::getUB, ControlCallbackI::getUB,ControlCallbackI::getUBs, ControlCallbackI::getUBs,ControlCallbackI::getUpPseudoCost, ControlCallbackI::getUpPseudoCost,ControlCallbackI::getValue, ControlCallbackI::getValue,ControlCallbackI::getValue, ControlCallbackI::getValues,ControlCallbackI::getValues, ControlCallbackI::isSOSFeasible,ControlCallbackI::isSOSFeasibleInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbent<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 806


IloCplex::LazyConstraintCallbackIInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::LazyConstraintCallbackI represents auser-written callback in an application that uses an instance of IloCplex to solve aMIP while generating lazy constraints. IloCplex calls the user-written callback aftersolving each node LP exactly like IloCplex::CutCallbackI. In fact, thiscallback is exactly equivalent to IloCplex::CutCallbackI but offers a namemore consistently pointing out the difference between lazy constraints and user cuts.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 807


IloCplex::NodeCallbackIIloCplex::NodeCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedNodeCallbackI(IloEnv env)Method Summaryprotected IloNumVarprotected IloNumVarprotected IloIntprotected IloIntprotected IloNumprotected IloNumprotected IloNumprotected IloNumprotected IloIntprotected IloIntprotected NodeData *protected NodeData *protected NodeIdprotected IloIntgetBranchVar(NodeId nodeid) constgetBranchVar(int node) constgetDepth(NodeId nodeid) constgetDepth(int node) constgetEstimatedObjValue(NodeId nodeid) constgetEstimatedObjValue(int node) constgetInfeasibilitySum(NodeId nodeid) constgetInfeasibilitySum(int node) constgetNinfeasibilities(NodeId nodeid) constgetNinfeasibilities(int node) constgetNodeData(NodeId nodeid) constgetNodeData(int node) constgetNodeId(int node) constgetNodeNumber(NodeId nodeid) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 808


IloCplex::NodeCallbackIprotected IloNumprotected IloNumprotected voidprotected voidNodeCallbackI::getObjValue(NodeId nodeid)constgetObjValue(int node) constselectNode(NodeId nodeid)selectNode(int node)Inherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbentInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrows<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 809


IloCplex::NodeCallbackIInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::NodeCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a mixed integerprogramming problem (a MIP). The methods of this class enable you (from a userderivedcallback class) to query the instance of IloCplex about the next node that itplans to select in the branch & cut search, and optionally to override this selection byspecifying a different node.When an instance of this callback executes, the invoking instance of IloCplex stillhas n = getNremainingNodes (inherited fromIloCplex::MIPCallbackI) nodes left to process. These remaining nodes arenumbered from 0 (zero) to (n - 1). For that reason, the same node may have adifferent number each time an instance of NodeCallbackI is called. To identify anode uniquely, an instance of IloCplex also assigns a unique NodeId to each node.That unique identifier remains unchanged throughout the search. The methodgetNodeId(int i) allows you to access the NodeId for each of the remainingnodes (0 to n-1). Such a query allows you to associate data with individual nodes.The methods of this class are protected for use in deriving a user-written callback classand in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.See AlsoConstructorsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::MIPCallbackI, IloCplex::OptimizationCallbackI,ILONODECALLBACK0protected NodeCallbackI(IloEnv env)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 810


IloCplex::NodeCallbackIThis constructor creates a callback for use in an application with user-defined nodeselection inquiry during branch & cut searches.Methodsprotected IloNumVar getBranchVar(NodeId nodeid) constThis method returns the variable that was branched on last when <strong>CPLEX</strong> created thenode with the identifier nodeid. If that node has been created by branching on aconstraint or on multiple variables, 0 (zero) will be returned.protected IloNumVar getBranchVar(int node) constReturns the variable that was branched on last when creating the node specified by theindex number node. If that node has been created by branching on a constraint or onmultiple variables, 0 (zero) will be returned.protected IloInt getDepth(NodeId nodeid) constThis method returns the depth of the node in the search tree for the node with theidentifier nodeid. The root node has depth 0 (zero). The depth of other nodes isdefined recursively as the depth of their parent node plus one. In other words, the depthof a node is its distance in terms of the number of branches from the root.protected IloInt getDepth(int node) constThis method returns the depth of the node in the search tree. The root node has depth 0(zero). The depth of other nodes is defined recursively as the depth of their parent nodeplus one. In other words, the depth of a node is its distance in terms of the number ofbranches from the root.protected IloNum getEstimatedObjValue(NodeId nodeid) constThis method returns the estimated objective value of the node with the identifier node.protected IloNum getEstimatedObjValue(int node) constThis method returns the estimated objective value of the node specified by the indexnumber node.protected IloNum getInfeasibilitySum(NodeId nodeid) constThis method returns the sum of infeasibility measures at the node with the identifiernodeid.protected IloNum getInfeasibilitySum(int node) constThis method returns the sum of infeasibility measures at the node specified by the indexnumber node.protected IloInt getNinfeasibilities(NodeId nodeid) constThis method returns the number of infeasibilities at the node with the identifiernodeid.protected IloInt getNinfeasibilities(int node) const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 811


IloCplex::NodeCallbackIThis method returns the number of infeasibilities at the node specified by the indexnumber node.protected NodeData * getNodeData(NodeId nodeid) constThis method retrieves the NodeData object that may have previously been assigned bythe user to the node with the identfier nodeid with one of the methodsIloCplex::BranchCallbackI::makeBranch. If no data object has beenassigned to the that node, 0 (zero) will be returned.protected NodeData * getNodeData(int node) constThis method retrieves the NodeData object that may have previously been assigned tothe node with index node by the user with the methodIloCplex::BranchCallbackI::makeBranch. If no data object has beenassigned to the specified node, 0 (zero) will be returned.protected NodeId getNodeId(int node) constThis method returns the node identifier of the node specified by the index number node.During branch & cut, an instance of IloCplex assigns node identifiers sequentiallyfrom 0 (zero) to (getNodes - 1) as it creates nodes. Within a search, these nodeidentifiers are unique throughout the duration of that search. However, at any point, theremaining nodes, (that is, the nodes that have not yet been processed) are stored in anarray in an arbitrary order. This method returns the identifier of the node stored atposition node in that array.protected IloInt getNodeNumber(NodeId nodeid) constReturns the current index number of the node specified by the node identifier nodeid.protected IloNum getObjValue(NodeId nodeid) constThis method returns the objective value of the node with the identifier node.If you need the object representing the objective itself, consider the methodgetObjective instead.protected IloNum getObjValue(int node) constThis method returns the objective value of the node specified by the index numbernode.If you need the object representing the objective itself, consider the methodgetObjective instead.protected void selectNode(NodeId nodeid)This method selects the node with the identifier nodeid and sets it as the next node toprocess in the branch & cut search. The invoking instance of IloCplex uses thespecified node as the next node to process.protected void selectNode(int node)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 812


IloCplex::NodeCallbackIThis method selects the node specified by its index number node and sets it as the nextnode to process in the branch & cut search. The parameter node must be an integerbetween 0 (zero) and (getNremainingNodes - 1).The invoking instance of IloCplex uses the specified node as the next node toprocess.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 813


IloCplex::SolveCallbackIIloCplex::SolveCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hConstructor SummaryprotectedSolveCallbackI(IloEnv env)Method SummaryprotectedIloCplex::CplexStatusprotectedIloAlgorithm::Statusprotected IloBoolprotected IloBoolprotected voidprotected voidprotected IloBoolprotected voidgetCplexStatus() constgetStatus() constisDualFeasible() constisPrimalFeasible() constsetVectors(const IloNumArray x,constIloIntVarArray var,const IloNumArray pi,constIloRangeArray rng)setVectors(const IloNumArray x,constIloNumVarArray var,const IloNumArray pi,constIloRangeArray rng)solve(IloCplex::Algorithm alg=Dual)useSolution()<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 814


IloCplex::SolveCallbackIInherited methods from IloCplex::ControlCallbackIControlCallbackI::getDownPseudoCost, ControlCallbackI::getDownPseudoCost,ControlCallbackI::getFeasibilities, ControlCallbackI::getFeasibilities,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getLB, ControlCallbackI::getLB,ControlCallbackI::getLBs, ControlCallbackI::getLBs,ControlCallbackI::getNodeData, ControlCallbackI::getObjValue,ControlCallbackI::getSlack, ControlCallbackI::getSlacks,ControlCallbackI::getUB, ControlCallbackI::getUB,ControlCallbackI::getUBs, ControlCallbackI::getUBs,ControlCallbackI::getUpPseudoCost, ControlCallbackI::getUpPseudoCost,ControlCallbackI::getValue, ControlCallbackI::getValue,ControlCallbackI::getValue, ControlCallbackI::getValues,ControlCallbackI::getValues, ControlCallbackI::isSOSFeasible,ControlCallbackI::isSOSFeasibleInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbent<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 815


IloCplex::SolveCallbackIInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::SolveCallbackI can be used to solve noderelaxations during branch & cut search. It allows you to set a starting point for the solveor to select the algorithm on a per-node basis.The methods of this class are protected for use in deriving a user-written callback classand in implementing the main method there.If an attempt is made to access information not available to an instance of this class, anexception is thrown.See AlsoConstructorsMethodsIloCplex, IloCplex::Callback, IloCplex::CallbackI,IloCplex::ControlCallbackI, IloCplex::OptimizationCallbackI,ILOSOLVECALLBACK0protected SolveCallbackI(IloEnv env)This constructor creates a callback for use in an application for solving the node LPsduring branch & cut searches.protected IloCplex::CplexStatus getCplexStatus() const<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 816


IloCplex::SolveCallbackIThis method returns the <strong>ILOG</strong> <strong>CPLEX</strong> status of the instance of IloCplex at thecurrent node (that is, the state of the optimizer at the node) during the last call tosolve (which may have been called directly in the callback or by IloCplex whenprocessing the node).The enumeration IloCplex::CplexStatus lists the possible status values.protected IloAlgorithm::Status getStatus() constThis method returns the status of the solution found by the instance of IloCplex atthe current node during the last call to solve (which may have been called directly inthe callback or by IloCplex when processing the node).The enumeration IloAlgorithm::Status lists the possible status values.protected IloBool isDualFeasible() constThis method returns IloTrue if the solution provided by the last solve call is dualfeasible. Note that an IloFalse return value does not necessarily mean that thesolution is not dual feasible. It simply means that the relevant algorithm was not able toconclude it was dual feasible when it terminated.protected IloBool isPrimalFeasible() constThis method returns IloTrue if the solution provided by the last solve call is primalfeasible. Note that an IloFalse return value does not necessarily mean that thesolution is not primal feasible. It simply means that the relevant algorithm was not ableto conclude it was primal feasible when it terminated.protected void setVectors(const IloNumArray x,const IloIntVarArray var,const IloNumArray pi,const IloRangeArray rng)This method allows a user to specify a starting point for the following invocation of thesolve method in a solve callback. Zero can be passed for any of the parameters.However, if x is not zero, then var must not be zero either. Similarly, if pi is not zero,then rng must not be zero either.For all variables in var, x[i] specifies the starting value for the variable var[i].Similarly, for all ranged constraints specified in rng, pi[i] specifies the starting dualvalue for rng[i].This information is exploited at the next call to solve, to construct a starting point forthe algorithm.protected void setVectors(const IloNumArray x,const IloNumVarArray var,const IloNumArray pi,const IloRangeArray rng)<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 817


IloCplex::SolveCallbackIThis method allows a user to specify a starting point for the following invocation of thesolve method in a solve callback. Zero can be passed for any of the parameters.However, if x is not zero, then var must not be zero either. Similarly, if pi is not zero,then rng must not be zero either.For all variables in var, x[i] specifies the starting value for the variable var[i].Similarly, for all ranged constraints specified in rng, pi[i] specifies the starting dualvalue for rng[i].This information is exploited at the next call to solve, to construct a starting point forthe algorithm.protected IloBool solve(IloCplex::Algorithm alg=Dual)This method uses the algorithm alg to solve the current node LP. SeeIloCplex::Algorithm for a choice of algorithms to use.protected void useSolution()A call to this method instructs IloCplex to use the solution generated with thiscallback.If useSolution is not called, IloCplex uses the algorithm selected with theparameters IloCplex::RootAlg for the solution of the root, orIloCplex::NodeAlg to solve the node.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 818


IloCplex::UserCutCallbackIIloCplex::UserCutCallbackICategoryInner ClassInheritancePathDefinition Fileilcplex/ilocplexi.hInherited methods from IloCplex::CutCallbackIadd, addLocalInherited methods from IloCplex::ControlCallbackI<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 819


IloCplex::UserCutCallbackIControlCallbackI::getDownPseudoCost, ControlCallbackI::getDownPseudoCost,ControlCallbackI::getFeasibilities, ControlCallbackI::getFeasibilities,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getFeasibility, ControlCallbackI::getFeasibility,ControlCallbackI::getLB, ControlCallbackI::getLB,ControlCallbackI::getLBs, ControlCallbackI::getLBs,ControlCallbackI::getNodeData, ControlCallbackI::getObjValue,ControlCallbackI::getSlack, ControlCallbackI::getSlacks,ControlCallbackI::getUB, ControlCallbackI::getUB,ControlCallbackI::getUBs, ControlCallbackI::getUBs,ControlCallbackI::getUpPseudoCost, ControlCallbackI::getUpPseudoCost,ControlCallbackI::getValue, ControlCallbackI::getValue,ControlCallbackI::getValue, ControlCallbackI::getValues,ControlCallbackI::getValues, ControlCallbackI::isSOSFeasible,ControlCallbackI::isSOSFeasibleInherited methods from IloCplex::MIPCallbackIMIPCallbackI::getNcliques, MIPCallbackI::getNcovers,MIPCallbackI::getNdisjunctiveCuts, MIPCallbackI::getNflowCovers,MIPCallbackI::getNflowPaths, MIPCallbackI::getNfractionalCuts,MIPCallbackI::getNGUBcovers, MIPCallbackI::getNimpliedBounds,MIPCallbackI::getNMIRs, MIPCallbackI::getObjCoef,MIPCallbackI::getObjCoef, MIPCallbackI::getObjCoefs,MIPCallbackI::getObjCoefs, MIPCallbackI::getUserThreadsInherited methods from IloCplex::MIPInfoCallbackIMIPInfoCallbackI::getBestObjValue, MIPInfoCallbackI::getCutoff,MIPInfoCallbackI::getDirection, MIPInfoCallbackI::getDirection,MIPInfoCallbackI::getIncumbentObjValue,MIPInfoCallbackI::getIncumbentSlack,MIPInfoCallbackI::getIncumbentSlacks,MIPInfoCallbackI::getIncumbentValue, MIPInfoCallbackI::getIncumbentValue,MIPInfoCallbackI::getIncumbentValues,MIPInfoCallbackI::getIncumbentValues, MIPInfoCallbackI::getMyThreadNum,MIPInfoCallbackI::getNiterations, MIPInfoCallbackI::getNnodes,MIPInfoCallbackI::getNremainingNodes, MIPInfoCallbackI::getPriority,MIPInfoCallbackI::getPriority, MIPInfoCallbackI::hasIncumbent<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 820


IloCplex::UserCutCallbackIInherited methods fromIloCplex::OptimizationCallbackIOptimizationCallbackI::getModel, OptimizationCallbackI::getNcols,OptimizationCallbackI::getNQCs, OptimizationCallbackI::getNrowsInherited methods from IloCplex::CallbackICallbackI::abort, CallbackI::duplicateCallback, CallbackI::getEnv,CallbackI::mainDescriptionNote:This is an advanced class. Advanced classes typically demand a profoundunderstanding of the algorithms used by <strong>ILOG</strong> <strong>CPLEX</strong>. Thus they incur a higherrisk of incorrect behavior in your application, behavior that can be difficult todebug. Therefore, <strong>ILOG</strong> encourages you to consider carefully whether you canaccomplish the same task by means of other classes instead.An instance of the class IloCplex::UserCutCallbackI represents a user-writtencallback in an application that uses an instance of IloCplex to solve a MIP whilegenerating user cuts to tighten the LP relaxation. IloCplex calls the user-writtencallback after solving each node LP exactly like IloCplex::CutCallbackI. Itdiffers from IloCplex::CutCallbackI only in that constraints added in aUserCutCallbackI must be real cuts in the sense that omitting them does not affectthe feasible region of the model under consideration.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 821


I N D E XIndexAAborter 557Algorithm 559BBarrierCallbackI 561BasisStatus 563BasisStatusArray 564BoolParam 565BranchCallbackI 567, 754BranchDirection 576BranchDirectionArray 577BranchType 575, 651CCallback 578CallbackI 580CannotExtractException 57CannotRemoveException 59ConflictStatus 586ConflictStatusArray 587ContinuousCallbackI 588ControlCallbackI 591, 763CplexStatus 604CrossoverCallbackI 609CutCallbackI 611, 773CutType 614DDeleteMode 615DisjunctiveCutCallbackI 616DisjunctiveCutInfoCallbackI 619DualPricing 621EException 61, 622FFlowMIRCutCallbackI 624FlowMIRCutInfoCallbackI 627FractionalCutCallbackI 629FractionalCutInfoCallbackI 632GGoal 634, 777GoalI 636, 779HHeuristicCallbackI 654, 794IILO_NO_MEMORY_MANAGER 47<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 822


I NDEXIloAbs 48IloAdd 49IloAlgorithm 50IloAnd 66IloArcCos 70IloArray 71IloBarrier 75ILOBARRIERCALLBACK0 473IloBaseEnvMutex 78IloBool 79IloBoolArray 80IloBoolVar 83IloBoolVarArray 86IloBound 500ILOBRANCHCALLBACK0 474IloCeil 89IloColumnHeaderNotFoundException 369IloCondition 90IloConstraint 93IloConstraintArray 96ILOCONTINUOUSCALLBACK0 475IloConversion 325IloCplex 504ILO<strong>CPLEX</strong>GOAL0 476ILOCROSSOVERCALLBACK0 478IloCsvLine 356IloCsvReader 360IloCsvReaderParameterException 370IloCsvTableReader 381ILOCUTCALLBACK0 479IloDeleterMode 100IloDiff 101IloDifference 387, 388IloDisableNANDetection 104ILODISJUNCTIVECUTCALLBACK0 480ILODISJUNCTIVECUTINFOCALLBACK0 481IloDiv 105IloDuplicatedTableException 371IloEmptyHandleException 106IloEnableNANDetection 107IloEndMT 108IloEnv 109IloEnvironmentMismatch 115IloException 116IloExponent 118IloExpr 119IloExprArray 126IloExtractable 130IloExtractableArray 135IloExtractableVisitor 138IloFastMutex 140IloFieldNotFoundException 372IloFileNotFoundException 373IloFloatVar 144IloFloatVarArray 145IloFloor 146ILOFLOWMIRCUTCALLBACK0 482ILOFLOWMIRCUTINFOCALLBACK0 483ILOFRACTIONALCUTCALLBACK0 484ILOFRACTIONALCUTINFOCALLBACK0 485IloGetClone 147IloHalfPi 148ILOHEURISTICCALLBACK0 486IloIfThen 149IloIncorrectCsvReaderUseException 374ILOINCUMBENTCALLBACK0 487IloInitMT 152IloInt 153IloIntArray 154IloIntersection 389IloIntervalList 390IloIntervalListCursor 395IloIntExpr 158IloIntExprArg 161IloIntExprArray 163IloIntSet 166IloIntSetVar 174IloIntSetVarArray 179IloIntTupleSet 181IloIntTupleSetIterator 184IloIntVar 185IloIntVarArray 191IloIsNAN 195IloIterator 196ILOLAZYCONSTRAINTCALLBACK0 488IloLexicographic 198IloLineNotFoundException 375IloLog 199IloMax 200, 398IloMaximize 201<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 823


I NDEXIloMin 202, 399IloMinimize 203ILOMIPCALLBACK0 489ILOMIPINFOCALLBACK0 490IloModel 204IloMutexDeadlock 210IloMutexNotOwner 211IloMutexProblem 212ILONETWORKCALLBACK0 491ILONODECALLBACK0 492IloNot 214IloNum 216IloNumArray 217IloNumColumn 329IloNumColumnArray 332IloNumExpr 220IloNumExprArg 223IloNumExprArray 225IloNumToAnySetStepFunction 400IloNumToAnySetStepFunctionCursor 409IloNumToNumSegmentFunction 412IloNumToNumSegmentFunctionCursor 419IloNumToNumStepFunction 422IloNumToNumStepFunctionCursor 428IloNumVar 229IloNumVarArray 235IloObjective 241IloOr 248IloPi 252IloPiecewiseLinear 253IloPower 254ILOPRESOLVECALLBACK0 493ILOPROBINGCALLBACK0 494ILOPROBINGINFOCALLBACK0 495IloQuarterPi 255IloRandom 256IloRange 259IloRangeArray 266IloRound 273IloScalProd 274, 275, 276, 277IloSemaphore 278IloSemiContVar 347IloSemiContVarArray 351ILOSIMPLEXCALLBACK0 496IloSolution 281IloSolutionArray 293IloSolutionIterator 294IloSolutionManip 298ILOSOLVECALLBACK0 497IloSOS1 334IloSOS1Array 337IloSOS2 340IloSOS2Array 344IloSquare 299ILOSTLBEGIN 46IloSum 300IloTableNotFoundException 376IloThreeHalfPi 301IloTimer 302ILOTUNINGCALLBACK0 498IloTwoPi 304IloUnion 431, 432ILOUSERCUTCALLBACK0 499IloXmlContext 440IloXmlInfo 446IloXmlReader 457IloXmlWriter 462IncumbentCallbackI 661, 801IntegerFeasibility 600, 652IntegerFeasibilityArray 601, 653IntParam 665InvalidCutException 673Iterator 172, 208, 296, 717LLazyConstraintCallbackI 674, 805LinearIterator 128LineIterator 377, 385MMIPCallbackI 677MIPEmphasisType 683MIPInfoCallbackI 684MIPsearch 689MultipleConversionException 690MultipleObjException 692<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 824


I NDEXNNetworkCallbackI 693NodeCallbackI 695, 808NodeData 682NodeEvaluator 700NodeEvaluatorI 702NodeSelect 706NonLinearExpression 228NotExtractedException 62NumParam 707Ooperator 315, 316, 317, 318, 436operator- 313, 435operator && 305operator * 306, 433operator new 307operator! 308operator!= 309operator% 310, 311operator+ 312, 434operator/ 314operator== 319, 437, 438, 439operator> 320operator>= 321operator>> 322operator|| 323optim.concert 39optim.concert.cplex 324optim.concert.extensions 354optim.concert.xml 440optim.cplex.cpp 466optim.cplex.cpp.advanced 753OptimizationCallbackI 710ProbingInfoCallbackI 725QQuality 727RRelaxation 731SSearchLimit 733SearchLimitI 735Sense 247SimplexCallbackI 737SolveCallbackI 739, 814Status 64, 99StringParam 744TTableIterator 379TuningCallbackI 745TuningStatus 747Type 240, 503, 584UUnknownExtractableException 748UserCutCallbackI 749, 819VVariableSelect 752PParallel_Mode 712ParameterSet 713PresolveCallbackI 719PresolvedVariableException 602PrimalPricing 721ProbingCallbackI 722<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>11.0</strong> REFERENCE M ANUAL 825

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!