
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:

It has five input arrays — Colors, People, Drinks, Pets, and Cigarettes — with the names of their elements. The domain “1-5” directs the Solver to create decision variables with possible values from 1 to 5, specifying the yet-unknown house numbers.
Here are the corresponding test cases:

The table “Define” posts constraints and logs the unknown variables. The table “Solve” calls the predefined method “SolverFindSolution:

Here are all constraints:

After a double-click on “test.bat”, we will receive the following results:
- Green[5] Ivory[4] Blue[2] Red[3] Yellow[1]
- Norwegian[1] Ukrainian[2] Japanese[5] Englishman[3] Spaniard[4]
- Juice[4] Tea[2] Milk[3] Water[1] Coffee[5]
- Snail[3] Dog[4] Fox[1] Horse[2] ZEBRA[5]
- Chesterfield[2] Parliament[5] Lucky[4] OldGolds[3] Kools[1]
Thus, Zebra lives in House #5.


