solve problem

Problems with syntax of GAMS
Post Reply
LiangYu
User
User
Posts: 14
Joined: 2 months ago

solve problem

Post by LiangYu » 1 month ago

Dear all.
Here is my code
Untitled_5.gms
(5.76 KiB) Downloaded 3 times

Code: Select all

model exchanger1 /eq_r,eq_p,eq_nsmin1,eq_tlm1,eq_ft1,eq_ns1,eq_p121,eq_a1,eq_c1/;
model exchanger2 /eq_r,eq_p,eq_nsmin2,eq_tlm2,eq_ft2,eq_ns2,eq_p122,eq_a2,eq_c2/;

option optcr=0;

if (r.l = 1,
solve exchanger2 using minlp minimizing c2;
else
    if (r.l <> 1,
solve exchanger1 using minlp minimizing c1;
);
);
In this case. Suppose I enter a set of parameters. If exchanger2 is feasible, then I want to stop exchanger1 to execute solve.
How can I typing stop execute solve code? (As long as the error of dividing by 0 occurs, stop executing solve the exchanger1)

In addition, model exchanger1 is to execute solve when r.l is not equal to 1, and model exchanger 2 is r.l equal to 1 to execute.
Where r is a variable.

Best regards,
Thank you.

Post Reply