Rerun the same model with updated constraint

Problems with syntax of GAMS
Post Reply
A7mj
User
User
Posts: 2
Joined: 4 years ago

Rerun the same model with updated constraint

Post by A7mj »

Hi,

I'm trying to run the same model again with updated constraint limits, the update will be an average of a calculated variable from the first run. What I am doing now is running the model, analyze the result, average the variable of interest, update the limits manually and rerun the model. Is there a way to do this with loop function?

Thanks,
Ahmed
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Rerun the same model with updated constraint

Post by Renger »

Hi

You could do something like this:

Code: Select all


parameter limit 'Updated limit of constraint x' /2/;

equations
   constraintx,
   constrainty(i);
   
constraintx..
      X =G= limit
 
constraintsy(i)..
      Y(i) =E= ...

set loopnr /1*3/;
loop(loopnr,
    solve mymodel;
    limit = sum(i, Y.L(i))/ card(i);
);
 
I hope this helps
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply