FRAMES NO FRAMES

Class IloSolver

Definition file: ilsolver/ilosolverhandle.h
Include file: <ilsolver/ilosolver.h>

An instance of this class represents an algorithm for IBM® ILOG® Solver.

Most member functions in this class contain assert statements. For an explanation of the macro NDEBUG (a way to turn on or turn off these assert statements), see the concept Assert and NDEBUG.

Choice Functions and Criteria

An instance of IloSolver allows you to set parameters to control the order in which constrained variables are bound to values. You control these search primitives by means of choice functions and criteria. In Concert Technology, the classes listed in IloChoose support these search primitives in a model.

Enumeration Algorithms

There are enumeration algorithms available in an instance of IloSolver. With IBM ILOG Concert Technology, you access those enumeration algorithms most easily through predefined goals, such as IloBestGenerate, IloBestInstantiate, IloGenerate, and IloInstantiate, in a model.

Modifying the Search Globally

These member functions have an overall effect on the search performed by IloSolver::solve. They allow you to limit the number of failures, the number of choice points, or the amount of time spent in a search.

 void setFailLimit (IloInt numberOfFailures) const;
 void setTimeLimit (IloNum time) const;
 void setOrLimit (IloInt numberOfChoicePoints) const;
 

The following member function lets you control the granularity of the optimization:

 void setOptimizationStep (IloNum step) const;
 

Nonlinear Propagation Techniques

When you use the member function IloSolver::useNonLinConstraint, the invoking solver will use nonlinear propagation techniques for all the nonlinear constraints in your model.

In addition, when the set of nonlinear constraints is a square system of equations or a square system of inequalities, a global constraint will be posted. This constraint may allow for additional propagation.

Furthermore it may allow you to prove that the solution-interval found for the system of nonlinear constraints surely contains a solution.

The keep parameter of IloSolver::useNonLinConstraintspecifies whether or not in addition to the advanced propagation techniques the invoking solver should also use its default propagation. If keep is IlcTrue constraints are propagated only by the nonlinear propagation techniques; if keep is IlcFalse, the invoking solver will use nonlinear propagation techniques as well as its default propagation techniques.

By default, when you use nonlinear propagation techniques, the default precision (indicated by IloSolver::getDefaultPrecision and changed by IloSolver::setDefaultPrecision) is respected. However, you can set your own value to use with nonlinear constraints and to use in the safety of solutions by means of the member function IloSolver::setNonLinPrecision and IloSolver::getNonLinPrecision.

Example

Here is an example using nonlinear propagation techniques.

#include <ilconcert/ilomodel.h>
#include <ilconcert/ilosolver.h>

 ILOSTLBEGIN

 int main () {
   try {
     IloEnv env;
     IloModel model(env);

     IloNumVar x(env,-10, 10);
     IloNumVar y(env,-10, 10);
     IloNumVarArray vars(env, 2, x, y);

     model.add(IloSquare(x) + IloSquare(y) == 1);
     model.add(IloSquare(x) == y);

     IloSolver solver(env);
     solver.useNonLinConstraint();
     solver.extract(model);

     solver.startNewSearch(IloSplit(env, vars));

     IloInt nbSol = 0;
     while (solver.next()) {
       nbSol++;
       solver.out() << ?Sol#? << nbSol << ?  ?;
       if (solver.isNonLinSafe())
  solver.out() << ?[SAFE] ?;
       solver.out() << endl;
       solver.out() << ?x: ? << solver.getFloatVar(x) <<
 endl;
       solver.out() << ?y: ? << solver.getFloatVar(y) <<
 endl;
       solver.out() << endl;
     }
     env.end();
   }
   catch (IloException& ex) {
     cerr << ?Error: ? << ex << endl;
   }
   return 0;
 }
 

Here is the result of that program:

 Sol#1       [SAFE]
 x: [0.786151..0.786152]
 y: [0.618033..0.618034]

 Sol#2       [SAFE]
 x: [-0.786152..-0.786151]
 y: [0.618033..0.618034]
 

Safe Solutions

When it is working with constrained floating-point variables, an instance of IloSolver returns an interval or set of intervals possibly containing a solution. Practical considerations about the representation of real numbers as floating-point values on any computing platform make it difficult to predict whether an interval of a given precision contains a unique solution (that is, an assignment of values to variables that satisfies the constraints of the problem).

However, in some cases, the algorithms of IloSolver can prove the existence of solutions within precisely defined intervals. In its search for solutions, an instance of IloSolver regards a solution as safe if it is certain that a solution exists within the most recently returned intervals. When it proves a solution safe, it considers the model most recently synchronized within a call to the member functions IloSolver::solve or IloSolver::startNewSearch.

The member function IloSolver::isNonLinSafe applies to the non linear constraints of a problem; it tells you whether Solver has proved the existence of a solution with respect to the non linear constraints of a problem within the most recently returned set of intervals. The return value of this member function applies only to the non linear constraints of a problem; that is, it can prove that the set of non linear constraints has a solution, but it says nothing about any other constraints in the problem. In some cases, there may be other constraints that are not non linear (constraints such as IloAllDiff, for example; in other words, constraints that are not non linear equalities or inequalities) in the problem that make it impossible to find a solution to the problem in its entirety.

Exceptions

Early versions of Solver raised errors in case of anomalous situations. Those errors were associated with an error code enumerated in IlcErrorType. As of version 5.0, an instance of IloSolver now silently transforms an error into an exception, that is, an instance of IloSolver::SolverErrorException. The member function IloSolver::SolverErrorException::getErrorType will return the IlcErrorType.

See Also:

Constructor Summary
public IloSolver(const IloEnv & env)
public IloSolver(const IloModel & model)
Method Summary
public voidadd(const IlcConstraintArray constraints) const
public voidadd(const IlcConstraint constraint) const
public voidaddMemoryManager(IlcMemoryManagerI * mm) const
public voidaddReversibleAction(const IlcGoal goal) const
public voidaddTrace(IloCPTrace search)
public IloBoolassumeStrictNumericalDivision() const
public voidassumeStrictNumericalDivision(IloBool snd) const
public voidcommitSearch(IloAny label) const
public voidend()
public voidendSearch() const
public voidexitSearch() const
public voidextract(const IloModel model) const
public voidfail(IlcAny label=0) const
public IlcDemongetActiveDemon() const
public IlcGoalgetActiveGoal() const
public IlcAnyArraygetAnyArray(const IloAnyArray arg) const
public IlcAnySetgetAnySet(const IloAnySet arg) const
public IloAnySetgetAnySetValue(const IloAnySetVar var) const
public IlcAnySetVargetAnySetVar(const IloAnySetVar var) const
public IlcAnySetVarArraygetAnySetVarArray(const IloAnySetVarArray vars) const
public IloAnygetAnyValue(const IloAnyVar var) const
public IlcAnyVargetAnyVar(const IloAnyVar var) const
public IlcAnyVarArraygetAnyVarArray(const IloAnyVarArray vars) const
public IlcBoxgetBox(const IloBox) const
public IloNumgetBranchImpact(const IloNumVar x) const
public IloNumgetBranchImpact(const IlcFloatVar x) const
public IloNumgetBranchImpact(const IloIntVar x) const
public IloNumgetBranchImpact(const IlcIntVar x) const
public IlcConstraintgetConstraint(const IloConstraint ct) const
public IlcIntgetCurrentNumberOfNodes() const
public IlcFloatgetDefaultPrecision() const
public IloIntgetDegree(const IloIntVar x) const
public IloIntgetDegree(const IlcIntVar x) const
public IlcFloatgetElapsedTime() const
public IloSolver::FailureStatusgetFailureStatus() const
public IlcFloatArraygetFloatArray(const IloNumArray arg) const
public IlcFloatDisplaygetFloatDisplay() const
public IlcFloatExpgetFloatExp(const IloNumExprArg expr) const
public IlcFloatVargetFloatVar(const IloNumVar var) const
public IlcFloatVarArraygetFloatVarArray(const IloNumVarArray vars) const
public IlcAllocationStack *getHeap() const
public IlcFloatgetImpact(const IlcIntVar x) const
public IlcFloatgetImpact(const IlcIntVar x, IlcInt v, IlcBool countFails=IlcTrue) const
public IloSolverI *getImpl() const
public IlcIntArraygetIntArray(const IloNumArray arg) const
public IlcIntExpgetIntExp(const IloIntExprArg expr) const
public IlcIntSetgetIntSet(const IloIntSet arg) const
public IloIntSetgetIntSetValue(const IloIntSetVar var) const
public IlcIntSetVargetIntSetVar(const IloIntSetVar var) const
public IlcIntSetVarArraygetIntSetVarArray(const IloNumSetVarArray vars) const
public IlcIntVargetIntVar(const IloNumVar var) const
public IlcIntVarArraygetIntVarArray(const IloNumVarArray vars) const
public IlcFloatgetLocalImpact(const IlcIntVar x, IlcInt v) const
public IlcFloatgetLocalVarImpact(const IlcIntVar x, IlcInt depth=-1) const
public IloNumgetMax(const IloNumVar v) const
public IlcUIntgetMaxSearchMemoryUsage() const
public IlcUIntgetMemoryUsage() const
public IloNumgetMin(const IloNumVar v) const
public IlcFloatgetNonLinPrecision() const
public IlcIntgetNumberOfChoicePoints() const
public IlcIntgetNumberOfConstraints() const
public IlcIntgetNumberOfCuts() const
public IlcFloatgetNumberOfFails(const IlcIntVar x, IlcInt v) const
public IlcIntgetNumberOfFails() const
public IlcIntgetNumberOfFiles() const
public IlcFloatgetNumberOfInstantiations(const IlcIntVar x, IlcInt v) const
public IlcIntgetNumberOfMoves() const
public IlcIntgetNumberOfRecomputed() const
public IlcIntgetNumberOfVariables() const
public IloNumgetOptimizationStep() const
public IlcAllocationStack *getPersistentHeap() const
public IlcRandomgetRandom() const
public IloNumgetReduction(const IloNumVar x) const
public IloNumgetReduction(const IlcFloatVar x) const
public IloIntgetReduction(const IloIntVar x) const
public IloIntgetReduction(const IlcIntVar x) const
public IloNumgetRelativeOptimizationStep() const
public IlcUIntgetSearchMemoryUsage() const
public IlcSearchNodegetSearchNode() const
public IlcFloatgetSuccessRate(const IlcIntVar x) const
public IlcFloatgetSuccessRate(const IlcIntVar x, IlcInt v) const
public IlcFloatgetTime() const
public IlcIntgetTotalNumberOfNodes() const
public IloNumgetValue(const IloNumVar v) const
public IlcIntgetWorkerId() const
public IloBoolisExtracted(const IloExtractable ext) const
public IloBoolisInRecomputeMode() const
public IloBoolisInSearch() const
public IloBoolisInteger(const IloNumVar var) const
public IloBoolisNonLinSafe() const
public IloBoolnext() const
public voidprintInformation(ostream & stream) const
public voidprintInformation() const
public IloBoolpropagate(const IloConstraint constraint=0, IloSynchronizeMode mode=IloSynchronizeAndRestart, IloBool restore=IloFalse) const
public voidremoveTrace(IloCPTrace search)
public voidrestartSearch() const
public voidsetBigTupleSet() const
public voidsetDefaultFilterLevel(IlcFilterLevelConstraint ct, IlcFilterLevel level) const
public voidsetDefaultPrecision(IloNum precision) const
public voidsetFailLimit(IloInt numberOfFailures) const
public voidsetFastRestartMode(IloBool mode) const
public voidsetFileNodeOptions(IlcInt maxSize, char * prefixName, IlcBool useCompression, IlcBool useDisk) const
public voidsetFilterLevel(IlcConstraint ct, IlcFilterLevel level) const
public voidsetFilterLevel(IloConstraint oct, IlcFilterLevel level) const
public voidsetFloatDisplay(IlcFloatDisplay display) const
public voidsetHoloTupleSet() const
public voidsetMax(const IloNumVar v, IloNum n) const
public voidsetMin(const IloNumVar v, IloNum n) const
public voidsetMonitor(const IlcSearchMonitor monitor, IloBool rec) const
public voidsetNonLinPrecision(IlcFloat p) const
public voidsetObjMin(const IlcFloatVar & obj, IloNum step, IloNum r=0.0) const
public voidsetObjMin(const IlcIntVar & obj, IloInt step=1, IloNum r=0.0) const
public voidsetOptimizationStep(IloNum step) const
public voidsetOrLimit(IloInt numberOfChoicePoints) const
public voidsetPropagationControl(IloNumVar x) const
public voidsetPropagationControl(IloIntVar x) const
public voidsetRelativeOptimizationStep(IloNum step) const
public voidsetSimpleTupleSet() const
public voidsetTimeLimit(IloNum time) const
public voidsetTrace(const IlcTrace trace) const
public voidsetTraceMode(IloBool trace) const
public voidsetValue(const IloNumVar v, IloNum n) const
public IloBoolsolve() const
public IloBoolsolve(const IlcGoal goal, IloBool restore=IloFalse) const
public IloBoolsolve(const IloGoal goal, IloSynchronizeMode mode=IloSynchronizeAndRestart, IloBool restore=IloFalse) const
public IloBoolsolveFeasible() const
public IloBoolsolveFeasible(const IloGoal goal, IloSynchronizeMode mode=IloSynchronizeAndRestart, IloBool restore=IloFalse) const
public voidstartNewSearch(const IlcGoal goal) const
public voidstartNewSearch(const IloGoal goal=0, IloSynchronizeMode mode=IloSynchronizeAndRestart) const
public voidunsetLimit() const
public voidunuse(const IlcConstraintAggregator a) const
public voiduse(const IlcConstraintAggregator a) const
public voiduseHeap(IlcBool useIt) const
public voiduseLinPropagation(IlcBool keep=IlcTrue, IloNum precision=0.1) const
public voiduseNonLinConstraint(IlcBool keep=IlcTrue) const
Inherited Methods from IloAlgorithm
clear, end, error, extract, getEnv, getIntValue, getIntValues, getModel, getObjValue, getStatus, getTime, getValue, getValue, getValue, getValue, getValues, getValues, isExtracted, out, printTime, resetTime, setError, setOut, setWarning, solve, warning
Inner Enumeration
IloSolver::FailureStatus
Constructor Detail

