************************************************
results(loopnr, "Mincl")$(loopnr.val = loopcount) = c1.l;
results(loopnr, "nsl")$(loopnr.val = loopcount) = bestns1;
************************************************
Code: Select all
set loopnr Loop number /1*100/;
parameter loopcount /1/;
parameter results(loopnr, *);
parameters
minc1
bestns1
sumz1
sumc1
;
bestns1(heatx)$(r(heatx) ne 1)=1;
minc1(heatx)$(r(heatx) ne 1)=inf;
sumz1=sum(heatx,minc1(heatx));
sumc1=sum(heatx,c1.l(heatx));
parameter n1;
while((smax(heatx, bestns1(heatx)) < 10),
bestns1(heatx)$(r(heatx) ne 1)=bestns1(heatx)+1;
ns1.fx(heatx)=bestns1(heatx);
solve exchanger1 using minlp minimizing z1;
loopcount = loopcount + 1;
results(loopnr, "Mincl")$(loopnr.val = loopcount) = cl.l;
results(loopnr, "nsl")$(loopnr.val = loopcount) = bestns1;
if ((exchanger1.modelstat=1 or exchanger1.modelstat=8) and (sumc1 < sumz1),
minc1(heatx) = c1.l(heatx);
n1(heatx)=bestns1(heatx);
);
);
display minc1,n1, results;