Overview | Group | Tree | Graph | Index | Concepts |
This handle class is used to define neighborhood structures that can be used by local search procedures. The central idea of the neighborhood is to define a set of solution changes, or deltas, that represent alternative moves that can be taken.
Protocol
The protocol for driving an object of type IloNHood
is as
follows:
For more information, see IloSolution
in the
IBM ILOG Concert Technology Reference Manual.
See Also:
IloConcatenate, IloNHoodI, IloSample, IloScanDeltas, IloScanNHood
Constructor Summary | |
---|---|
public | IloNHood() |
public | IloNHood(IloNHoodI * impl) |
public | IloNHood(const IloNHood & nhood) |
Method Summary | |
---|---|
public IloSolution | define(IloSolver solver, IloInt index) |
public void | end(IloBool deep=IloTrue) |
public IloEnv | getEnv() const |
public IloNHoodI * | getImpl() const |
public IloInt | getLocalIndex(IloSolver solver, IloInt index) const |
public IloNHood | getLocalNHood(IloSolver solver, IloInt index) const |
public const char * | getName() const |
public IloAny | getObject() const |
public IloInt | getSize(IloSolver solver) const |
public void | notify(IloSolver solver, IloInt index) const |
public void | notifyOther(IloSolver solver, IloSolution delta) const |
public void | operator=(const IloNHood & nhood) |
public void | reset() |
public void | setName(const char * name) const |
public void | setObject(IloAny obj) const |
public void | start(IloSolver solver, IloSolution current) const |
Constructor Detail |
---|
This constructor creates a neighborhood whose implementation pointer is 0 (zero). The handle must be assigned before its methods can be used.
This constructor creates a handle object (an instance of the class
IloNHood
) from a pointer to an implementation object
(an instance of the class IloNHoodI
).
This constructor creates a handle object from a reference to a
neighborhood. After execution, both the newly constructed handle object
and nhood
point to the same implementation object.
Method Detail |
---|
This member function returns the change in the current solution
to be made when making move index
in the neighborhood.
The neighbors are numbered from 0. If an empty handle is returned, no
change is defined for this index.
The argument solver indicates the solver that is scanning the invoking
neighborhood. (See IloScanNHood
.)
This member function calls delete
on
the implementation object associated with the invoking handle and sets the
implementation pointer to 0. If the invoking neighborhood 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 neighborhood are not destroyed.
This member function returns the environment associated with the implementation class.
This member function returns the implementation object of the invoking handle. You can use this member function to check whether a neighborhood is empty.
This member function converts the index index
to the index
in the atomic neighborhood responsible for defining neighbor
index
. This member function is useful for finding the index
in the neighborhood that defined a neighbor when the invoking neighborhood
is made up of neighborhoods combined via concatenation
(operator operator+
or
IloConcatenate
). It is also useful
when the invoking neighborhood has been modified (for instance via
IloRandomize
). In typical usage, the index
passed
originates from an instance of IloNeighborIdentifier
.
This member function returns the atomic neighborhood responsible for
defining the neighbor indexed index
. This member function is
useful for finding the exact neighborhood that defined a neighbor when the
invoking neighborhood is made up of neighborhoods combined via
(operator+
or
IloConcatenate
). In typical usage,
the index
passed originates from an instance of
IloNeighborIdentifier
.
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 returns the “size” of the neighborhood,
that is, one more than the maximum index that
IloNHood::define
can legally be called with. The
argument solver indicates the solver that is scanning the invoking
neighborhood. (See IloScanNHood
.)
This member function is called when a neighborhood move is about to be
taken. It is called with index
equal to the index of the
neighbor currently being accepted by local search. The argument solver
indicates the solver that is scanning the invoking neighborhood.
(See IloScanNHood
.)
At the point of calling, the constrained variables corresponding to
the solution passed to IloNHood::start
should be instantiated, but
not yet been saved to the current solution. This allows inspection of
the differences. Default behavior is to do nothing.
This member function is a counterpart to IloNHood::notify
.
When neighborhoods are joined with operator+
or IloConcatenate
, only one basic neighborhood can
have IloNHood::notify
called: the one that defined the
delta for the move to be taken. For all other basic
neighborhoods, notifyOther
is called with the
delta for the move to be taken.
The argument solver
indicates the solver that is
scanning the invoking neighborhood.
(See IloScanNHood
.)
This assignment operator copies nhood
into the invoking
neighborhood by assigning an address to the handle pointer of the invoking
object. That address is the location of the implementation object of the
argument nhood
.
This member function resets the neighborhood to the state in which it
was first created. For neighborhoods which have no state, calling this
member function has no effect. An example of a neighborhood with state
is IloContinue
which, after each move, adjusts neighborhood
indices to ensure that new indices are explored. When neighborhoods have
state, you will typically want to call this member function between two
different local searches if the neighborhood is to be reused. Most of
Solver's neighborhoods are stateless.
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.
This member function announces to the neighborhood that neighbors
will be requested of it (through IloNHood::define
),
and that current
is the reference point of these changes.
That is, all changes specified afterwards via calls to
IloNHood::define
(until start
is called
again) should relate to changes of current
.
The argument solver indicates the solver that is scanning the invoking
neighborhood. (See IloScanNHood
.)