IloSolver

public IloSolver(const IloEnv & env)

This constructor creates an algorithm for IBM® ILOG® Solver.


IloSolver

public IloSolver(const IloModel & model)

This constructor creates an algorithm for IBM ILOG Solver. Actual propagation of all constraints added to the model model will take place either at the next solve() or at the next solver.next().

Examples:

When you create an algorithm (an instance of IloSolver, for example) and extract a model for it, you can write either this line:

 IloSolver solver(model);

or these two lines:

 IloSolver solver(env);
 solver.extract(model);

Those two lines may be useful when you want to attach your own specialized extractor to the algorithm you are creating before you extract a particular model.


Method Detail

add

public void add(const IlcConstraintArray constraints) const

This member function adds all the constraints in the array constraints to the invoking solver so that the invoking solver takes them into account during its search. You can use this member function only during search.


add

public void add(const IlcConstraint constraint) const

This member function adds constraint to the invoking solver so that the invoking solver takes constraint into account during its search. You can use this member function only during search.


addMemoryManager

public void addMemoryManager(IlcMemoryManagerI * mm) const

This member function adds the memory manager indicated by mm to the list of memory managers known to the invoking solver.

When you call the member function IloSolver::end or when the solver re-extracts the model during synchronization, it will call the virtual member function IlcMemoryManagerI::end for all the memory managers known to the invoking solver.

The purpose of a memory manager is to delete automatically any memory not allocated through the Solver heap. Consequently, this member function is conventionally used at run time, like this:


 solver.addMemoryManager(new(solver.getHeap()) MyMemoryManager());
 

where solver is the invoking solver and MyMemoryManager is a class where you have defined MyMemoryManager::end to delete memory appropriately.


addReversibleAction

public void addReversibleAction(const IlcGoal goal) const

This member function adds the goal to the invoking solver. The invoking solver will then treat goal as a reversible object with respect to memory management, backtracking, choice points, and so forth.

It is possible to “undo” actions that are not simple assignments—such actions as drawing in a graphic interface or dealing with files.

For managing reversible changes that are not assignments, Solver provides reversible actions. Such actions are executed when Solver restores the state of the invoking solver. A reversible action is created by the member function addReversibleAction.

However, it is much more efficient to use the reversible classes—IlcRevInt, IlcRevAny, IlcRevBool, IlcRevFloat—to manage reversible assignments than to use reversible actions.

In the member function addReversibleAction, the argument goal must be a goal that does not change the state of the invoking solver. That is, it must not execute any reversible assignments, nor call other goals, nor call the member function fail. The member function addReversibleAction saves its argument, goal, as a reversible action. If Solver backtracks to a choice point that was set before this call to addReversibleAction, then goal will be executed.

Since reversible actions do not have subgoals, demons are usually used for implementing them.

The execution of reversible actions is interleaved with the restoration of reversible states. Thus when a reversible goal is called, the state of the invoking solver is the same as the state of the invoking solver when addReversibleAction was called.

Reversible actions can be used to display the search for a solution through a graphic user interface. See the Solver User's Manual for an example (about animating graphic interfaces) showing how to do this.


addTrace

public void addTrace(IloCPTrace search)

This member function adds a hook to set the trace to the start of the search search.


assumeStrictNumericalDivision

public IloBool assumeStrictNumericalDivision() const

This member function indicates whether the arithmetic division operator / is restricted to numeric division only. If the return value is IloTrue, operator / is restricted, and integer division is accessible only through the IloDiv function.

If the return value is IloFalse, operator / * performs division resulting in, in general, a non-integral result.

For compatibility with previous versions of Solver, the default value is IloFalse, meaning the division of two integer expressions using operator is another integer expression.


assumeStrictNumericalDivision

public void assumeStrictNumericalDivision(IloBool snd) const

This member function specifies whether the arithmetic division operator / is restricted to numeric division only. If snd is IloTrue, operator / is restricted, and integer division is accessible only through the IloDiv function.

If snd is IloFalse, operator / performs division resulting in, in general, a non-integral result.

For compatibility with previous versions of Solver, the default value is IloFalse, meaning the division of two integer expressions using operator is another integer expression.


commitSearch

public void commitSearch(IloAny label) const

This member function commits the current search to be confined to the part of the search tree below the closest choice point with label label. In case no such choice point exists, this method then commits the search to the current state and removes all remaining open choice points or open search nodes.


end

public void end()

This member function "cleans house" by freeing all memory allocated by Solver on the Solver heap for the invoking solver. Since it destroys the invoking solver and all objects associated with the invoking solver, you must not use the solver nor any object created with this solver after you call this member function. This member function is called automatically by IloEnv::end.

If you also want this member function to delete automatically memory that you allocate that is not on the Solver heap, then you should add a memory manager, an instance of IlcMemoryManagerI, to the list of memory managers associated with the invoking solver. See the class IlcMemoryManagerI for details.

See Also:


endSearch

public void endSearch() const

This member function terminates a search and deletes the internal objects created by Solver to carry out the search (such internal objects as the search tree, choice points, goal stack, etc.)


exitSearch

public void exitSearch() const

This member function completely exits the search.


extract

public void extract(const IloModel model) const

This member function extracts all the extractable objects added to model for the invoking algorithm. This member function discards any previously extracted model. Actual propagation of all constraints added to the model model will take place either at the next solve() or at the next solver.next().


fail

public void fail(IlcAny label=0) const

The failure of a goal is triggered by this member function. In fact, this member function triggers the failure of the current goal. The execution of the current goal then stops, and execution returns to the last choice point satisfying the following conditions:

If no such choice point exists, then the current call to IloSolver::solve or IloSolver::next terminates and returns IloFalse.

If fail is called outside a call to IloSolver::solve or a call to IloSolver::next, then an error is raised.

In other words, when the member function fail is called, goal execution resumes at the last choice point with untried subgoals. It is possible to resume goal execution at an earlier choice point by associating labels with choice points. Then the member function fail can be called with a label, and in that case, goal execution resumes at the last choice point with that label.


getActiveDemon

public IlcDemon getActiveDemon() const

This member function returns the demon currently executing in the invoking solver. It returns an empty handle if there is no such demon.


getActiveGoal

public IlcGoal getActiveGoal() const

This member function returns the search goal currently executing in the invoking solver. It returns an empty handle if there is no such goal.


getAnyArray

public IlcAnyArray getAnyArray(const IloAnyArray arg) const

This member function returns the Ilc class (that is, the extracted search class) corresponding to the Ilo class (that is, the model class) of arg.


getAnySet

public IlcAnySet getAnySet(const IloAnySet arg) const

This member function returns the Ilc class (that is, the extracted search class) corresponding to the Ilo class (that is, the model class) of arg.


getAnySetValue

public IloAnySet getAnySetValue(const IloAnySetVar var) const

This member function returns the value that var assumes in a solution.


getAnySetVar

public IlcAnySetVar getAnySetVar(const IloAnySetVar var) const

This member function returns the algorithmically constrained enumerated set variable corresponding to the modeling variable indicated by var.


getAnySetVarArray

public IlcAnySetVarArray getAnySetVarArray(const IloAnySetVarArray vars) const

This member function returns the array of algorithmically constrained enumerated set variables corresponding to the array of modeling variables indicated by vars.


getAnyValue

public IloAny getAnyValue(const IloAnyVar var) const

This member function returns the modeling value that var assumes in a solution.


getAnyVar

public IlcAnyVar getAnyVar(const IloAnyVar var) const

This member function returns the algorithmically constrained enumerated variable corresponding to the modeling variable indicated by var.


getAnyVarArray

public IlcAnyVarArray getAnyVarArray(const IloAnyVarArray vars) const

This member function returns the array of algorithmically constrained enumerated variables corresponding to the array of modeling variables indicated by vars.


getBox

public IlcBox getBox(const IloBox) const

This member function returns the box associated with the IloBox object in the invoking solver.


getBranchImpact

public IloNum getBranchImpact(const IloNumVar x) const

This member function returns a floating point number between 0 and 1, which represents the proportion of removed intervals from the intervals of x during the last constraint propagation.


getBranchImpact

public IloNum getBranchImpact(const IlcFloatVar x) const

This member function returns a floating point number between 0 and 1, which represents the proportion of removed intervals from the intervals of x during the last constraint propagation.


getBranchImpact

public IloNum getBranchImpact(const IloIntVar x) const

This member function returns a floating point number between 0 and 1, which represents the proportion of removed values from the domain of x during the last constraint propagation.


getBranchImpact

public IloNum getBranchImpact(const IlcIntVar x) const

This member function returns a floating point number between 0 and 1, which represents the proportion of removed values from the domain of x during the last constraint propagation.


getConstraint

public IlcConstraint getConstraint(const IloConstraint ct) const

This member function returns the constraint corresponding to the modeling constraint indicated by ct.


getCurrentNumberOfNodes

public IlcInt getCurrentNumberOfNodes() const

This member function returns the number of active nodes currently open in the search carried on by the invoking solver.


getDefaultPrecision

public IlcFloat getDefaultPrecision() const

This member function returns the default precision of the invoking solver. That value is used in managing constrained floating-point expressions (instances of IlcFloatExp and its subclasses) if you associate no other relative precision with a given expression. That value in a solver is always greater than or equal to 2.10-11. It is initially 1.10-10


getDegree

public IloInt getDegree(const IloIntVar x) const

This member function returns the degree of the variable x. The degree is the number of uninstantiated variables appearing in a constraint where x also appears. This value changes throughout search. This function can be called only when the aggregator obtained by the function IlcDegreeInformation is used. Moreover, it can be called only on variables corresponding to IloIntVar appearing in the extracted model.


getDegree

public IloInt getDegree(const IlcIntVar x) const

This member function returns the degree of the variable x. The degree is the number of uninstantiated variables appearing in a constraint where x also appears. This value changes throughout search. This function can be called only when the aggregator obtained by the function IlcDegreeInformation is used. Moreover, it can be called only on variables corresponding to IloIntVar appearing in the extracted model.


getElapsedTime

public IlcFloat getElapsedTime() const

This member function displays part of the statistics about the current state of the invoking solver available from IloSolver::printInformation. In particular, it returns the the elapsed time (sometimes known as wall clock time) of the solver, in seconds, since the most recent extraction of a model or the most recent synchronization of a model.


getFailureStatus

public IloSolver::FailureStatus getFailureStatus() const

This member function returns an identifier (one of the choices of the nested enumeration IloSolver::FailureStatus) that indicates the failure status of an instance of IloSolver after an unsuccessful IloSolver::solve or IloSolver::next. Possible values of FailureStatus are:

 enum FailureStatus {
                     searchHasNotFailed,
                     searchFailedNormally,
                     searchStoppedByLimit,
                     searchStoppedByLabel,
                     searchStoppedByExit,
                     unknownFailureStatus
 };

getFloatArray

public IlcFloatArray getFloatArray(const IloNumArray arg) const

This member function returns the Ilc class (that is, the extracted search class) corresponding to the Ilo class (that is, the model class) of arg.


getFloatDisplay

public IlcFloatDisplay getFloatDisplay() const

This member function returns a value (one of the choices of the enumeration IlcFloatDisplay) that indicates how the invoking solver will display the values of constrained floating-point variables as output.


getFloatExp

public IlcFloatExp getFloatExp(const IloNumExprArg expr) const

This member function returns the floatting point expression corresponding to the modeling numerical expression indicated by expr.


getFloatVar

public IlcFloatVar getFloatVar(const IloNumVar var) const

This member function returns the algorithmically constrained floating-point variable corresponding to the modeling variable indicated by var.


getFloatVarArray

public IlcFloatVarArray getFloatVarArray(const IloNumVarArray vars) const

This member function returns the array of algorithmically constrained floating-point variables corresponding to the modeling variables indicated by vars.


getHeap

public IlcAllocationStack * getHeap() const

This member function returns a pointer to the heap associated with the invoking solver. Use this member function with the overloaded new operator, like this new (solver.getHeap()).


getImpact

public IlcFloat getImpact(const IlcIntVar x) const

This member function returns the impact of a variable. This impact is the sum of the impact of each value in its current domain.


getImpact

public IlcFloat getImpact(const IlcIntVar x, IlcInt v, IlcBool countFails=IlcTrue) const

This member function returns the average of observed impacts on the assignment x = v so far. The impact of an assignment x = v is the proportion of the search space that this assignment eliminates by constraint propagation. When countFails is set to IloTrue, failures of the assignment are also counted as having an impact of 1.0. Otherwise they are not taken into account in the average.


getImpl

public IloSolverI * getImpl() const

This member function returns the undocumented class IloSolverI*.


getIntArray

public IlcIntArray getIntArray(const IloNumArray arg) const

This member function returns the Ilc class (that is, the extracted search class) corresponding to the Ilo class (that is, the model class) of arg.


getIntExp

public IlcIntExp getIntExp(const IloIntExprArg expr) const

This member function returns the integer expression corresponding to the modeling integer expression indicated by expr.


getIntSet

public IlcIntSet getIntSet(const IloIntSet arg) const

This member function returns the Ilc class (that is, the extracted search class) corresponding to the Ilo class (that is, the model class) of arg.


getIntSetValue

public IloIntSet getIntSetValue(const IloIntSetVar var) const

This member function returns the modeling value that var assumes in a solution.


