FRAMES NO FRAMES

Macro ILODEFINELNSFRAGMENT0

Definition file: ilsolver/iimlns.h
ILODEFINELNSFRAGMENT0(NAME, S)
ILODEFINELNSFRAGMENT1(NAME, S, T1, P1)
ILODEFINELNSFRAGMENT2(NAME, S, T1, P1, T2, P2)
ILODEFINELNSFRAGMENT3(NAME, S, T1, P1, T2, P2, T3, P3)
ILODEFINELNSFRAGMENT4(NAME, S, T1, P1, T2, P2, T3, P3, T4, P4)
ILODEFINELNSFRAGMENT5(NAME, S, T1, P1, T2, P2, T3, P3, T4, P4, T5, P5)
ILODEFINELNSFRAGMENT6(NAME, S, T1, P1, T2, P2, T3, P3, T4, P4, T5, P5, T6, P6)
ILODEFINELNSFRAGMENT7(NAME, S, T1, P1, T2, P2, T3, P3, T4, P4, T5, P5, T6, P6, T7, P7)
Macro for more easily creating LNS neighborhoods.

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]);
}