% Three jugs problem in Minzinc modelled as a shortest path problem.
%
% Problem from Taha "Introduction to Operations Research", page 245f
%
% Model created by Hakan Kjellerstrand, hakank@bonetmail.com
% See also my MiniZinc page: http://www.hakank.org/minizinc
int: n = 15;
int: start = 1; % start node
int: end = 15; % end node
int: M = 999; % large number
array[1..n, 1..n] of 0..M: d; % distance
array[1..n] of var -1..1: rhs; % requirements (right hand statement)
% objective to minimize
var int: z = sum(i in 1..n, j in 1..n where d[i,j]= 0
)
/\ % outflow constraint
forall(i in 1..n) (
outFlow[i] = sum(j in 1..n where d[i,j]