Overview | Group | Tree | Graph | Index | Concepts |
This function returns a goal that makes a single local move as defined
by a neighborhood, a metaheuristic, and a move selection method. The goal
scans the neighborhood nhood
using solution
as
the current solution. The metaheuristic mh
is used to filter
moves, and the search selector sel
to choose a single move
from those that become available. Additionally, a goal subgoal
can be executed after the deltas from the neighborhood are applied to
the current solution. A neighbor identifier nid
can be
specified which can, on successful completion of a move, be used to
provide information about the neighbor.
If no metaheuristic is specified, no metaheuristic filtering is
performed. If no selector is specified, IloFirstSolution
is assumed. If no subgoal is specified, none is executed.
If a successful move can be found, the goal succeeds. The constrained
variables are in the state corresponding to the application of the move.
This new state is saved to solution
before the goal succeeds.
If no successful move can be found, the goal fails, and
solution
is left unchanged.
When IloSingleMove
is used, the
IloMetaHeuristic::test
and
IloMetaHeuristic::notify
methods of the supplied
metaheuristic are supplied with the relevant solution delta, and
the neighborhood is notified with the index of the chosen neighbor.
This is done through sharing of the neighbor identifier among
IloScanNHood
,
IloTest
, and
IloNotify
.
Implementation
The execute method of this goal can be implemented as follows:
IlcGoal IlcSingleMoveI::execute(){ IlcGoal scan = IloScanNHood(solver, nh, nid, solution, mh.getDeltaCheck()); IlcGoal testGoal = IloTest(solver, mh, nid); IlcGoal exploreNHood = IlcAnd(IloStart(solver, mh, solution), scan, testGoal, subgoal, testGoal); IlcGoal saveGoal = IlcAnd(IloNotify(solver, nh, nid), IloNotify(solver, mh, nid), IloStoreSolution(solver, solution)); return IlcAnd(IlcSelectSearch(exploreNHood, sel), saveGoal); }
See Also:
IlcNeighborIdentifier, IloApplyMetaHeuristic, IloMetaHeuristic, IloNeighborIdentifier, IloNHood, IloNotify, IloScanNHood