/** * Records the specified solution as the "best" solution * if it is a feasible solution and if the value of its objective function * is less than the current "best" solution. * This method is called by the search method * for every complete solution it generates. * * @param object ISolution $solution The specified complete solution. */ public function updateBest(ISolution $solution) { if ($solution->isComplete() && $solution->isFeasible() && $solution->getObjective() < $this->bestObjective) { $this->bestSolution = $solution; $this->bestObjective = $solution->getObjective(); } }