Overview | Group | Tree | Graph | Index | Concepts |
The values in this enumeration indicate how Solver should synchronize
changes in a model with its search for solutions. In general, you cannot
modify the current extracted model during a search. In other words, you
cannot change a model while the search is active. A search is
active during the call of IloSolver::solve
and between a call of IloSolver::startNewSearch
and the
corresponding call of IloSolver::endSearch
.
You can change the model only at top level (that is, not nested).
Solver buffers changes you make in a model; the buffered changes are not applied immediately. Certain member functions check that buffer:
IloSolver::solve
checks the buffer at the beginning
of its search.IloSolver::startNewSearch
checks the buffer before
it begins a new search.The values of the enumeration IloSynchronize
mode serve as
parameters to such member functions as IloSolver::startNewSearch.
IloSynchronizeAndRestart
when an instance of
IloSolver
checks the change buffer, makes the
solver discard the current model, discard information about the current
search, possibly extract the new model including these changes (if
necessary), and restart its search “from scratch.”IloSynchronizeAndContinue
indicates that the
member function IloSolver::startNewSearch
should check the buffer
for changes in the model before it begins a new search. For example, in this
mode, the member function will check for such changes in the model as adding
or removing an objective (an instance of
IloObjective
) or a constraint (an instance of
IloConstraint
). Then the solver should synchronize those changes
with its search results if possible. When this mode is in effect, if it is
not possible to take the changes into account without extracting the model
again, Solver will throw an exception,
IloSolver::IloSynchronizeAndContinueNotPossible
.Example
The following lines highlight changes in the model, buffering, and Solver search.
IloEnv env; IloModel model(env); // add extractable objects to model IloSolver solver(model); solver.solve(); // modify the model (A) solver.startNewSearch(mygoal, mode); solver.next(); solver.endSearch();
Solver buffers the changes in part (A). The buffered changes will be taken into account only at top level (not nested).
While part (A) is going on, (that is, while you are making changes to the
model), the solver (the instance of IloSolver
) is not notified about those changes. Instead,
Solver silently buffers the changes that will be checked.
See Also:
Fields |
---|
IloNoSynchronization | |
IloSynchronizeAndRestart | |
IloSynchronizeAndContinue |