Overview | Group | Tree | Graph | Index | Concepts |
This abstract implementation class is used to describe a neighborhood
structure that depends on other “child” neighborhood structures.
Solver neighborhoods such as IloConcatenate
,
IloRandomize
, and IloContinue
belong to this category of neighborhood. Such
neighborhoods do not generate neighbors in their own right, but pass back
neighbors produced by their children. The main job of a neighborhood
modifier is to maintain a mapping between the indices of neighbors for the
neighborhood modifier and the corresponding child neighborhoods and indices
within these child neighborhoods. The member function IloNHoodModifierI::mapIndex performs this maintenance. Additional behaviors can be
added. One example is to manipulate normally produced deltas in some way,
for instance by adding additional variables, before they are returned.
See Also:
Constructor and Destructor Summary | |
---|---|
public | IloNHoodModifierI(IloEnv env, IloNHoodArray a, const char * name=0) |
public | IloNHoodModifierI(IloEnv env, IloNHood nh, const char * name=0) |
public | IloNHoodModifierI(IloEnv env, IloNHood nh1, IloNHood nh2, const char * name=0) |
Method Summary | |
---|---|
public IloSolution | define(IloSolver solver, IloInt index) |
public void | display(ostream & out) const |
public IloInt | getLocalIndex(IloSolver solver, IloInt index) const |
public IloNHoodI * | getLocalNHood(IloSolver solver, IloInt index) const |
public IloNHood | getNHood(IloInt i) const |
public IloInt | getNHoodSize(IloInt i) const |
public IloInt | getNumberOfNHoods() const |
public IloInt | getSize(IloSolver solver) const |
public virtual void | mapIndex(IloSolver solver, IloInt index, IloNHood & nhood, IloInt & offset) const |
public void | notify(IloSolver solver, IloInt index) |
public void | notifyOther(IloSolver solver, IloSolution delta) |
public void | reset() |
public void | start(IloSolver solver, IloSolution solution) |
Inherited Methods from IloNHoodI |
---|
define, display, getEnv, getLocalIndex, getLocalNHood, getName, getObject, getSize, notify, notifyOther, operator delete, reset, setName, setObject, start |
Constructor and Destructor Detail |
---|
This constructor builds a neighborhood modifier that combines all
neighborhoods in the array a
. The optional argument
name
, if provided, becomes the name of the neighborhood.
This constructor builds a neighborhood modifier that depends on just one
neighborhood nh
. The optional argument name
,
if provided, becomes the name of the neighborhood.
This constructor builds a neighborhood modifier that depends on two
neighborhoods, nh1
and nh2
. The optional
argument name
, if provided, becomes the name of the
neighborhood.
Method Detail |
---|
This member function calls IloNHoodModifierI::define
on one of its child
neighborhoods with an appropriately adjusted index. The computation of the
child neighborhood and adjusted index are performed by the
IloNHoodModifierI::mapIndex member function. If you wish
define
to have some additional behavior, you can redefine
this function. In this case, you must still call
IloNHoodModifierI::define(solver, index)
in your subclass and
return the delta delivered (or a modified version of it).
This virtual member function displays the name of the neighborhood,
if named. Otherwise, it prints "IloNHoodI
", followed by the
address of the invoking object in brackets.
This member function converts the index index
to the index
in the atomic neighborhood responsible for defining neighbor
index
. To do this, it uses the member function
IloNHoodModifierI::mapIndex
.
This member function returns the atomic neighborhood responsible for
defining the neighbor indexed index
. To do this, it uses the
member function IloNHoodModifierI::mapIndex
.
This member function delivers the ith neighborhood specified
at construction time. If you constructed the neighborhood modifier with
an array, this member function returns the ith element of that
array. If you constructed the neighborhood modifier with two neighborhoods,
getNHood(0)
returns nhood0
and
getNHood(1)
returns nhood1
. Finally, if you
constructed the neighborhood modifier with only one neighborhood,
getNHood(0)
returns that neighborhood.
This member function returns the size of the ith neighborhood
specified at construction time. The indexing rules for neighborhoods are
the same as those described in the description for the member function
getNHood
. Although this member function is functionally
equivalent to getNHood(i).getSize(solver)
(given an instance
of IloSolver
solver
), it can be faster as the
size is cached in the neighborhood modifier and not recomputed from the
child neighborhood.
This member function returns the number of neighborhoods specified at
construction time. The value returned is one greater than the legal
maximum value with which you can call IloNHoodModifierI::getNHood
or
IloNHoodModifierI::getNHoodSize
.
This member function returns the sum of the sizes of the child neighborhoods. You may redefine this behavior if desired.
This member function maintains a mapping between the indices of
neighbors for the neighborhood modifier and the corresponding
child neighborhoods and indices within these child neighborhoods.
You should thus redefine this member function to convert the index
index
to a neighborhood nhood
and an
index offset
within that neighborhood.
nhood
and offset
are passed by reference
so that you can fill in the details. solver
is the active
solver. An example of how to do this for a modifier which
concatenates two neighborhoods is shown in the IBM ILOG Solver User's
Manual.
This member function calls IloNHoodModifierI::notify
on one of its child
neighborhoods with an appropriately adjusted index. The computation of
the child neighborhood and adjusted index are performed by the
IloNHoodModifierI::mapIndex
member function. For all other child
neighborhoods, IloNHoodModifierI::notifyOther
is called. If you wish
notify
to have some additional behavior, you can redefine
this function. In this case, you must still call
IloNHoodModifierI::notify(solver, index)
in your subclass.
This member function calls notifyOther
on all child neighborhoods. If you wish notifyOther
to have
some additional behavior, you can redefine this function. In this case,
you must still call
IloNHoodModifierI::notifyOther(solver, delta)
in your
subclass.
This member function calls IloNHoodModifierI::reset
on all child
neighborhoods.
This member function calls start
on all child
neighborhoods passing the parameters it receives. It then calls
getSize
on all child neighborhoods and caches the
values returned. These sizes can be later retrieved by
getNHoodSize
. If you wish
start
to have some additional behavior, you can redefine
this function. In this case, you must still call
IloNHoodModifierI::start(solver, solution)
in your
subclass.