infeasible result

questions about GAMS' tools
Post Reply
bahaa
User
User
Posts: 3
Joined: 4 years ago

infeasible result

Post by bahaa »

SBR-project.rar
(19.18 KiB) Downloaded 303 times
Hello, I wrote this code a while ago and it used to give me a solution. Now i downloaded the new gams 30 and it it started giving me infeasible result with the same parameters used in excel
I also had a problem viewing the parameters and the results in the GDX file.

set t /t1,t2,t3,t4,t5,t6/, i /i1,i2,i3/;



parameter lls(t,i);

$call GDXXRW SBR-project.xlsx trace=3 par=lls rng=Sheet1!b1:e7 rdim=1 cdim=1
$GDXIN SBR-project.gdx
$LOAD lls
$GDXIN

parameter rls(t,i);

$call GDXXRW SBR-project.xlsx trace=3 par=rls rng=Sheet1!h1:k7 rdim=1 cdim=1
$GDXIN SBR-project.gdx
$LOAD rls
$GDXIN
parameter L(t,i);

$call GDXXRW SBR-project.xlsx trace=3 par=L rng=Sheet1!c17:f23 rdim=1 cdim=1
$GDXIN SBR-project.gdx
$LOAD L
$GDXIN
parameter liso(t);

$call GDXXRW SBR-project.xlsx trace=3 par=liso rng=Sheet1!b10:c15 rdim=1
$GDXIN SBR-project.gdx
$LOAD liso
parameter bid(t);

$call GDXXRW SBR-project.xlsx trace=3 par=bid rng=Sheet1!e10:f15 rdim=1
$GDXIN SBR-project.gdx
$LOAD bid
$GDXIN

parameter lvpp(t);

$call GDXXRW SBR-project.xlsx trace=3 par=lvpp rng=Sheet1!h10:i15 rdim=1
$GDXIN SBR-project.gdx
$LOAD lvpp
$GDXIN

parameter tt(t);

$call GDXXRW SBR-project.xlsx trace=3 par=tt rng=Sheet1!c25:d30 rdim=1
$GDXIN SBR-project.gdx
$LOAD tt
$GDXIN

parameter S(t);

$call GDXXRW SBR-project.xlsx trace=3 par=S rng=Sheet1!n2:o7 rdim=1
$GDXIN SBR-project.gdx
$LOAD S
$GDXIN

variables E(t), D(t), G(t),rls2(t), of;

binary variables y(t), x(t), yls(t,i),ylr(t,i);
alias(i,ii);
alias(t,ttt)
equations eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9, eq10, Objective;


Objective(t,i) .. sum((ttt),liso(ttt)* bid(ttt)- sum((ii), yls(ttt,ii)*lls(ttt,ii)*rls(ttt,ii))+lvpp(t)*D(ttt)-E(ttt)- (y(ttt)*555))=e=of;
eq1(t).. G(t)=e=D(t)+bid(t)-S(t)-6;
eq2(t).. G(t)=g=0;
eq3(t).. G(t)=l= x(t)*6;
eq4 (t).. G(t+1)=g= -tt(t) +G(t);
eq5 (t).. G(t+1)=l= tt(t) +G(t);
eq6 (t).. y(t)=e= max(0,(x(t)-x(t-1)));
eq7 (t).. E(t)=e= 120+10*G(t)+0.09*G(t)*G(t);
eq8 (t,i).. rls2(t)=e=sum((ii),yls(t,ii)*rls(t,ii));
eq9 (t,i).. yls(t,i)=e=ylr(t,i);
eq10 (t,i).. D(t)=e=sum((ii),L(t,ii))-rls2(t);
G.lo(t)=0;
G.up(t) =6;

Model demandbid /all/
Solve demandbid us MINLP maximizing of;
display of.l, G.l, D.l;
Last edited by bahaa 3 years ago, edited 1 time in total.
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: infeasible result

Post by bussieck »

Without the data there is little help. Try a global solver for non-convex problems when you pay no attention to a starting point.

-Michael
bahaa
User
User
Posts: 3
Joined: 4 years ago

Re: infeasible result

Post by bahaa »

Thank you for your reply.
I've attached the zip file of the code and the data.
Can you please suggest a global solver that I can use that may solve the issue.

-Bahaa
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: infeasible result

Post by bussieck »

Even if you remove constraints e6 and e7 (now the model becomes linear and can be solved as a MIP) the model is infeasible. So your claim that you got a solution (for this data) can't be true. Moreover, you only have max and sqr(G(t)) in your model. Due to your direction of your objective you can change =e= to =g= in eq7 and this makes this a convex quadratic constraint (and you can solve directly with e.g. Cplex). Same holds for the constraint with max. Just replace e6 by y(t) =g= x(t)-x(t-1).

Now you have a convex model and if now a solver says infeasible that you can trust this and work on getting rid of your infeasibility. I have used Cplex' feasopt (see https://www.gams.com/latest/docs/S_CPLE ... RELAXATION) but on needs model/application knowledge to use this info.

I have attached the modified GAMS model. BTW, I replaced the gdxxrw commands, so this gets only called if the Excel file has changed. Moreover, you might want to use gdxxrw multi-symbol processing to just a do a single gdxxrw call (see https://www.gams.com/latest/docs/T_GDXX ... HEET_INDEX).

-Michael
SBR-project.gms
(2.54 KiB) Downloaded 288 times
bahaa
User
User
Posts: 3
Joined: 4 years ago

Re: infeasible result

Post by bahaa »

Thank you for your help and reply, which was really helpful.
in the attached file, I am trying to extend the time over 24 hours period rather than 6 hrs, and there was a problem with the OF result where it is a negative result. I was also not able to view the gdx of all parameters combined.
thanks in advance.

Bahaa
renproject.rar
(31.59 KiB) Downloaded 295 times
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: infeasible result

Post by bussieck »

Not sure what you mean. The OF is negative okay, but you have plenty of negative terms in the objective. Remember, this is the objective of a feasible relaxation! feasOptMode=3 (https://www.gams.com/latest/docs/S_CPLE ... easoptmode) combines relaxtion and optimization: Minimize the number of constraints and bounds requiring relaxation in first phase and execute second phase to find optimum among minimal relaxations.

Also not sure what you mean with I was also not able to view the gdx of all parameters combined. . If I run the with F10 in Studio I get a good GDX file file all the results. Not sure how you try to create the GDX file.

-Michael
Post Reply