/***
--- !Test
solvers: [cbc]
check_against: [gecode]
expected: !Result
  status: SATISFIED
--- !Test
solvers: [gecode, chuffed]
expected:
- !Result
  solution: !Solution
    cabbage:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    farmer:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    goat:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    wolf:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
- !Result
  solution: !Solution
    cabbage:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    farmer:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    goat:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    wolf:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
- !Result
  solution: !Solution
    cabbage:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    farmer:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    goat:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    wolf:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
- !Result
  solution: !Solution
    cabbage:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    farmer:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    goat:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    wolf:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
- !Result
  solution: !Solution
    cabbage:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    farmer:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    goat:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    wolf:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
- !Result
  solution: !Solution
    cabbage:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    farmer:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    goat:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    wolf:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
- !Result
  solution: !Solution
    cabbage:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    farmer:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    goat:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    wolf:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
- !Result
  solution: !Solution
    cabbage:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    farmer:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    goat:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    wolf:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
- !Result
  solution: !Solution
    cabbage:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    farmer:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    goat:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    wolf:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
- !Result
  solution: !Solution
    cabbage:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    farmer:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    goat:
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [false, true, false]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    wolf:
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, false, true]
    - [false, true, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
    - [true, false, false]
***/

%-----------------------------------------------------------------------------%
% The wolf, goat, cabbage problem
%
% A farmer has to take a wolf, goat and cabbage across a bridge
% He can only take one thing at a time
% The wolf and goat can't be left together alone (without the farmer)
% The goat and cabbage can't be left alone together
%-----------------------------------------------------------------------------%

% horizon is the maximum number of steps that might be required in the plan
int: horizon = 20;

%-----------------------------------------------------------------------------%

% 1..3 represent the three locations:
% 1 is on the left bank of the river
% 2 is on the bridge
% 3 is on the right bank
% A boolean, for each object, time and location,
% holds if the object is at the location at that time
array [1..horizon,1..3] of var bool: wolf;
array [1..horizon,1..3] of var bool: goat;
array [1..horizon,1..3] of var bool: cabbage;
array [1..horizon,1..3] of var bool: farmer;

%-----------------------------------------------------------------------------%

% Things can only move from bank to bridge, or from bridge to bank, in one step
constraint forall(t in 2..horizon,loc1 in 1..3,loc2 in 1..3)
                  (wolf[t-1,loc1] /\ wolf[t,loc2] -> loc1-loc2<2 /\ loc2-loc1<2);

constraint forall(t in 2..horizon,loc1 in 1..3,loc2 in 1..3)
                  (goat[t-1,loc1] /\ goat[t,loc2] -> loc1-loc2<2 /\ loc2-loc1<2);

constraint forall(t in 2..horizon,loc1 in 1..3,loc2 in 1..3)
                  (cabbage[t-1,loc1] /\ cabbage[t,loc2] -> loc1-loc2<2 /\ loc2-loc1<2);

constraint forall(t in 2..horizon,loc1 in 1..3,loc2 in 1..3)
                  (farmer[t-1,loc1] /\ farmer[t,loc2] -> loc1-loc2<2 /\ loc2-loc1<2);

% Can't leave wolf and goat, or goat and cabbage, together
constraint (forall(t in 1..horizon,loc in 1..3)
           ( (wolf[t,loc] /\ goat[t,loc] -> farmer[t,loc])
             /\
             (goat[t,loc] /\ cabbage[t,loc] -> farmer[t,loc])
           ) );

% The wolf is somewhere at each time point, and is only in one place
constraint forall(t in 1..horizon)
           (exists(loc in 1..3)
             (wolf[t,loc] /\ forall(loc2 in 1..3 where loc2!=loc)
                                   (not wolf[t,loc2])
             )
           );
% Similarly for the goat, cabbage and farmer...
constraint forall(t in 1..horizon)
           (exists(loc in 1..3)
             (goat[t,loc] /\ forall(loc2 in 1..3 where loc2!=loc)
                                   (not goat[t,loc2])
             )
           );
constraint forall(t in 1..horizon)
           (exists(loc in 1..3)
             (cabbage[t,loc] /\ forall(loc2 in 1..3 where loc2!=loc)
                                   (not cabbage[t,loc2])
             )
           );
constraint forall(t in 1..horizon)
           (exists(loc in 1..3)
             (farmer[t,loc] /\ forall(loc2 in 1..3 where loc2!=loc)
                                   (not farmer[t,loc2])
             )
           );

% The wolf can ony be on the bridge if:
% (a) The farmer is on the bridge, and neither the goat nor the cabbage is
% (b) The farmer was previously on the same bank as the wolf
% (c) The farmer goes subsequently to the same bank as the wolf
constraint forall(t in 2..horizon-1)
           ((wolf[t,2] -> farmer[t,2] /\ not goat[t,2] /\ not cabbage[t,2]
              /\ (wolf[t-1,3] <-> farmer[t-1,3]) /\ not farmer[t-1,2]
              /\ (wolf[t+1,3] <-> farmer[t+1,3]) /\ not farmer[t+1,2])
           /\
% Similarly for the cabbage
           (cabbage[t,2] -> farmer[t,2] /\ not goat[t,2] /\ not wolf[t,2]
               /\ (cabbage[t-1,3] <-> farmer[t-1,3]) /\ not farmer[t-1,2]
               /\ (cabbage[t+1,3] <-> farmer[t+1,3]) /\ not farmer[t+1,2])
           /\
% and for the goat
           (goat[t,2] -> farmer[t,2] /\ not wolf[t,2] /\ not cabbage[t,2]
                /\ (goat[t-1,3] <-> farmer[t-1,3]) /\ not farmer[t-1,2]
                /\ (goat[t+1,3] <-> farmer[t+1,3]) /\ not farmer[t+1,2])
           );

% The animals all start on the right bank and finish on the left bank
constraint
      (wolf[1,3] /\ goat[1,3] /\ cabbage[1,3]
      /\
      wolf[horizon,1] /\ goat[horizon,1] /\ cabbage[horizon,1]
      );


solve ::bool_search(array1d(1..3*horizon,wolf)++array1d(1..3*horizon,goat)++array1d(1..3*horizon,cabbage)++array1d(1..3*horizon,farmer), input_order, indomain_max, complete) satisfy;

%-----------------------------------------------------------------------------%

output [
        "wolf    : ", show(wolf),    "\n",
        "goat    : ", show(goat),    "\n",
        "cabbage : ", show(cabbage), "\n",
        "farmer  : ", show(farmer),  "\n"
];

%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%

