Overview | Group | Tree | Graph | Index | Concepts |
This macro simplifies subclassing the class
IloLargeNHoodI
in
order to create large neighborhoods. When you
use this macro, you are in fact subclassing
IloLargeNHoodI
and
redefining the method IloLargeNHoodI::defineFragment
.
Thus, in the body of the macro, you should make calls
to the function addToFragment
to add
each variable you wish to the fragment.
This macro takes two mandatory parameters. The first is
the name of a function which will be generated that will
create the large neighborhood. The second is the name of
an instance of IloSolver
which is driving the local search. After these two
mandatory parameters, depending on the particular version
of the macro employed, you pass optional parameters in
the usual way using pairs of type and name.
An example of the use of this macro from the
YourSolverHomeexamplessrclstalent.cpp
example is shown below:
ILODEFINELNSFRAGMENT1(SegmentLNSNHood, solver, IloIntVarArray, x) { IlcRandom r = solver.getRandom(); IloInt a = r.getInt(x.getSize()); IloInt b = r.getInt(x.getSize()); if (a > b) { IloInt tmp = a; a = b; b = tmp; } for (IlcInt i = a; i <= b; i++) addToFragment(solver, x[i]); }