### Random Post

### Recent Posts

- Enigma 1065: Cute cubes
- Enigma 444: Rows and rows
- Puzzle 50: Football and addition
- Enigma 1066: Members of the clubs
- Enigma 443: The bells they are a-changing
- Tantalizer 455: Ballistico
- Tantalizer 456: Square deal
- Enigma 1067: Bye!
- Enigma 442b: Oh yes I did! Oh no you didn’t!
- Puzzle 51: A multiplication

### Recent Comments

Brian Gladman on Enigma 1065: Cute cubes | |

Jim Randell on Enigma 1065: Cute cubes | |

geoffrounce on Enigma 444: Rows and rows | |

Jim Randell on Enigma 444: Rows and rows | |

geoffrounce on Enigma 1611: Three sister… |

### Archives

### Categories

- article (11)
- enigma (1,167)
- misc (2)
- project euler (2)
- puzzle (42)
- site news (45)
- tantalizer (45)
- teaser (3)

### Site Stats

- 180,599 hits

Advertisements

I assumed the couples ages were between 16 and 112.

This Python program runs in 50ms.

Solution:The couple are aged 48 and 53 (although we don’t know which age applies to the husband and which to the setter).The transitions between the two ages are given below:

In the published solution it gives the setters ages as 48 and the husbands age as 53, but I don’t see any way to distinguish the ages.

Here are two other, and different, approaches:

1) Constraint Programming with MiniZinc: http://hakank.org/minizinc/age_changing.mzn

Note: Just few FlatZinc solvers can handle mixed var int and var floats: Gecode, JaCoP, and G12 mip. Gecode solves this in 23ms (and with symmetry breaking that “my age” <="husbands age": 5ms).

2) Picat: http://hakank.org/picat/age_changing.pi

Two variants: go/0 use string parsing and go2/0 use functional + logic approach. However, both models use non-deterministic predicate such as between/3, permute/2.

Solve time is around 200ms.