getIntSetVar

public IlcIntSetVar getIntSetVar(const IloIntSetVar var) const

This member function returns the algorithmically constrained set variable corresponding to the modeling variable indicated by var.


getIntSetVarArray

public IlcIntSetVarArray getIntSetVarArray(const IloNumSetVarArray vars) const

This member function returns the array of algorithmically constrained integer set variables corresponding to the array of modeling variables indicated by vars.


getIntVar

public IlcIntVar getIntVar(const IloNumVar var) const

This member function returns the algorithmically constrained integer variable corresponding to the modeling variable indicated by var.


getIntVarArray

public IlcIntVarArray getIntVarArray(const IloNumVarArray vars) const

This member function returns the array of algorithmically constrained integer variables corresponding to the modeling variables indicated by vars.


getLocalImpact

public IlcFloat getLocalImpact(const IlcIntVar x, IlcInt v) const

This member function computes and returns the impact on the assignment x = v. The impact is the proportion of the search space that this assignment eliminates by constraint propagation at the place where this function is called.


getLocalVarImpact

public IlcFloat getLocalVarImpact(const IlcIntVar x, IlcInt depth=-1) const

This member function computes the impact of the assignment x = v for each value v in the current domain of x and returns the sum of these impacts.


getMax

public IloNum getMax(const IloNumVar v) const

This member function returns the maximum value of the numeric variable v.


getMaxSearchMemoryUsage

public IlcUInt getMaxSearchMemoryUsage() const

This member function returns the maximum amount of memory used to store nodes during the search by the invoking solver.


getMemoryUsage

public IlcUInt getMemoryUsage() const

This member function displays part of the statistics about the current state of the invoking solver available from IloSolver::printInformation. In particular, it returns the total memory, in bytes, used by the invoking solver.


getMin

public IloNum getMin(const IloNumVar v) const

This member function returns the minimum value of the numeric variable v.


getNonLinPrecision

public IlcFloat getNonLinPrecision() const

When you are using non-linear constraint propagation (by means of the member function IloSolver::useNonLinConstraint), this member function returns the precision of non-linear constraint propagation with respect to floating-point values and with respect to the safety of solutions.


getNumberOfChoicePoints

public IlcInt getNumberOfChoicePoints() const

This member function displays part of the statistics about the current state of the invoking solver available from IloSolver::printInformation. In particular, it returns the number of choice points since the most recent extraction or synchronization of a model by the invoking solver.


getNumberOfConstraints

public IlcInt getNumberOfConstraints() const

This member function displays part of the statistics about the current state of the invoking solver available from IloSolver::printInformation. In particular, it returns the number of constraints extracted for the invoking solver.


getNumberOfCuts

public IlcInt getNumberOfCuts() const

This member function returns the number of nodes discarded during the search by the invoking solver.


getNumberOfFails

public IlcFloat getNumberOfFails(const IlcIntVar x, IlcInt v) const

This member function returns the number of times the assignment x = v has failed at this point in the search.


getNumberOfFails

public IlcInt getNumberOfFails() const

This member function displays part of the statistics about the current state of the invoking solver available from IloSolver::printInformation. In particular, it returns the number of failures since the most recent extraction or synchronization of a model by the invoking solver.

A reset of a model in the invoking solver will occur under any of these conditions:


getNumberOfFiles

public IlcInt getNumberOfFiles() const

This member function returns the number of node files used during the search by the invoking solver.


getNumberOfInstantiations

public IlcFloat getNumberOfInstantiations(const IlcIntVar x, IlcInt v) const

This member function returns the number of times the assignment x = v has been made at this point in the search.


getNumberOfMoves

public IlcInt getNumberOfMoves() const

This member function returns the number of moves performed during the search in the search tree by the invoking solver since the most recent extraction or synchronization of a model by the invoking solver.


getNumberOfRecomputed

public IlcInt getNumberOfRecomputed() const

This member function returns the number of choice points recomputed by the invoking solver since the most recent extraction or synchronization of a model by the invoking solver.


getNumberOfVariables

public IlcInt getNumberOfVariables() const

This member function displays part of the statistics about the current state of the invoking solver available from IloSolver::printInformation. In particular, it returns the number of constrained variables extracted for the invoking solver.


getOptimizationStep

public IloNum getOptimizationStep() const

This member function returns the current optimization step. The optimization step indicates how much improvement there must be between solutions during the search launched by IloSolver::solve.


getPersistentHeap

public IlcAllocationStack * getPersistentHeap() const

This member function returns a pointer to the heap where persistent objects of the search are stored. When the invoking solver is deleted, this heap will be deleted, too.


getRandom

public IlcRandom getRandom() const

This member function returns a random number generator. This can be convenient as it can be reduce the number of places that a random number generator needs to be explicitly passed in user code.


getReduction

public IloNum getReduction(const IloNumVar x) const

This member function returns the difference between the domain size of x before and after the the last constraint propagation.


getReduction

public IloNum getReduction(const IlcFloatVar x) const

This member function returns the difference between the domain size of x before and after the last constraint propagation.


getReduction

public IloInt getReduction(const IloIntVar x) const

This member function returns the number of removed values from the domain of x during the last constraint propagation.


getReduction

public IloInt getReduction(const IlcIntVar x) const

This member function returns the number of removed values from the domain of x during the last constraint propagation.


getRelativeOptimizationStep

public IloNum getRelativeOptimizationStep() const

This member function returns the relative optimization step. For example, if the optimization step is 90%, Solver searches for a solution where the objective value is less than 90% of the objective value of the best solution found so far.


getSearchMemoryUsage

public IlcUInt getSearchMemoryUsage() const

This member function returns the amount of memory currently used to store nodes by the invoking solver.


getSearchNode

public IlcSearchNode getSearchNode() const

This member function returns the current open node being explored by the invoking solver.


getSuccessRate

public IlcFloat getSuccessRate(const IlcIntVar x) const

This member function returns the rate of instantiations x = v that fails by considering only values v that are in the current domain of x.


getSuccessRate

public IlcFloat getSuccessRate(const IlcIntVar x, IlcInt v) const

This member function returns the success rate of assignment x = v at this point in the search. The success rate is the proportion of assignments of this kind that does not fail.


getTime

public IlcFloat getTime() const

This member function displays part of the statistics about the current state of the invoking solver available from IloSolver::printInformation. In particular, it returns the total running time of the solver, in seconds, since the most recent extraction of a model or the most recent synchronization of a model.


getTotalNumberOfNodes

public IlcInt getTotalNumberOfNodes() const

This member function returns the total number of nodes created during the search by the invoking solver since the most recent extraction or synchronization of a model by the invoking solver.


getValue

public IloNum getValue(const IloNumVar v) const

This member function returns the value of the numeric variable v.


getWorkerId

public IlcInt getWorkerId() const

This member function returns a positive integer identifying the current worker (an instance of IloSolver). These identifying numbers start from 0 (zero) and are contiguous. In a sequential search, this member function always returns 0.


isExtracted

