GDXXRW Error from xls to gdx

Archive of Gamsworld Google Group
Post Reply
Archiver
User
User
Posts: 7876
Joined: 7 years ago

GDXXRW Error from xls to gdx

Post by Archiver »


Hi!

It should be some naive error, but after struggling myself for a whole
day, I haven't been able to find it. It used to work but it does not
work anymore.

I have been learning to include data from excel to gams using GDXXRW.
I am trying to move data from xls to gdx. Afterwards, in another step
to move them from gdx to GAMS since the real dataset is huge (this one
is for trials). I have experimented that GAMS reads data quicker from
gdx than from excel directly (using $LIBINCLUDE xlimport). I suspect
that my pc can get struck solving the optimization model because of
the size of the dataset and model design, then I am trying to it
'lighter'.

Here is the code:
============
Sets i units / Depot001*Depot256 /
is(i) selected unit
j inputs and outputs / stock, wages, issues, receipts,
reqs /
ji(j) inputs / stock,
wages /
jo(j) outputs / issues, receipts,
reqs /;

Parameter data(i,j);

execute 'GDXXRW Book1.xls par=data rng=a1:f257 Cdim=1 Rdim=1'

$GDXIN Book1.gdx
$LOAD data=data
$GDXIN
============

At '$LOAD data=data' I get an erorr saying that Book1.gdx is not
found. I have check that GDXXRW has not created the file. Why?

Thank you VERY MUCH in advance.

Best,

Antonio

PS: Book1.xls looks like:
stock wages issues receipts reqs
Depot001 5 4 6 7 8
...
Depot256 1 2 3 4 5


Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: GDXXRW Error from xls to gdx

Post by Archiver »


Antonio.

You run the gdxxrw utility at runtime and you try to import data at
compile time. Since data is a parameter, it does not matter when you
import. Try this:

Parameter data(i,j);

$call GDXXRW Book1.xls par=data rng=a1:f257 Cdim=1 Rdim=1

$GDXIN Book1.gdx
$LOAD data=data
$GDXIN

Hope this helps,
Michael Bussieck - GAMSWorld Coordinator

On Mar 27, 3:16 pm, Antonio wrote:
> > Hi!
> >
> > It should be some naive error, but after struggling myself for a whole
> > day, I haven't been able to find it. It used to work but it does not
> > work anymore.
> >
> > I have been learning to include data from excel to gams using GDXXRW.
> > I am trying to move data from xls to gdx. Afterwards, in another step
> > to move them from gdx to GAMS since the real dataset is huge (this one
> > is for trials). I have experimented that GAMS reads data quicker from
> > gdx than from excel directly (using $LIBINCLUDE xlimport). I suspect
> > that my pc can get struck solving the optimization model because of
> > the size of the dataset and model design, then I am trying to it
> > 'lighter'.
> >
> > Here is the code:
> > ============
> > Sets i units / Depot001*Depot256 /
> > is(i) selected unit
> > j inputs and outputs / stock, wages, issues, receipts,
> > reqs /
> > ji(j) inputs / stock,
> > wages /
> > jo(j) outputs / issues, receipts,
> > reqs /;
> >
> > Parameter data(i,j);
> >
> > execute 'GDXXRW Book1.xls par=data rng=a1:f257 Cdim=1 Rdim=1'
> >
> > $GDXIN Book1.gdx
> > $LOAD data=data
> > $GDXIN
> > ============
> >
> > At '$LOAD data=data' I get an erorr saying that Book1.gdx is not
> > found. I have check that GDXXRW has not created the file. Why?
> >
> > Thank you VERY MUCH in advance.
> >
> > Best,
> >
> > Antonio
> >
> > PS: Book1.xls looks like:
> > stock wages issues receipts reqs
> > Depot001 5 4 6 7 8
> > ...
> > Depot256 1 2 3 4 5


Post Reply