# Example showing how to solve LP associated with
# network flow problem from LP chapter in the algorithms
# textbook. See the other linearExample.mod for more
# details and links.
set V;
set ST;
param s symbolic, in V;
param t symbolic, in V;
param E {i in V, j in V};
var f {i in V, j in V} >= 0;
maximize z: sum{i in V} f[s,i];
s.t. sourceDest: sum{i in V} f[s,i] = sum{i in V} f[i,t];
s.t. edges{i in V, j in V}: f[i,j] <= E[i,j];
s.t. vertices{i in V diff ST}: sum{j in V} f[i,j] = sum{j in V} f[j,i];
data;
set V := ss a b c d e tt;
set ST := ss tt;
param E: ss a b c d e tt:=
ss 0 3 3 4 0 0 0
a 0 0 0 0 2 0 0
b 0 10 0 0 1 0 0
c 0 0 0 0 0 5 0
d 0 0 0 0 0 1 2
e 0 0 0 0 0 0 5
tt 0 0 0 0 0 0 0;
param s:= ss;
param t:= tt;
end;