/*
3-jugs problem (as a shortest path problem)
Taha, Operations Research, page 245f
This AMPL model was created by Hakan Kjellerstrand, hakank@gmail.com
See also my AMPL page: http://www.hakank.org/ampl/
*/
/*
The model is based on the shortest_path_taha.mod
model from
http://taha.ineg.uark.edu/shortest.txt
--------- shortest route model (Example 6.3-6)----------------
The result:
Shortest length from 1 to 15 = 7
Associated route: 1 - 9 - 10 - 11 - 12 - 13 - 14 - 15
*/
param n;
param start;
param end;
param M=999999;
param d{i in 1..n, j in 1..n} default M;
param rhs{i in 1..n}=if i=start then 1
else (if i=end then -1 else 0);
var x{i in 1..n,j in 1..n:d[i,j]=0;
var outFlow{i in 1..n}=sum{j in 1..n:d[i,j]