IBM ILOG Solver User's Manual > More on Solving > Controlling the Search: Locating Warehouses > Suggested answers > Exercise 4

Modify the file YourSolverHome/examples/src/graph.cpp to use Slice-Based Search (SBS) instead of the default Depth-First Search (DFS). Comment out the code using the IloBasicLevel filter level. Run the file on the clique set starting with size 61. As you remember, this is a particularly difficult instance of the problem to solve. Evaluate the solutions you get and compare them to the solution you found in Chapter 12, Setting Filter Levels: Coloring Graphs.

Suggested Answer

The code that has changed from graph.cpp follows. You can also view the complete program online in the file YourSolverHome/examples/src/storesbs_ex4.cpp.

You change the goal as follows:

    IloGoal goal = IloGenerate(env,vars,IloChooseMinSizeInt);
    IloNodeEvaluator SBSNodeEvaluator = IloSBSEvaluator(env, 4);
    IloGoal finalGoal = IloApply(env, goal, SBSNodeEvaluator);

You use this goal to solve the problem:

    if (!solver.solve(finalGoal))

You should comment out the basic filter level run:

  //IloBasicLevel
  //solver.setDefaultFilterLevel(IloAllDiffCt,IloBasicLevel);
  //timer.restart();
  //if (! solver.solve(finalGoal))
  //  solver.out() << "No solution" << endl;
  //solver.out() << "IloBasicLevel \t \t clique size:" << nTest;
  //solver.out() << "\t#fails:\t" << solver.getNumberOfFails() << "\t";
  //solver.out() << "cpu time: " << timer.getTime() << " s" << endl;
  //solver.out() << endl;

You should get the following results for cliques of size 61 using Slice-Based Search (SBS). The results will vary depending on platform, machine, configuration, and so on:

--------------------------------------
IloExtendedLevel      clique size:61 #fails: 5       cpu time: 22.812 s
IloMediumLevel        clique size:61 #fails: 4002    cpu time: 42.26 s

You can compare this to results for cliques of size 61 using the default Depth-First Search (DFS). For the IloMediumLevel filter level, the differences are dramatic, both in a greatly reduced number of fails and a greatly reduced solution time. The results will vary depending on platform, machine, configuration, and so on.


--------------------------------------
IloExtendedLevel      clique size:61 #fails: 5       cpu time: 22.502 s
IloMediumLevel        clique size:61 #fails: 120408491       cpu time: 172926 s