Page 1 of 1

Problem with loop

Posted: Sat Jun 20, 2020 4:11 am
by Bingo LI
Dear All,
I am solving a problem with GAMS 24.4/cplex. There are two Loop in my model, and they have to exist in my model. In addition, the function of “break” or “continue” is infeasible.
I want to terminate the inner LOOP "t", and start a new outer LOOP "k" when some condition is met, such as " b(k,t)>5". However, the result is wrong when I terminate the inner LOOP. Could you please help in obtaining the right results?
Thank you.

20200620100548.png
20200620100548.png (8.51 KiB) Viewed 6493 times

Re: Problem with loop

Posted: Mon Jun 22, 2020 3:58 pm
by dirkse
Bingo,

You mention CPLEX, but your GAMS code doesn't contain any models or solves. You mention the "break" and "continue" statements, but you don't use those in your GAMS code. So I'm confused as to whether these things are relevant to your question or not.

In the code you sent, you don't reset the condition for the inner loop prior to entering the inner loop. You have to set converge_ini to 0 inside the outer loop prior to entering the inner loop. Then the computation does something reasonable.

You can do this more easily using a break statement. I included this variant in the example attached.
Steve.gms
(981 Bytes) Downloaded 218 times
It worked fine for me with GAMS 30.3.

-Steve

Re: Problem with loop

Posted: Tue Jun 23, 2020 4:03 pm
by Bingo LI
Thank you for your answer.
The problem is solved by setting converge_ini to 0.
The function of “break” or “continue” is not contained in GAMS 24.4.
Again, thank you.

Li