IBM ILOG Solver User's Manual > The Basics > Modeling and Solving a Simple Problem: Map Coloring > Suggested answers > Exercise 3

Change the code so that Germany and Denmark are always the same color. Except for Germany and Denmark, no two neighboring countries are the same color.

Suggested Answer

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

    model.add(Denmark == Germany ); 

You should obtain the following result:

FEASIBLE Solution
Belgium:     blue
Denmark:     yellow
France:      white
Germany:     yellow
Luxembourg:  green
Netherlands: white