Providing initial solution and reoptimizing

Problems with syntax of GAMS
Post Reply
Nikou
User
User
Posts: 33
Joined: 4 years ago

Providing initial solution and reoptimizing

Post by Nikou »

Hello All

I have a MILP model consisting of say 2 constraints, Eq1(X,Y), Eq2(X,Y) and the objective function Z (X,Y)

I use the Statement

MODEL MyModel /ALL/;
SOLVE MyModel USING MILP MAXIMIZING Z ;

and get the results X*, Y*

Now I would like to drop Eq2 from the model and resolve using X*,Y* as a starting solution to the reduced Model .

Is there a way to pass the values X*,Y* directly to the new model ( e.g. without having to save first them on new variables?)
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Providing initial solution and reoptimizing

Post by Renger »

Hi Nikou

You could do this as follows:

Code: Select all

MODEL MyModel /ALL/;
SOLVE MyModel USING MILP MAXIMIZING Z ;

model MyModel2 /... all equations without eq2/;
SOLVE MyModel2 USING MILP MAXIMIZING Z ;
Gams will automatically use the solution from your first solve for the next solve.

Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Nikou
User
User
Posts: 33
Joined: 4 years ago

Re: Providing initial solution and reoptimizing

Post by Nikou »

Thank you very much!

I suppose it will work the same way, if I drop some prefixed values.

I mean,

Eq1..
Eq2..

X.FX = a ;

Model MyModel1 /All/ ;
Solve MyModel1 using milp maximizing z;

X.LO = lb ;
X.UP = ub;

Model MyModel2 /All/
Solve MyModel2 using milp maximizing z;
Fred
Posts: 373
Joined: 7 years ago

Re: Providing initial solution and reoptimizing

Post by Fred »

Nikou,

Dropping fixed values for variables works as you describe it (reste lower/uooer bound).

For MIP solvers, to use a starting point, usually you have to set a corresponding solver option, see e.g. https://www.gams.com/latest/docs/S_CPLE ... EXmipstart

I hope this helps!

Fred
Post Reply