public IloBool isExtracted(const IloExtractable ext) const

This member function checks whether an extractable ext has been extracted by Solver.


isInRecomputeMode

public IloBool isInRecomputeMode() const

This member function returns IloTrue if the invoking solver is jumping from one open node to another using recomputation. It returns IloFalse otherwise.


isInSearch

public IloBool isInSearch() const

This member function returns IloTrue if the invoking solver is conducting a search; otherwise, it returns IloFalse.


isInteger

public IloBool isInteger(const IloNumVar var) const

This member function returns IloTrue if var represents an integer variable in the invoking solver; it returns IloFalse otherwise.


isNonLinSafe

public IloBool isNonLinSafe() const

This member function applies only to the non linear equalities and inequalities in a model; it says nothing about constraints that are not non linear equalities or inequalities. It returns IloTrue if the solution returned by the invoking solver has been proved safe in the sense explained in Safe Solutions. In short, there is a solution (an assignment of values to variables satisfying all non linear constraints in the model) in the interval returned by the solver. It returns IloFalse otherwise.


next

public IloBool next() const

This member function searches for the next solution in the search tree of the invoking IloSolver object.

The first time next is called, it iteratively pops one goal from the goal stack and executes it. The execution of the goal can add other goals to the stack and can set choice points.

The execution of next terminates in two cases. First, when the goal stack becomes empty, this member function returns IloTrue. Second, if a failure occurs and no choice point with untried subgoals and correct labels exists, the member function restores the state of the invoking search and returns IloFalse.

The second execution and subsequent executions of next start from where the preceding execution left off. If a solution was found, then Solver backtracks and searches for the next solution. If no solution was found, this member function immediately returns IloFalse.

This member function returns IloTrue when it has found a solution.


printInformation

public void printInformation(ostream & stream) const

This member function is part of the special purpose debugging features of Solver. It displays statistics about the current state of the solver since the most recent extraction of a model or the most recent synchronization of a model and prints to stream stream. For more information, see IloSolver::printInformation.


printInformation

public void printInformation() const

This member function is part of the special purpose debugging features of Solver. It displays statistics about the current state of the solver since the most recent extraction of a model or the most recent synchronization of a model.

Specifically, in the output stream indicated by its argument, this member function displays the following information about memory use by Solver:

Each of those numbers can be accessed individually by one of the following member functions.

Typical output from the member function printInformation looks like this:

 Number of fails               : 3306
 Number of choice points       : 3310
 Number of variables           : 26
 Number of constraints         : 21
 Reversible stack (bytes)      : 8060
 Solver heap (bytes)           : 16100
 And stack (bytes)             : 4040
 Or stack (bytes)              : 4040
 Constraint queue (bytes)      : 4068
 Total memory used (bytes)     : 36308
 Total CPU time                : 12.29
 

propagate

public IloBool propagate(const IloConstraint constraint=0, IloSynchronizeMode mode=IloSynchronizeAndRestart, IloBool restore=IloFalse) const

This member function propagates the constraint constraint and synchronizes with the model (or not) according to the parameter mode. This member functions returns IloTrue if the propagation succeeds; otherwise, it returns IloFalse. The parameter restore indicates whether or not at the end of the propagation the invoking solver should restore the state that it was in prior to the search. This restoration of a state influences only the propagation, not the synchronization with a model. The invoking solver will remain synchronized (or not, consistent with the mode parameter) after the search regardless of the restore parameter. This member function must be used at the top level of the search.


removeTrace

public void removeTrace(IloCPTrace search)

This member function removes a hook to set the trace from the search search.


restartSearch

public void restartSearch() const

This member function restarts the search at the top of the search tree (that is, before the first call of the member function next).

It also stores the best value of any objective function that has been defined by IloSolver::setObjMin.

If you have stored an intermediate solution, then you should call restart before you call IloSolver::next so that next will immediately produce that stored solution.


setBigTupleSet

public void setBigTupleSet() const

This member function controls how Solver manages the propagation of tuple set table constraints. It must be called before extraction. It allows you to modify the default behavior (set using IloSolver::setSimpleTupleSet) to accelerate the propagation of table constraints defined by the set of their allowed tuples when propagation is slow. Typically, this can occur when the tuples are of an arity greater than three and when they contain numerous tuples. IloSolver::setBigTupleSet uses a data structure that is very quick, but that consumes a lot of memory.


setDefaultFilterLevel

public void setDefaultFilterLevel(IlcFilterLevelConstraint ct, IlcFilterLevel level) const

This member function defines the default filter level for a type of constraint, such as the types IlcAllDiff, IlcDistribute, IlcSequence, and so forth. For each type of constraint (as defined in the enumeration IlcFilterLevelConstraint) Solver respects a default filter level in propagation. With this member function, you can reset that default for all constraints of that type.

If you want to reset the default filter level of a given constraint (rather than for all constraints of a given type), then consider the member function IloSolver::setFilterLevel.


setDefaultPrecision

public void setDefaultPrecision(IloNum precision) const

This member function sets the default precision of the invoking solver. That value is used in managing constrained floating-point expressions (instances of IlcFloatExp and its subclasses) if you associate no other relative precision with a given expression. In any case, the default precision must be greater than or equal to 2.10-11. When it is less than 2.10-11, the default precision is automatically changed to 2.10-11. This member function is not reversible. This member function does not change the precision of any constrained floating-point expressions that have already been created.


setFailLimit

public void setFailLimit(IloInt numberOfFailures) const

This member function sets a limit on the number of failures during a search performed by IloSolver::solve or by IloSolver::startNewSearch.

The limit is set to the current number of fails plus numberOfFailures. The limit is recomputed each time this member function is called. When the limit is reached, the search stops and the current call to the member function IloSolver::solve returns IloFalse.

The effect of this member function is immediate. This change will influence any subsequent calls of the member functions IloSolver::startNewSearch and IloSolver::solve.


setFastRestartMode

public void setFastRestartMode(IloBool mode) const

This member function controls initial constraint propagation during a search performed by IloSolver::startNewSearch. The initial constraint propagation will not be redone if the following conditions are met:

This mode is not the default.


setFileNodeOptions

public void setFileNodeOptions(IlcInt maxSize, char * prefixName, IlcBool useCompression, IlcBool useDisk) const

Node files make it possible for you to limit the amount of memory Solver uses to store open search nodes. (Open search nodes in the search are the ones which have not yet been completely explored.) You activate node files by invoking this member function. This member function sets the options for node files and must be used before starting a search.

When the memory used to store nodes is greater than maxSize bytes, Solver creates a buffer of one megabyte. Solver then fills that buffer with open nodes. The parameter maxSize cannot be less than 5 000 000. If the given parameter is less than 5 000 000, Solver will silently change it to 5 000 000.

If the parameter useCompression is set to IlcTrue, the buffer is compressed. If the parameter useDisk is set to IlcTrue, this temporary buffer is then flushed from memory and written to disk as a file. The name of the file is prefixed by prefixName.

