model ModelName options noimplicit uses "mmxprs" ! uses "mminsight" ! uncomment this line for an Xpress Insight model declarations ARCS: range !set of arcs, consucutive integer numbers NODES = 1..12 !set of nodes PIPE: array(ARCS,1..2) of integer !identifies origin and destintaion node of each arc CAP: array(ARCS) of integer !capacity of each arc SOURCE,SINK: integer TotFlow:linctr flow: array(ARCS) of mpvar end-declarations initialisations from "j1water.dat" PIPE CAP SOURCE SINK end-initialisations !finalise(ARCS) ! declarations ! flow: array(ARCS) of mpvar !end-declarations writeln("Begin running model") forall(a in ARCS) flow(a) <= CAP(a) forall(n in NODES | n <> SOURCE and n <> SINK) sum(a in ARCS | PIPE(a,1) = n) flow(a) = sum(a in ARCS | PIPE(a,2) = n) flow(a) TotFlow := sum(a in ARCS | PIPE(a,2)=SINK) flow(a) maximize(TotFlow) writeln("End running model") writeln("Risultato: ",getobjval) forall(a in ARCS | getsol(flow(a))>0) writeln(PIPE(a,1)," ",PIPE(a,2)," ",getsol(flow(a))) end-model