Problem Description. There are five houses.
- The Englishman lives in the red house.
- The Spaniard owns the dog.
- Coffee is drunk in the green house.
- The Ukrainian drinks tea.
- The green house is immediately to the right of the ivory house.
- The Old Gold smoker owns snails.
- Kools are smoked in the yellow house.
- Milk is drunk in the middle house.
- The Norwegian lives in the first house.
- The man who smokes Chesterfields lives in the house next to the man with the fox.
- Kools are smoked in the house next to the house where the horse is kept.
- The Lucky Strike smoker drinks orange juice.
- The Japanese smokes Parliaments.
- The Norwegian lives next to the blue house.
Question: where is Zebra?
Implementation. Let’s start with a business glossary:
Here is the corresponding data (test case):
Here are two main tables “Define” and “Solve”:
The following tables defines variables with domains from 1 to 5 specifying yet unknown house numbers:
The following table defines expressions needed to express problem constraints:
This table defines constraints that will be posted later:
And now we are ready to post all constraints:
As you can see, we used here different constraint types: VarOperVar, VarOperValue, Or, AllDiff.
After a double-click on “test.bat”, we will receive the following results:
THE END