IBM ILOG Solver User's Manual > Local Search > Basic Local Search > Example: Map coloring |
Example: Map coloring |
INDEX
![]() |
Consider the map coloring problem. In that problem, the map of Western Europe must be colored with only two colors. The constraints dictate that no two countries sharing a border can have the same color. However, in such a case, there is no solution. Therefore, the constraint on Luxembourg having a different color from its neighbors is relaxed, and a cost on its having the same color as a neighbor is added. In that example, the optimal assignment of colors is found using a complete search.
Here, as an introduction to using local search procedures, we replace the complete search for the minimum cost color assignment with a local search.
First of all, we list the definition of the model of the problem:
At this point, if we were using a complete search technique, we would add the objective to the model, create the solver from the model, and use IloSolver::solve(IloGoal)
to find the optimal solution. However, here we will use a local search technique which proceeds in two phases. In the first phase, we generate an initial solution, and in the second, we improve it using local search.
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |