IBM ILOG Solver User's Manual > More on Solving > Searching for Optimal Solutions: Replanning Warehouses > Multiphase search: Replanning warehouses |
Multiphase search: Replanning warehouses |
INDEX
![]() |
In Chapter 13, Controlling the Search: Locating Warehouses, you learned how to model and solve a locating warehouses problem. In this chapter, you will model this same problem using multiphase search and stored solutions. The problem is modeled the same as in Chapter 15, Searching for Optimal Solutions: Replanning Warehouses.
First, you fix the suppliers of the first four stores by creating a solution object for the variables you do not want to change:
IloSolution solution(env); solution.add(supplier[0]); solution.add(supplier[1]); solution.add(supplier[2]); solution.add(supplier[3]); // we fix the suppliers of the first 4 stores |
Next, you search for a solution to the whole problem using searchGoal
and the stored solution solution
:
if (solver.solve(searchGoal && IloStoreSolution(env, solution))) |
This initial solution is displayed:
You add an objective to minimize totalCost
and search for an optimal solution using the restored solution:
model.add(IloMinimize(env, totalCost)); solver.solve(IloRestoreSolution(env, solution) && searchGoal); |
Finally, you display the optimal solution:
You can view the complete program online in the file YourSolverHome/examples/src/replan_store.cpp
.
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |