GDXRW squeezing zeros from parameters (but not variables)

Hi all,

Having trouble writing zeros in a parameter to a spreadsheet (I am using squeeze, but still have the problem. With variables it is ok. For example, in the following code the output of the parameter squeezes the zero, but the output of the variable doesn’t. Any ideas?



set fruits /apples, oranges/;
parameter price(fruits) /
apples 5
oranges 10
/;

parameter quantity_fruits(fruits);

variable quantity(fruits), cost;
integer variable quantity

equations
cost_eq
quantity_eq;

cost_eq… cost =e= sum(fruits, quantity(fruits)*price(fruits));
quantity_eq… sum(fruits, quantity(fruits)) =g= 2;

model purchase fruits /all/;

solve purchase using Mip minimizing cost;

quantity_fruits(fruits) = quantity.l(fruits);

execute_unload ‘output’, quantity, quantity_fruits;
execute ‘xlstalk.exe -S output.xlsx’

execute ‘gdxxrw output.gdx squeeze=n par=quantity_fruits rng=Sheet1!A2 cdim=0 o=output.xlsx’
execute ‘gdxxrw output.gdx squeeze=n var=quantity rng=Sheet1!D2 cdim=0 o=output.xlsx’

execute ‘xlstalk.exe -O output.xlsx’


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.

Hi Dan



From the guidelines:

… search the GAMS-List (http://www.listserv.dfn.de/cgi-bin/wa?S1=gams-l).
… search this group.

If I search for “zero” I find that this question has been answered at least two times in both mailing lists.

The gdxutils document also explains, when zeros are written.

Cheers



Renger





From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Dan Marshman
Sent: Montag, 31. März 2014 06:49
To: gamsworld@googlegroups.com
Subject: GDXRW squeezing zeros from parameters (but not variables)



Hi all,

Having trouble writing zeros in a parameter to a spreadsheet (I am using squeeze, but still have the problem. With variables it is ok. For example, in the following code the output of the parameter squeezes the zero, but the output of the variable doesn’t. Any ideas?


set fruits /apples, oranges/;
parameter price(fruits) /
apples 5
oranges 10
/;

parameter quantity_fruits(fruits);

variable quantity(fruits), cost;
integer variable quantity

equations
cost_eq
quantity_eq;

cost_eq… cost =e= sum(fruits, quantity(fruits)*price(fruits));
quantity_eq… sum(fruits, quantity(fruits)) =g= 2;

model purchase fruits /all/;

solve purchase using Mip minimizing cost;

quantity_fruits(fruits) = quantity.l(fruits);

execute_unload ‘output’, quantity, quantity_fruits;
execute ‘xlstalk.exe -S output.xlsx’

execute ‘gdxxrw output.gdx squeeze=n par=quantity_fruits rng=Sheet1!A2 cdim=0 o=output.xlsx’
execute ‘gdxxrw output.gdx squeeze=n var=quantity rng=Sheet1!D2 cdim=0 o=output.xlsx’

execute ‘xlstalk.exe -O output.xlsx’


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.


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.