# Alternative representations for the zebra puzzle?

All of the solutions for the zebra puzzle have a variable for each of the properties and a domain with the possible values. For instance A for Nationalities, B for pets, ...

Ai with i = 1..5 and the domain for example {Dutch, Spanish, Italian, French, English}

As I've seen in the n-queens puzzle, there can always be multiple representations for a constraint problem. What could be alternative representations for the zebra puzzle?

For example, I was thinking about following representation:

• HouseOne indices 1..4 with domain {1,2,3,4,5}
• HouseTwo indices 1..4 with domain {1,2,3,4,5}
• HouseThree indices 1..4 with domain {1,2,3,4,5}
• HouseFour indices 1..4 with domain {1,2,3,4,5}
• HouseFive indices 1..4 with domain {1,2,3,4,5}

Could this work?

• What's the zebra puzzle? Also: What properties of the representation are you looking for? Why are you asking? As it stands, this question is not answerable: it does not have an objective answer ("What are the alternative representations...?" has many possible answers, not one answer, and it's not clear how to evaluate a candidate answer -- so it's not an ideal fit for this sort of site). Would you care to make your question more focused somehow? – D.W. Dec 3 '13 at 16:58
• As this is computer science, I taught the zebra puzzle wouldn't need any explanation. I'll update the question. Is constraint-programming a suitable subject for this sort of site, because, seriously, it seems more people and more people are only interested in saying what should and shouldn't be on stack instead of answering questions... – Lieven Cardoen Dec 3 '13 at 18:26
• Constraint programming is very suitable for the site! What kind of alternative representations are you looking for? Here's one as SAT, does that count? – Juho Dec 3 '13 at 18:47
• Let me help you improve the question. Why are you looking for an alternative representation? Presumably you don't want just any old alternative; you are hoping for an alternative that is better in some respect. OK, that's fine. So, what sense of "better" do you have in mind? If I suggest an alternative, how will you evaluate it? What criteria or metrics will you use to evaluate an alternative? Without that information, I still don't think this question is a good fit for this site's format. The site pages say to avoid questions where every answer is equally valid. – D.W. Dec 3 '13 at 23:58
• For more about what questions are suitable and how to ask a good question, see also meta.stackexchange.com/q/139618/160917 – D.W. Dec 4 '13 at 0:00

Another possible representation is as SAT. One of the key steps in representing this using SAT is to encode "one-out-of-$n$" constraints (where a particular object corresponds to a unique other object, so we need it to correspond to exactly one out of the $n$ possible partners for it); these can be encoded in SAT in multiple possible ways. See Encoding 1-out-of-n constraint for SAT solvers for an overview of some technique for that.