IBM ILOG Solver User's Manual > Local Search > Basic Local Search > Constructing moves |
Constructing moves |
INDEX
![]() |
Sometimes the construction of a goal which makes a single move can be a little laborious. To that end, Solver provides a way of creating such standard goals via the function IloSingleMove
. One of the synopses of IloSingleMove
is as follows:
IloGoal IloSingleMove(IloEnv env, IloSolution solution, IloNHood nhood, IloMetaHeuristic mh, IloSearchSelector sel); |
The parameters comprise the elements needed to build up a goal that makes a single move. We supply a solution, a neighborhood, a metaheuristic, and a search selector that selects a move from the neighborhood. The generated goal automatically generates an IloScanNHood
goal and automatically notifies the neighborhood and metaheuristic that a move is about to be taken. IloSingleMove
also stores the current solution before succeeding.
In our simulated annealing example, given we had defined the solution soln
, we could have replaced:
with:
IloGoal move = IloSingleMove(env, soln, nh, simAnn, IloFirstSolution(env)); |
The use of IloSingleMove
usually makes the use of IloScanNHood
, IloScanDeltas
, IloNotify
, and IloApplyMetaHeuristic
unnecessary, unless more complex goals need to be built which require the use of these lower level functions. Therefore, you should try to write your local search algorithms using IloSingleMove
, using the other functions where IloSingleMove
does not suffice.
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |