Overview | Group | Tree | Graph | Index | Concepts |
This handle class comprises methods that describe a metaheuristic that can be used within local search procedures. The metaheuristic defines a filter for the set of possible moves that can be taken, and thus provides search guidance.
The exact choice of which legal move is to be taken is performed by
search selectors (objects of type IloSearchSelector
), not by
the IloMetaHeuristic
class.
Protocol
When used in a local search framework, metaheuristics should be called according to the following protocol:
IloSingleMove
adheres to this protocol.
See Also:
IloApplyMetaHeuristic, IloMetaHeuristicI, IloNotify, IloScanDeltas, IloScanNHood, IloSingleMove, IloStart, IloTest
Constructor Summary | |
---|---|
public | IloMetaHeuristic() |
public | IloMetaHeuristic(IloMetaHeuristicI * impl) |
Method Summary | |
---|---|
public IloBool | complete() |
public void | end(IloBool deep=IloTrue) |
public IloSolutionDeltaCheck | getDeltaCheck() const |
public IloEnv | getEnv() |
public IloMetaHeuristicI * | getImpl() const |
public const char * | getName() const |
public IloAny | getObject() const |
public IloBool | isFeasible(IloSolver solver, IloSolution delta) const |
public void | notify(IloSolver solver, IloSolution delta) |
public void | operator=(const IloMetaHeuristic & mh) |
public void | reset() |
public void | setName(const char * name) const |
public void | setObject(IloAny obj) const |
public IloBool | start(IloSolver solver, IloSolution solution) |
public IloBool | test(IloSolver solver, IloSolution delta) |
Constructor Detail |
---|
This constructor creates a metaheuristic whose handle pointer is null. This object must be assigned before it can be used.
This constructor creates a handle object (an instance of
IloMetaHeuristic
) from a pointer to an implementation
object (an instance of IloMetaHeuristicI
).
Method Detail |
---|
This member function is normally called when the search has
stagnated (typically when no neighborhood moves can be legally taken).
This allows the metaheuristic to perform some action to allow the search
to continue, if desired. If the return value is IloTrue
, the
metaheuristic wants to end local search at this point.
This member function calls operator delete
from the class
IloMetaHeuristicI
on the
implementation object associated with the invoking handle and sets the
implementation pointer to 0. If the invoking metaheuristic has any
children (for instance, if it were constructed using a +
operator) then these too will be likewise deleted. If however,
deep
has the value IloFalse
, then the children
are “disconnected” from the parent before delete
is called on the implementation pointer to ensure that the children of the
invoking metaheuristic are not destroyed.
Meta-heuristics are capable of performing “prefiltering” of
solution deltas to be applied to a solution.This member function returns
an object that performs the pre-filtering for the metaheuristic. This
object may be passed to IloScanNHood
.
This member function returns the environment associated with the implementation class.
This member function returns the implementation object of the invoking metaheuristic (a handle). You can use this member function to check whether a metaheuristic is empty.
This member function returns a character string specifying the name of the invoking object (if there is one).
This member function returns the object associated with the invoking object (if there is one). Normally, an associated object contains user data pertinent to the invoking object.
This member function is called by the ok()
method of
the object returned by IloMetaHeuristic::getDeltaCheck
.
That object is used in local search procedures to “pre-filter”
some deltas before they are applied to the current solution.
The argument solver
indicates the solver that is currently
performing a local search using the invoking metaheuristic.
The user can define this member function to perform the pre-filtering
desired. The default behavior is to return IloTrue
, indicating
that delta
is feasible.
Call this member function when a neighborhood move is to be taken by local search. At that point, all solution variables should be instantiated, but not yet saved, in the current solution, thus allowing differences to be calculated. This can be useful for updating metaheuristic data structures.
The argument solver
indicates the solver that is currently
performing a local search using the invoking metaheuristic.
The argument delta
holds the solution delta of the move to
be taken. This can be gleaned from the reference parameter
atDelta
passed to IloScanDeltas
or IloScanNHood
, and used in
IloNotify
. While this parameter can be used
in custom metaheuristics, an empty handle can be passed to all of Solver's
pre-defined metaheuristics, as it is not required by them.
This assignment operator copies mh
into the invoking
metaheuristic by assigning an address to the handle pointer of the
invoking object. That address is the location of the implementation
object of the argument mh
.
This member function resets the metaheuristic to the state in which it
was first created. When metaheuristics have state, you will typically
want to call this member function between two different local searches
if the metaheuristic is to be reused. For metaheuristics which have
no state, calling this member function has no effect. (All of Solver's
metaheuristics have state except IloImprove
.)
This member function assigns name
to the invoking object.
This member function associates obj
with the
invoking object. The member function getObject
accesses
this associated object afterward. Normally, obj
contains
user data pertinent to the invoking object.
Call this member function when a local search begins to search for
a new move to take. The argument solver
indicates the
solver that is currently performing a local search using the
invoking metaheuristic. The argument solution
is the
current solution. If it is illegal for the metaheuristic to start
from this point, this member function returns IloFalse
or causes a failure. Otherwise it returns IloTrue
.
When all solution variables have been instantiated in local search,
call this member function to determine whether the metaheuristic
should allow or reject the solution. If the solution is rejected, this
member function returns IloFalse
or causes a failure.
Otherwise it returns IloTrue
.
The argument solver
indicates the solver that is
currently performing a local search using the invoking metaheuristic.
The argument delta
holds the solution delta to test.
This can be gleaned from the reference parameter atDelta
passed to IloScanDeltas
or
IloScanNHood
, and used in
IloTest
. While this parameter can be
used in custom metaheuristics, an empty handle can be passed to all
of Solver's pre-defined metaheuristics, as it is not required by them.