Dear Renger,dasa wrote: ↑3 years agoImpressive!!! thanks you so much.Renger wrote: ↑3 years agoCheersCode: Select all
set t /1*5/ m /1*2/; parameter a(m) /1 2,2 3/; parameter b(m) /1 5,2 4.5/; variables Pm(t),z; parameter am, bm, resultsm, resultsmt; equation o1, c1, c2; o1.. z =e= am*sum(t,Pm(t))+bm; c1(t).. Pm(t) =l= 5; c2(t).. Pm(t) =g= 0; model gg /all/; loop(m, am = a(m); bm = b(m); solve gg using lp minimizaing z; resultsmt(m,t, "PM") = PM.L(t); resultsm(m, "z") = Z.L; ); display resultsm, resultsmt;
Renger
Sorry to bother you again. Here, I have added set and constraint (i just add the original one since i don't know how to modify it) that make me trouble. Kindly give me some idea to overcome this model !!!
Thanks.
Code: Select all
set t /1*5/
m /1*3/
alias(m,n);
set conex(m,n) /1.2,1.3,2.3/;
conex(m,n)$(conex(n,m))=1;
;
parameter a(m) /1 2,2 3/;
parameter b(m) /1 5,2 4.5/;
variables Pm(t),z, Pl(t);
parameter am, bm, resultsm, resultsmt;
equation o1, c1, c2, c3, c4;
o1.. z =e= am*sum(t,Pm(t))+ sum((n,t)$conex(m,n),Pl(m,n,t));
c1(t).. Pm(t) =l= 5;
c2(t).. Pm(t) =g= 0;
c3(n,t).. Pl(m,n,t) =l= 2.5;
c4(n,t).. Pl(m,n,t) =g= 0.5;
model gg /all/;
loop(m,
am = a(m);
bm = b(m);
solve gg using lp minimizaing z;
resultsmt(m,t, "PM") = PM.L(t);
resultsm(m, "z") = Z.L;
);
display resultsm, resultsmt;