int: num_nodes = 7; %nombre de noeuds int: num_arcs = 13; %nombre d'arcs int: source = 1; int: dest = 7; int: flow = 35; % liste des arcs (noeuds_départ, noeuds_arrivé) array[1..num_arcs, 1..2] of 1..num_nodes: E = array2d(1..num_arcs, 1..2, [ 1, 2, 1, 3, 2, 4, 2, 5, 2, 6, 3, 4, 3, 5, 3, 6, 4, 5, 5, 6, 4, 7, 5, 7, 6, 7]); array[1..num_arcs] of int: l = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; %borne inf array[1..num_arcs] of int: u = [35, 35, 15, 8, 4, 8, 5, 3, 35, 35, 7, 20, 8]; %borne sup array[1..num_arcs] of int: c = [0, 0, 0, 0, 0, 0, 0, 0, 5, 10, 0, 0, 0]; %coût % variable de décision, x[i] = quantité de flot (ie quantité de bois) sur l'arc i array[1..num_arcs] of var float: x; %fonction objectif var float: cost; constraint cost = sum(j in 1..num_arcs)(x[j] * c[j]); %contraintes de capacité constraint forall(i in 1..num_arcs)(x[i] <= u[i]); constraint forall(i in 1..num_arcs)(x[i] >= l[i]); %contrainte de conservation du flux constraint forall(i in 2..num_nodes-1)(sum(j in 1..num_arcs where (E[j,1] == i))(x[j]) - sum(j in 1..num_arcs where (E[j,2] == i))(x[j]) == 0); constraint (sum(j in 1..num_arcs where (E[j,1] == source))(x[j]) == flow); constraint (sum(j in 1..num_arcs where (E[j,2] == dest))(x[j]) == flow); solve minimize cost;