Dear GAMS users,

I have implemented a model with one loop in GAMS that works very well. Now, I would like to use this model in a sensitivity analysis framework and for this I need to include another loop in the model: loop j, please see the simplified version of the model below. The loop j includes the loop dd. At the beginning we enter loop j (j=1, d=1) and solve problem1 with default initial values. Next, we enter loop dd (j=1, dd=2) and solve problem1 with X(‘1’) and Y(‘1’) fixed based on values init_x and init_y derived from the previous solution. The problem occurs when j=2 and d=1: the problem1 is solved using the fixed values X(‘1’) and Y(‘1’) that are taken from the solution of problem1 in dd loop (j=1, dd=365) . Then I get an infeasible solution since the Constraint1(‘1’) is not satisfied (X(‘1’)+Y(‘1’) is not equal to A(‘2’,‘1’,‘1’)).

Is there a possibility to unfix the variables X and Y when j increases by 1?

I mean, how to remove the fixation of X(‘1’) and Y(‘1’) obtained in the dd loop with dd=365?

So that, when j increases by 1 and d=1, problem1 can be solved without any fixation (X and Y are free just like at the beginning when j=1 and d=1).

I would be very thankful for any help on this issue.

Thank you,

Best regards,

Alicja,

PhD candidate

TU Delft

Simplified model with two loops (one loop inside another loop):

Sets

j /1*100/
d /1*365/

dd /2

*365/*

h /136/

h /1

Parameters

init_x

init_y

a

b

A(j,d,h)

Variables

Y(h)

X(h)

TotalCost

Equations

Constraint1(h);

LeastCost;

Constraint1(h)…X(h)+Y(h)=e=A(j,d,h);

LeastCost… TotalCost=e=a*sum(h,X(h))+b*sum(h,Y(h))

Model problem1 /all/;

loop(j,

d=1;

Solve problem1;

init_x=X.l(‘25’);

init_y=Y.l(‘25’);

loop(dd,

X.fx(‘1’)=init_x;

Y.fx(‘1’)=init_y;

Solve problem1

init_x=X.l(‘25’);

init_y=Y.l(‘25’);

);

## );

\

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 http://groups.google.com/group/gamsworld.

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