If one buffer is not enough to reduce the memory consumption below maxSize, then Solver creates node files until the memory consumption fits that limit.


setFilterLevel

public void setFilterLevel(IlcConstraint ct, IlcFilterLevel level) const

This member function defines the filter level for a given constraint. For each type of constraint (as defined in the enumeration IlcFilterLevelConstraint) Solver respects a default filter level in propagation. With this member function, you can reset the filter level of a given constraint to override the default filter level of its type.

If you want to reset the default filter level of all constraints of a given type, then consider the member function setDefaultFilterLevel.


setFilterLevel

public void setFilterLevel(IloConstraint oct, IlcFilterLevel level) const

This member function defines the filter level for a given constraint. For each type of constraint (as defined in the enumeration IlcFilterLevelConstraint) Solver respects a default filter level in propagation. With this member function, you can reset the filter level of a given constraint to override the default filter level of its type.

If you want to reset the default filter level of all constraints of a given type, then consider the member function setDefaultFilterLevel.


setFloatDisplay

public void setFloatDisplay(IlcFloatDisplay display) const

This member function changes the format of the display of floating-point constrained variables. Possible values of display are:

 enum IlcFloatDisplay {
     IlcStandardDisplay = 0,
     IlcIntScientific   = 1,
     IlcIntFixed        = 2,
     IlcBasScientific   = 3,
     IlcBasFixed        = 4
 };

The default value is IlcIntFixed. See the enumeration IlcFloatDisplay for an explanation of those values.


setHoloTupleSet

public void setHoloTupleSet() const

This member function controls how Solver manages the propagation of tuple set table constraints. It must be called before extraction. It allows you to modify the default behavior (set using IloSolver::setSimpleTupleSet) to accelerate the propagation of table constraints defined by the set of their allowed tuples when propagation is slow. Typically, this can occur when the tuples are of an arity greater than three and when they contain numerous tuples. IloSolver::setHoloTupleSet uses a data structure that is almost as quick as that used by IloSolver::setBigTupleSet, but that only consumes slightly more memory than the default IloSolver::setSimpleTupleSet data structure.


setMax

public void setMax(const IloNumVar v, IloNum n) const

This member function assigns n as the maximum value of the numeric variable v.


setMin

public void setMin(const IloNumVar v, IloNum n) const

This member function assigns n as the minimum value of the numeric variable v.


setMonitor

public void setMonitor(const IlcSearchMonitor monitor, IloBool rec) const

This member function assigns mon as the search monitor for the invoking search. A monitor watches and reports events in a search. If the IloBool is IlcTrue this monitor is set to monitor all searches including nested searches. If the IloBool is IlcFalse the monitor is set only for the top level search. This member function must be used before starting a search.


setNonLinPrecision

public void setNonLinPrecision(IlcFloat p) const

This member function sets p as the degree of precision to use with nonlinear propagation techniques (see the member function IloSolver::useNonLinConstraint) and in determining the safety of nonlinear solutions (see the member function IloSolver::isNonLinSafe). By default, the nonlinear precision is equal to the default precision of the invoking solver.


setObjMin

public void setObjMin(const IlcFloatVar & obj, IloNum step, IloNum r=0.0) const

This member functions sets an optimization objective to minimize in the invoking search. There is only one objective at a time for a given search. In other words, each time you call this member function, it replaces the previous objective (if there was one). Specifically, this member function sets obj as the minimum objective of the invoking search object and sets step as the step size. That is, it constrains the search to produce solutions that are at least a step better than the previous solution.

If you want to maximize an objective, then use solver.setObjMin(-obj, step);.


setObjMin

public void setObjMin(const IlcIntVar & obj, IloInt step=1, IloNum r=0.0) const

This member function sets an optimization objective to minimize in the invoking search. There is only one objective at a time for a given search. In other words, each time you call this member function, it replaces the previous objective (if there was one). Specifically, this member function sets obj as the minimum objective of the invoking search object and sets step as the step size. That is, it constrains the search to produce solutions that are at least a step better than the previous solution.

If you want to maximize an objective, then use solver.setObjMin(-obj, step);.


setOptimizationStep

public void setOptimizationStep(IloNum step) const

This member function sets the step size used to measure improvement between solutions during a search by IloSolver::solve.

You can also set the step size for a given variable by means of a parameter in the function IloMinimizeVar.


setOrLimit

public void setOrLimit(IloInt numberOfChoicePoints) const

This member functions sets a limit on the number of choice points (corresponding to execution of the goal IlcOr) during a search by IloSolver::solve or by IloSolver::startNewSearch.

The limit is set to the current number of choice points plus numberOfChoicePoints. The limit is recomputed each time this member function is called. When the limit is reached, the search stops and the current call to the member function IloSolver::solve returns IloFalse.

The effect of this member function is immediate. This change will influence any subsequent calls of the member functions IloSolver::startNewSearch and IloSolver::solve.


setPropagationControl

public void setPropagationControl(IloNumVar x) const

This member function allows you to control propagation for variables that you suspect have become stuck in a propagation cycle, resulting sometimes in very slow constraint propagation. For example, the domain of variable x is reduced. This reduction causes the reduction of the domain of variable y, which causes the reduction of the domain of variable z, and so on, until this cycle of reductions returns to reduce the domain of variable x. This function must be called before extraction.


setPropagationControl

public void setPropagationControl(IloIntVar x) const

This member function allows you to control propagation for variables that you suspect have become stuck in a propagation cycle, resulting sometimes in very slow constraint propagation. For example, the domain of variable x is reduced. This reduction causes the reduction of the domain of variable y, which causes the reduction of the domain of variable z, and so on, until this cycle of reductions returns to reduce the domain of variable x. This function must be called before extraction.


setRelativeOptimizationStep

public void setRelativeOptimizationStep(IloNum step) const

This member function sets the relative step size used to measure improvement between solutions during a search by IloSolver::solve. It is used to update the cutoff each time a mixed integer solution is found. The value is multiplied by the absolute value of the integer objective and subtracted from (added to) the newly found integer objective when minimizing (maximizing). This forces the mixed integer optimization to ignore integer solutions that are not at least this amount better than the one found so far. This value must be strictly between 0 and 1.


setSimpleTupleSet

public void setSimpleTupleSet() const

This member function controls how Solver manages the propagation of tuple set table constraints. It must be called before extraction. This is the default setting for tuple set constraint propagation. The member functions IloSolver::setBigTupleSet and IloSolver::setHoloTupleSet allow you to modify this default behavior to accelerate the propagation of table constraints defined by the set of their allowed tuples when propagation is slow. Typically, this can occur when the tuples are of arity greater than three and when they contain numerous tuples.


setTimeLimit

public void setTimeLimit(IloNum time) const

This member function sets a limit on the amount of time spent during a search by IloSolver::solve or by IloSolver::startNewSearch.

The limit is set to the current time plus time. The limit is recomputed whenever this member function is called. When the limit is reached, the search stops and the current call to the member function IloSolver::solve returns IlcFalse.

The time is measured in elapsed CPU seconds for the search process.

