define new equation in each loop iteration

Problems with modeling
Post Reply
Sajjad.gh
User
User
Posts: 2
Joined: 7 months ago

define new equation in each loop iteration

Post by Sajjad.gh »

Hi
I have a model that should add new constrain to last constrains in each loop iteration. also the number of loop iterations is unknown so it's a while loop. how can i handle it in GAMS?
User avatar
bussieck
Moderator
Moderator
Posts: 1043
Joined: 7 years ago

Re: define new equation in each loop iteration

Post by bussieck »

Look at a TSP example (https://www.gams.com/latest/gamslib_ml/ ... _tsp1.html) in the GAMS model library where a sub-tour elimination constraint gets added in every iteration. You will need to overestimate the number of iterations (cc) and use a loop though. Good luck.

-Michael
Sajjad.gh
User
User
Posts: 2
Joined: 7 months ago

Re: define new equation in each loop iteration

Post by Sajjad.gh »

bussieck wrote: 7 months ago Look at a TSP example (https://www.gams.com/latest/gamslib_ml/ ... _tsp1.html) in the GAMS model library where a sub-tour elimination constraint gets added in every iteration. You will need to overestimate the number of iterations (cc) and use a loop though. Good luck.

-Michael
This code was a little complicated.Could you describe the solution in simple way?? Thanks
Last edited by Sajjad.gh 7 months ago, edited 1 time in total.
User avatar
bussieck
Moderator
Moderator
Posts: 1043
Joined: 7 years ago

Re: define new equation in each loop iteration

Post by bussieck »

There is a somewhat simpler example: cta (https://www.gams.com/latest/gamslib_ml/ ... b_cta.html) which essentially cuts away the optimal solution a couple of time to get suboptimal solutions. -Michael
Post Reply