model ModelName uses "mmxprs"; !gain access to the Xpress-Optimizer solver declarations sac = 1..10 cont = 1..3 P: array(cont) of integer C: array(cont) of real W: array(sac) of integer K: array(cont) of integer vinc: array(cont) of linctr q: mpvar y: array(sac, cont) of mpvar end-declarations P::[5, 4, 3] C::[0.3, 0.2, 0.5] W::[12, 31, 45, 22, 9, 26, 18, 10, 33, 28] K::[70, 80, 90] sum(i in sac, j in cont) P(j)*y(i,j) = 1 forall(i in sac) sum(j in cont) y(i,j) = q forall(j in cont) vinc(j) := sum(i in sac) W(i)*y(i,j) <= K(j)*q utility := sum(i in sac, j in cont) C(j)*y(i,j) maximize(utility) writeln("Soluzione 1: ",getobjval) forall(i in sac, j in cont) do if getsol(y(i,j)) > 0 then writeln("i.",i," j.",j,": ",getsol(y(i,j))/getsol(q)) end-if end-do sethidden(vinc(2), true) maximize(utility) writeln("Soluzione 2: ",getobjval) forall(i in sac, j in cont) do if getsol(y(i,j)) > 0 then writeln("i.",i," j.",j,": ",getsol(y(i,j))/getsol(q)) end-if end-do end-model