This change will influence any subsequent calls of the member functions IloSolver::startNewSearch and IloSolver::solve.


setTrace

public void setTrace(const IlcTrace trace) const

This member function assigns trace as the trace associated with the invoking solver.


setTraceMode

public void setTraceMode(IloBool trace) const

This member function turns the trace mechanism on or off for the invoking solver. If the value of trace is IlcTrue, the trace mechanism turns on. If the value of trace is IlcFalse, the trace mechanism turns off.


setValue

public void setValue(const IloNumVar v, IloNum n) const

This member function assigns n as the value of the numeric variable v.


solve

public IloBool solve() const

This member function solves a problem by using a default goal to launch the search. It is used only at the top level of the search.

This member function first checks to see whether a model has already been extracted. If a model has already been extracted, it then checks whether the model has changed since it was extracted previously. If the model has changed, then the model is extracted again. If the model has not changed, then it is not extracted again. In other words, this member function synchronizes with the current model before it starts its search.

When Concert Technology determines at extraction time that the model is infeasible, it skips the remainder of the extraction, and the first call to the member function solve will report without any search that there is no solution. If an instance of the class IloObjective has been added to the model, then the solver will search for an optimal solution.


solve

public IloBool solve(const IlcGoal goal, IloBool restore=IloFalse) const

This member function solves a problem by using the goal goal passed as a parameter. The parameter restore indicates whether or not at the end of the search the invoking solver should restore the state that it was in prior to the search. This member function can only be used within a search (for example, inside a goal) not at the top level.


solve

public IloBool solve(const IloGoal goal, IloSynchronizeMode mode=IloSynchronizeAndRestart, IloBool restore=IloFalse) const

This member function solves a problem by using the goal passed as a parameter. By means of the mode parameter, you control how solver synchronizes with the current model. When using the default parameter, IloSynchronizeAndRestart, the instance of IloSolver will end in a state equivalent to a deletion of the instance of IloSolver and a reload of the current model. Use the parameter IloSynchronizeAndContinue only if all changes since the last synchronization are monotonic. In this case, the instance of IloSolver will apply all the changes from the current state and continue from there. The parameter restore indicates whether or not at the end of the search the invoking solver should restore the state that it was in prior to the search. This restoration of a state influences only the search, not the synchronization with a model. This member function is used only at the top level of the search.


solveFeasible

public IloBool solveFeasible() const

This member function behaves exactly like IloSolver::solve, except in the case where the model contains an objective (an instance of IloObjective). In this case, solveFeasible finds the first solution respecting all the problem constraints, whereas IloSolver::solve finds a solution respecting all constraints that also optimizes the objective.


solveFeasible

public IloBool solveFeasible(const IloGoal goal, IloSynchronizeMode mode=IloSynchronizeAndRestart, IloBool restore=IloFalse) const

This member function behaves exactly like IloSolver::solve, except in the case where the model contains an objective (an instance of IloObjective). In this case, solveFeasible finds the first solution respecting all the problem constraints, whereas IloSolver::solve finds a solution respecting all constraints that also optimizes the objective.


startNewSearch

public void startNewSearch(const IlcGoal goal) const

This member function starts a new search with goal. This function is only used inside a search.


startNewSearch

public void startNewSearch(const IloGoal goal=0, IloSynchronizeMode mode=IloSynchronizeAndRestart) const

This member function starts a new search with goal and synchronizes with the model (or not) according to the parameter mode. This member function is used only at the top level of the search.


unsetLimit

public void unsetLimit() const

This member function removes any limits, such as a time limit, a limit on the number of choice points, or a limit on the number of failures, for the invoking solver. This change will influence any subsequent calls of the member functions IloSolver::startNewSearch and IloSolver::solve.


unuse

public void unuse(const IlcConstraintAggregator a) const

This member function removes the constraint aggregator agg from the current list of aggregators in the invoking object.


use

public void use(const IlcConstraintAggregator a) const

This member function adds the constraint aggregator agg to the current list of aggregators in the invoking object. This function must be called before model extraction.


useHeap

public void useHeap(IlcBool useIt) const

If the value of useIt is IlcTrue, then this member function makes the invoking solver use the overloaded new operator to create objects associated with the invoking solver. Those objects are then allocated on the heap associated with that solver; they will be de-allocated when you call the member function end for that solver.

If the value of use is IlcFalse, then Concert Technology uses the conventional C++ new operator.


useLinPropagation

public void useLinPropagation(IlcBool keep=IlcTrue, IloNum precision=0.1) const

This member function changes how Solver handles the propagation of linear constraints. After this member function is called, all linear constraints added to Solver are no longer handled by the default propagation mechanism of Solver. Instead they are collected by a global propagation mechanism. This global propagation can improve performance in cases where the linear constraints reduce the variable domains only by small increments.

 int main () {
   IloEnv env;
   IloModel model(env);
   IloSolver solver(model);
   IloIntVar var1(env, 0, 20000000);
   IloIntVar var2(env, 0, 20000000);
   model.add(var1 < var2);
   model.add(var1 > var2);

   solver.useLinPropagation();

   if(solver.propagate()) {
     cout << "Propagation succeeded" << endl;
     solver.printInformation();
   }
   else {
     cout << "Propagation failed" << endl;
     solver.printInformation();
   }
   env.end();
   return 0;
 }
 

On this example, the use of useLinPropagation significantly improves the running time. Note, however, that the aforementioned global propagation mechanism is more costly and hence not always beneficial with regard to the default propagation mechanism of Solver.


useNonLinConstraint

public void useNonLinConstraint(IlcBool keep=IlcTrue) const

This member function tells the invoking solver to use nonlinear propagation techniques. In order to use these techniques, you must call this member function before you extract your model for the invoking solver. For example,

 solve.useNonLinConstraint();

Then for all the nonlinear constraints in your model, the invoking solver will use nonlinear propagation techniques.

In addition, when the set of nonlinear constraints is a square system of equations or a square system of inequalities, a global constraint will be posted. This constraint may allow for additional propagation.

Furthermore it may allow you to prove that the solution-interval found for the system of nonlinear constraints surely contains a solution.

The keep parameter specifies whether or not in addition to the advanced propagation techniques the invoking solver should also use its default propagation. If keep is IlcTrue constraints are propagated only by the nonlinear propagation techniques; if keep is IlcFalse, the invoking solver will use nonlinear propagation techniques as well as its default propagation techniques.

The default value of keep is IlcTrue.


Inner Enumeration Detail

Enumeration FailureStatus

Definition file: ilsolver/ilosolverhandle.h
Include file: <ilsolver/ilosolver.h>

The values in this enumeration indicate the failure status of an instance of IloSolver after an unsuccessful IloSolver::solve or IloSolver::next. The member function IloSolver::getFailureStatus is used to query the failure status of an instance of IloSolver.

See Also:

Fields

searchHasNotFailed 
searchFailedNormally 
searchStoppedByLimit 
searchStoppedByLabel 
searchStoppedByExit 
unknownFailureStatus