### Random Post

### Recent Posts

### Recent Comments

Jim Randell on Enigma 457: Divided by ex… | |

geoffrounce on Puzzle 44: Men-only Mews | |

Jim Randell on Puzzle 44: Men-only Mews | |

Brian Gladman on Enigma 1053: Home truths | |

Jim Randell on Enigma 1053: Home truths |

### Archives

### Categories

- article (11)
- enigma (1,192)
- misc (3)
- project euler (2)
- puzzle (48)
- site news (47)
- tantalizer (51)
- teaser (3)

### Site Stats

- 186,584 hits

Advertisements

To save having to decide which constraints to consider first, I expressed the puzzle as a set of MiniZinc constraints and let the solver do the hard work.

Here’s the MiniZinc model.

On its own the model executes in 84ms (using the

mzn-gecode -asolver), but the output of the decision table needs to be tidied up to make sense of it. I used theminizinc.pywrapper to let me format the solution using Python.This Python program executes in 152ms.

Solution:Alice and Emily admitted to intemperance. Beatrice and Flavia admitted to envy.The full results are:

I found the constraints that each person has a

differentpair of sins (and each sin adifferentpair of people) the hardest to express. I expressed them as “different people cannot have the same values for the sins” (i.e. for each pair of people there must be a sin that one of them admits to and the other doesn’t), and the second constraint is handled similarly. Disappointingly we don’t get additional solutions if these constraints are not included in the model, so they are superfluous.