Reply-to: gamsworld@googlegroups.com

Nazmi,

I moved the objective equation (mobj) and variable (maso) from stage 1 to stage 2 (in the EMP info file). You can also leave it out from the stage assignment and then GAMS does this for you. After this change everything works, but your stochastic solution is the same as the EV solution, so no advantage using SP:

---- 171 PARAMETER rep solution metric report

here-and-now 892783.582

Expected Value of EV solution 892783.582

wait-and-see 892783.582

Expected Value of Perfect Information (EVPI) 2.32831E-10

Value of Stochastic Solution (VSS) -2.3283E-10

Hope this helps,

Michael

On Saturday, February 20, 2016 at 7:27:35 AM UTC-5, Nazmi wrote:

Michael,

I am grateful for your helps. I have another error(I hope it is last error). I have tried to solve since thursday but i have not improve a solution. I want to calculate Value of Stochastic Solution and Expected Value of Perfect Information. I examined airsp3.gms example in library and i added codes like in that code. It gives scenario is empty mistake. How can i solve it?

Thank you very much,

Nazmi

Date: Wed, 17 Feb 2016 23:31:14 -0500

Subject: Re: Help Please!

From: mbussieck@gams.com

To: gamsworld@googlegroups.com

Nazmi,

You just do not reference mh(1,6) referenced anywhere in the model equations. The only mh pairs GAMS sees in the model are:

mh(1,2)

mh(1,3)

mh(1,4)

mh(1,5)

mh(2,1)

mh(2,3)

mh(2,4)

mh(2,5)

mh(3,1)

mh(3,2)

mh(3,4)

mh(3,5)

mh(4,1)

mh(4,2)

mh(4,3)

mh(4,5)

mh(5,1)

mh(5,2)

mh(5,3)

mh(5,4)

Even though you have in equation sobj "sum((i,j)$(not sameas(i,j)),mh(i,j)*expr)" and should have all 81*80 mh pairs, for many i,j expr is zero and therefore GAMS squeezes these variables out of the model. Hence EMP is confused since you tell it that mh(1,6) is a RV of the model which it is not because it has been squeezed out. You can get around the squeezing by adding an EPS to the expr term as done here:

sobj… r=e=sum((i,j)(not sameas(i,j)),mh(i,j)*(sum((m,k)(not sameas(k,m)),c(i,k,m,j)*v(i,k,m,j)*z(i,k,m,j))+eps));

I do not recommend this because you artificially increase the model size. I would just find out for which i,j the expr is 0. I have done this in the following code:

file emp / ‘%emp.info%’ /

put emp ‘* problem %gams.i%’

/‘stage 2 r z mh sobj enseq greq loeq maso mobj’

/‘stage 1 x bcons’ ;

put / 'jrandvar ’

set ij(i,j);

ij(i,j) = sum((m,k)(not sameas(k,m)),c(i,k,m,j)*v(i,k,m,j))0;
display ij;
loop(ij(i,j)(not sameas(i,j)), put mh.tn(i,j) );

loop(s,

put /prob(s); loop(ij(i,j)$(not sameas(i,j)), put h(i,j,s); ); );

putclose emp;

I have attached the updated model. Now EMP accepts the model, but Cplex declares it infeasible. That’s something you need to look at.

Michael

On Wed, Feb 17, 2016 at 5:12 AM, Nazmi Åžener wrote:

Michael,

I am thankful for your quick response. I solved my problem but I have another mistake (during excel integration) which i can not handle. If it is possible, please can you tell me where is the problem. I display mh parameter and GAMS display mh(1,6) value but in the solving comment, mh(1,6) parameter is not founded.

Thank you very much,

Best,

Nazmi

Date: Sun, 7 Feb 2016 23:48:01 -0800

From: mbussieck@gams.com

To: gamsworld@googlegroups.com

Subject: Re: Help Please!

Nazmi,

You provide random variable m(i,j) that do not make it into the model. For example m(‘1’,‘1’). This one is squeezed out because of the sparsity of parameter c and v (the i=1, j=1 entries are 0). I would make a subset of relevant (i,j) and only write the random variables of these relevant pairs. From a quick look at the Column Listing (turn on with option limcol=1000;) ones sees that just the diagonal (i,i) is missing from the model, so you can adjust the loop that writes out the ij pair. There were lots of other mistakes in the model. You probably wanted to mh as a joint random variable, at least the attempt of writing this out in the EMP info file looked like it (if these are independent RV, the tree will be too large anyway, 3.2e6 nodes!). Also EV is the default of EMP-SP, you do not need to make an extra variable r and connect r and EV_r. I have attached the adjusted model. Not sure if that what you needed, but it should get you a step closer.

Best,

Michael Bussieck - GAMSWorld Coordinator

On Sunday, February 7, 2016 at 2:38:35 PM UTC-5, Nazmi wrote:

Dear Gamsworld Members,

I wrote a two stage stochastic programming model but GAMS gives a different mistake which i can’t handle it. If you have an idea about this mistake please return me as soon as possible. Code is in the attachment. Error is defined below.

Thanks in advance,

Nazmi

## Error:

*** emp.info line 5: Cannot find random parameter mh(1,1)

*** Error processing empinfo file

*** Problem in getObjects

*** Failure calling solver: DE (rc=1)

\

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.

Michael R. Bussieck, Ph.D.

Fon/Fax: +1 202 342-0180/1 (USA) +49 221 949-9170/1 (Germany)

www.gams.com

–

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.