GAMS Loops ends early

Hello everyone,

I am trying a loop, however it keeps ending without satisfying the condition abs(UB/LB) > BdTol. I want algorithm to stop when UB=LB, however it always ends priorly. Do you see anything wrong with the code?

loop(iter$(abs(UB/LB) > BdTol),
         solve subproblem maximizing z using lp;
         abort$(subproblem.modelstat>=2) "Subproblem not solved to optimality";
         UB = sum((i,j),a(i,j)*x.l(i,j))-q.l;
         cutset(iter) = yes;
         cutcoeff(iter,i,j) = var(i,j)*u.l(j);
         display u.l;
         option optcr=0, optca=0;
         solve master maximizing z0 using mip;
         abort$(master.modelstat>=2) "Masterproblem not solved to optimality";
         LB = sum((i,j),a(i,j)*x.l(i,j))-z.l;
         display x.l,y.l,z0.l,UB,LB;
);

Hi,

hard to help without beiong able to reproduce. You loop over a set iter. So the loop will terminate after card(iter) iterations, no matter whether your termination criterion abs(UB/LB) <= BdTol is met.

I hope this helps!

Fred