GAMS Loops ends early Topic is solved

Problems with modeling
Post Reply
diabolik
User
User
Posts: 14
Joined: 1 year ago

GAMS Loops ends early

Post by diabolik »

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?

Code: Select all

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;
);
Fred
Posts: 373
Joined: 7 years ago

Re: GAMS Loops ends early

Post by Fred »

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
Post Reply