Hi Jody

Gams will use the solution from the last solve. You can see this for your self in the following example:

positive variable X, Y;

variable util;

equation utility, budget;

parameter income /100/;

utility…

util =E= X**0.2 * Y**0.8;

budget…

income =E= X + Y;

model micro /all/;

solve micro maximizing util using nlp;

income = 120;

micro.iterlim = 0;

solve micro maximizing util using nlp;

If you go to theequation listing in the lst-file, you will find for the first solve

Equation Listing SOLVE micro Using NLP From line 18

---- utility =E=

utility… (0)*X + (0)*Y + util =E= 0 ; (LHS = 0)

---- budget =E=

budget… - X - Y =E= -100 ; (LHS = 0, INFES = 100 ****)

---- X

X

(.LO, .L, .UP, .M = 0, 0, +INF, 0)

(0) utility

-1 budget

---- Y

Y

(.LO, .L, .UP, .M = 0, 0, +INF, 0)

(0) utility

-1 budget

Gams puts the initial values in the (linearized) equations: As I didnâ€™t give any values, Gams assumes 0.

For the second solve, the equations listing gives you the following and you can see that Gams uses the solve values of the last solve (I set the iteration limit to 0, which is in fact not necessary as Gams evaluates the starting point in the equations listing).

---- utility =E=

utility… - (0.606286626604091)*X - (0.606286626604176)*Y + util =E= 0 ; (LHS = 0)

---- budget =E=

budget… - X - Y =E= -120 ; (LHS = -99.9999999999999, INFES = 20.0000000000001 ****)

GAMS 24.6.0 r55587 BETA Released 24Dec15 WEX-WEI x86 64bit/MS Windows 01/20/16 09:36:03 Page 7

G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m

Column Listing SOLVE micro Using NLP From line 25

---- X

X

(.LO, .L, .UP, .M = 0, 20.0000000000022, +INF, 0)

(-0.6063) utility

-1 budget

---- Y

Y

(.LO, .L, .UP, .M = 0, 79.9999999999977, +INF, EPS)

(-0.6063) utility

-1 budget

Hope this helps

Cheers

Renger

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Jody D

Sent: Dienstag, 19. Januar 2016 18:48

To: gamsworld

Subject: Initial values for solves within a loop.

Hi folks,

I have a question regarding initial values for problem variables when the solve statement is within a loop.

My model is a MIP model and it is likely that the solution from the first iteration of the loop will be a feasible solution for the second iteration and a good starting point.

I know that I can specify the initial value for a variable using the .l subscript. But since at the end of a loop, the variables have values already, will GAMS automatically use these as a starting point for the next solve?

Or, do I need to do something like the following? It seems like I would be just setting the variables to values they already have?

While( counter lt 10,

v_variable.l=p_initial_value;

solve model using MIP minimizing v_obj;

p_initial_value = v_variable.l;

counter++

## );

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at https://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.

–

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at https://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.