FRAMES NO FRAMES

IloUpdateBestSolution

public IlcGoal IloUpdateBestSolution(IloSolver solver, IloSolution best, IloSolution soln)
public IloGoal IloUpdateBestSolution(IloEnv env, IloSolution best, IloSolution current)
Definition file: ilsolver/ilosolverint.h
Include file: <ilsolver/ilosolver.h>

This function returns a goal that copies the values of variables in current to those in best if the value of the objective of current is better than that of best. What is considered better depends on the sense of the objective added to solution. This goal always succeeds.

This function can be implemented as follows:

 IlcGoal IlcUpdateBestSolutionI::execute() {
   if (current.isBetterThan(best)) best.copy(current);
   return 0;
 }
 

For more information, see IloSolution.

See Also: