Maximum Density Still Life:selectBest
From CometPublic
This is the COMET implementation of VDNS used in the Maximum Density Still Life problem. Notice it uses Solutions instead of Checkpoints as exposed in the Meta-heuristic paragraph.
function boolean selectBest(LocalSolver ls, int l, var{int} f, Closure Move) {
bool found = false;
Solution sol(ls);
int best = f;
forall (i in 1..l) {
call(Move);
if (f < best) {
found = true;
best = f;
sol = new Solution(ls);
}
}
sol.restore();
return found;
}

