Importing Data from Text file

In my program, I faced with error number 140 and I don’t know how I could fix it. I want to have a program which read a table from a text file. For that I used following codes:


Sets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

$Include C:\Users\Golnaz\Desktop\table1.txt




parameter slice(j) slice of data
eff_k(i) efficiency report;

Positive Variables v(ji) input weights
u(jo) output weights;


but it doesn’t work. Please help me how can I fix this error and what makes this error?



Thanks!


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/groups/opt_out.

Hi Goliii

Should we guess what is in the text file or might it be useful to send this information with your question…?

Cheers

Renger



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of goliii
Sent: Montag, 25. November 2013 17:30
To: gamsworld@googlegroups.com
Subject: Importing Data from Text file



In my program, I faced with error number 140 and I don’t know how I could fix it. I want to have a program which read a table from a text file. For that I used following codes:


Sets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

$Include C:\Users\Golnaz\Desktop\table1.txt




parameter slice(j) slice of data
eff_k(i) efficiency report;

Positive Variables v(ji) input weights
u(jo) output weights;


but it doesn’t work. Please help me how can I fix this error and what makes this error?



Thanks!


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/groups/opt_out.


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/groups/opt_out.

Hi Renger,

thank you very much!

here find attached my text file.

Thanks!


table1.txt (1.89 KB)

Hi



You only have to tell Gams that what is coming is a table (it can’t guess that this text is a table) before you include the file (don’t forget the semicolon):



table datatable(i,j)

$include table1.txt

;



Cheers

Renger


\


Modelworks

Gewerbestrasse 15

3600 Thun – Switzerland

+41 79 818 53 73

Info@modelworks.ch

blog.modelworks.ch







From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of goliii
Sent: Montag, 25. November 2013 18:05
To: gamsworld@googlegroups.com
Subject: Re: Importing Data from Text file




Hi Renger,

thank you very much!

here find attached my text file.

Thanks!


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/groups/opt_out.


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/groups/opt_out.

Hi Renger

Thanks a lot for your help!


sincerely






On Monday, November 25, 2013 7:21:34 PM UTC+1, Renger van Nieuwkoop wrote:

Hi



You only have to tell Gams that what is coming is a table (it can’t guess that this text is a table) before you include the file (don’t forget the semicolon):



table datatable(i,j)

$include table1.txt

;



Cheers

Renger


\


Modelworks

Gewerbestrasse 15

3600 Thun – Switzerland

+41 79 818 53 73

In…@modelworks.ch

blog.modelworks.ch







From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of goliii
Sent: Montag, 25. November 2013 18:05
To: gams...@googlegroups.com
Subject: Re: Importing Data from Text file




Hi Renger,

thank you very much!

here find attached my text file.

Thanks!


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


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/groups/opt_out.

Hi Renger,


now I want to import data from an Excel file and I used following code:


ets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

table data(i,j)

$Call GDXXRW.exe table1.xls dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1
$GDXIN table1.gdx
$load i ji(j) jo(j)
$GDXIN


parameter slice(j) slice of data
eff_k(i) efficiency report;

Positive Variables v(ji) input weights
u(jo) output weights;

Variable eff efficiency;


but I faced with error number 510 (no such a file!!!):

table data(i,j)
18
**** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
**** Msg : No such file or directory
20 $GDXIN table1.gdx
**** $510
21 $load i ji(j) jo(j)
**** $502
23
24
25 parameter slice(j) slice of data
**** $463
26 eff_k(i) efficiency report;



could you please tell me what’s wrong is with this model ?

I send you my Excel file too.


Thanks.


table1.xlsx (10.3 KB)

Hi Golliii

You use the xls as extension but your file has the extension xlsx, so replace xls by xlsx.

Cheers

Renger

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of goliii
Sent: Dienstag, 26. November 2013 12:42
To: gamsworld@googlegroups.com
Subject: Re: Importing Data from Text file



Hi Renger,


now I want to import data from an Excel file and I used following code:


ets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

table data(i,j)

$Call GDXXRW.exe table1.xls dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1
$GDXIN table1.gdx
$load i ji(j) jo(j)
$GDXIN


parameter slice(j) slice of data
eff_k(i) efficiency report;

Positive Variables v(ji) input weights
u(jo) output weights;

Variable eff efficiency;


but I faced with error number 510 (no such a file!!!):

table data(i,j)
18
**** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
**** Msg : No such file or directory
20 $GDXIN table1.gdx
**** $510
21 $load i ji(j) jo(j)
**** $502
23
24
25 parameter slice(j) slice of data
**** $463
26 eff_k(i) efficiency report;



could you please tell me what’s wrong is with this model ?

I send you my Excel file too.


Thanks.


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/groups/opt_out.


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/groups/opt_out.

Dear Renger,

I changed it to .xlsx, but I faced again with same error!


Sets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

table data(i,j)

$Call GDXXRW.exe table1.xlsx dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1
$GDXIN table1.gdx
$load i ji(j) jo(j)
$GDXIN


parameter slice(j) slice of data
eff_k(i) efficiency report;

Positive Variables v(ji) input weights
u(jo) output weights;

table data(i,j)
18
**** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
**** Msg : No such file or directory
20 $GDXIN table1.gdx
**** $510
21 $load i ji(j) jo(j)
**** $502

Thanks!


On Tuesday, November 26, 2013 1:33:08 PM UTC+1, Renger van Nieuwkoop wrote:

Hi Golliii

You use the xls as extension but your file has the extension xlsx, so replace xls by xlsx.

Cheers

Renger

From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of goliii
Sent: Dienstag, 26. November 2013 12:42
To: gams...@googlegroups.com
Subject: Re: Importing Data from Text file



Hi Renger,


now I want to import data from an Excel file and I used following code:


ets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

table data(i,j)

$Call GDXXRW.exe table1.xls dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1
$GDXIN table1.gdx
$load i ji(j) jo(j)
$GDXIN


parameter slice(j) slice of data
eff_k(i) efficiency report;

Positive Variables v(ji) input weights
u(jo) output weights;

Variable eff efficiency;


but I faced with error number 510 (no such a file!!!):

table data(i,j)
18
**** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
**** Msg : No such file or directory
20 $GDXIN table1.gdx
**** $510
21 $load i ji(j) jo(j)
**** $502
23
24
25 parameter slice(j) slice of data
**** $463
26 eff_k(i) efficiency report;



could you please tell me what’s wrong is with this model ?

I send you my Excel file too.


Thanks.


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/groups/opt_out.


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/groups/opt_out.

Hi Goliii



In order to find the error you can add Trace=3 to the call



$Call GDXXRW.exe table1.xlsx dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1 Trace=3



If you do that, you will see some of the errors in your output window.



Furthermore, you should

· not use ji(j) but just ji (same for jo) in the call,

· not define the sets explicitly if you want to read them from the excel file (so only set i, j, ij(j), jo(j):wink:

· check the ranges for the sets and read all the sets (you forgot j and have some mistakes in the ranges).

Hope this helps



Cheers

Rneger





From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of goliii
Sent: Dienstag, 26. November 2013 13:44
To: gamsworld@googlegroups.com
Subject: Re: Importing Data from Text file



Dear Renger,

I changed it to .xlsx, but I faced again with same error!


Sets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

table data(i,j)

$Call GDXXRW.exe table1.xlsx dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1
$GDXIN table1.gdx
$load i ji(j) jo(j)
$GDXIN


parameter slice(j) slice of data
eff_k(i) efficiency report;

Positive Variables v(ji) input weights
u(jo) output weights;

table data(i,j)
18
**** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
**** Msg : No such file or directory
20 $GDXIN table1.gdx
**** $510
21 $load i ji(j) jo(j)
**** $502

Thanks!


On Tuesday, November 26, 2013 1:33:08 PM UTC+1, Renger van Nieuwkoop wrote:

Hi Golliii

You use the xls as extension but your file has the extension xlsx, so replace xls by xlsx.

Cheers

Renger

From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of goliii
Sent: Dienstag, 26. November 2013 12:42
To: gams...@googlegroups.com
Subject: Re: Importing Data from Text file



Hi Renger,


now I want to import data from an Excel file and I used following code:


ets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

table data(i,j)

$Call GDXXRW.exe table1.xls dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1
$GDXIN table1.gdx
$load i ji(j) jo(j)
$GDXIN


parameter slice(j) slice of data
eff_k(i) efficiency report;

Positive Variables v(ji) input weights
u(jo) output weights;

Variable eff efficiency;


but I faced with error number 510 (no such a file!!!):

table data(i,j)
18
**** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
**** Msg : No such file or directory
20 $GDXIN table1.gdx
**** $510
21 $load i ji(j) jo(j)
**** $502
23
24
25 parameter slice(j) slice of data
**** $463
26 eff_k(i) efficiency report;



could you please tell me what’s wrong is with this model ?

I send you my Excel file too.


Thanks.


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/groups/opt_out.


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/groups/opt_out.


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/groups/opt_out.

Hi Renger,


thank you for your help!

I added Trace=3 to the call and I tried to change the staff which you said but I still have problem. I guess the error caused by "$load slice(j) " but I dont know what could I write instead of it??!!

Sets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);


$Call GDXXRW.exe table1.xlsx set=i rng=a1:a45 cdim=1 set=j rng=b1:d45 rdim=1 Par=slice rng=a1:d45 cdim=1 rdim=1 Trace=3



parameter slice(j) slice of data
eff_k(i) efficiency report;


$GDXIN table1.gdx
$load slice(j)
$GDXIN

Positive Variables v(ji) input weights
u(jo) output weights;

Variable eff efficiency;

Equations defe efficiency defiition - weighed output
denom weighted input
lime(i) ‘output/input < 1’;


Sets
10 i Units /DMU01*DMU44/
11 j inputs and outputs /Budget, Personal,Absolventen /
12 ji(j) inputs /Budget, Personal /
13 jo(j) outputs/ Absolventen /;
14
15 Alias (i,k);
16
17
19
20
21
22 parameter slice(j) slice of data
23 eff_k(i) efficiency report;
24
25
GDXIN C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
— MERGE j = 2:j
27 $load slice(j)
**** $495,496,194,496
29
30 Positive Variables v(ji) input weights
31 u(jo) output weights;
32
33 Variable eff efficiency;

Thanks a lot.






On Tuesday, November 26, 2013 2:15:34 PM UTC+1, Renger van Nieuwkoop wrote:

Hi Goliii



In order to find the error you can add Trace=3 to the call



$Call GDXXRW.exe table1.xlsx dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1 Trace=3



If you do that, you will see some of the errors in your output window.



Furthermore, you should

· not use ji(j) but just ji (same for jo) in the call,

· not define the sets explicitly if you want to read them from the excel file (so only set i, j, ij(j), jo(j):wink:

· check the ranges for the sets and read all the sets (you forgot j and have some mistakes in the ranges).

Hope this helps



Cheers

Rneger





From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of goliii
Sent: Dienstag, 26. November 2013 13:44
To: gams...@googlegroups.com
Subject: Re: Importing Data from Text file



Dear Renger,

I changed it to .xlsx, but I faced again with same error!


Sets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

table data(i,j)

$Call GDXXRW.exe table1.xlsx dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1
$GDXIN table1.gdx
$load i ji(j) jo(j)
$GDXIN


parameter slice(j) slice of data
eff_k(i) efficiency report;

Positive Variables v(ji) input weights
u(jo) output weights;

table data(i,j)
18
**** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
**** Msg : No such file or directory
20 $GDXIN table1.gdx
**** $510
21 $load i ji(j) jo(j)
**** $502

Thanks!


On Tuesday, November 26, 2013 1:33:08 PM UTC+1, Renger van Nieuwkoop wrote:

Hi Golliii

You use the xls as extension but your file has the extension xlsx, so replace xls by xlsx.

Cheers

Renger

From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of goliii
Sent: Dienstag, 26. November 2013 12:42
To: gams...@googlegroups.com
Subject: Re: Importing Data from Text file



Hi Renger,


now I want to import data from an Excel file and I used following code:


ets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

table data(i,j)

$Call GDXXRW.exe table1.xls dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1
$GDXIN table1.gdx
$load i ji(j) jo(j)
$GDXIN


parameter slice(j) slice of data
eff_k(i) efficiency report;

Positive Variables v(ji) input weights
u(jo) output weights;

Variable eff efficiency;


but I faced with error number 510 (no such a file!!!):

table data(i,j)
18
**** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
**** Msg : No such file or directory
20 $GDXIN table1.gdx
**** $510
21 $load i ji(j) jo(j)
**** $502
23
24
25 parameter slice(j) slice of data
**** $463
26 eff_k(i) efficiency report;



could you please tell me what’s wrong is with this model ?

I send you my Excel file too.


Thanks.


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/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


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/groups/opt_out.

Slice instead of slice(j)
Cheers
Renger


sent from my iPad

Am 27.11.2013 um 06:46 schrieb “goliii” :

Hi Renger,

thank you for your help!

I added Trace=3 to the call and I tried to change the staff which you said but I still have problem. I guess the error caused by "$load slice(j) " but I dont know what could I write instead of it??!!

Sets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

$Call GDXXRW.exe table1.xlsx set=i rng=a1:a45 cdim=1 set=j rng=b1:d45 rdim=1 Par=slice rng=a1:d45 cdim=1 rdim=1 Trace=3

parameter slice(j) slice of data
eff_k(i) efficiency report;

$GDXIN table1.gdx
$load slice(j)
$GDXIN

Positive Variables v(ji) input weights
u(jo) output weights;

Variable eff efficiency;

Equations defe efficiency defiition - weighed output
denom weighted input
lime(i) 'output/input

Sets
10 i Units /DMU01*DMU44/
11 j inputs and outputs /Budget, Personal,Absolventen /
12 ji(j) inputs /Budget, Personal /
13 jo(j) outputs/ Absolventen /;
14
15 Alias (i,k);
16
17
19
20
21
22 parameter slice(j) slice of data
23 eff_k(i) efficiency report;
24
25
GDXIN C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
— MERGE j = 2:j
27 $load slice(j)
**** $495,496,194,496
29
30 Positive Variables v(ji) input weights
31 u(jo) output weights;
32
33 Variable eff efficiency;

Thanks a lot.

On Tuesday, November 26, 2013 2:15:34 PM UTC+1, Renger van Nieuwkoop wrote:

Hi Goliii



In order to find the  error you can add Trace=3 to the call



$Call GDXXRW.exe table1.xlsx dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1  rdim=1 dset=jo(j) rng=d1:d45 cdim=1 Trace=3



If you do that, you will see some of the errors in your output window.



Furthermore, you should

·         not use ji(j) but just ji (same for jo) in the call,

·         not define the sets explicitly if you want to read them from the excel file (so only set i, j, ij(j), jo(j);)

·         check the ranges for the sets and read all the sets (you forgot j and have some mistakes in the ranges).

Hope this helps



Cheers

Rneger





From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of goliii
Sent: Dienstag, 26. November 2013 13:44
To: gams...@googlegroups.com
Subject: Re: Importing Data from Text file



Dear Renger,

I changed it to .xlsx, but I faced again with same error!


Sets
   i     Units    /DMU01*DMU44/
   j     inputs and outputs  /Budget, Personal,Absolventen /
   ji(j) inputs              /Budget, Personal             /
   jo(j)            outputs/                   Absolventen /;

Alias (i,k);

table  data(i,j)

$Call GDXXRW.exe table1.xlsx dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1  rdim=1 dset=jo(j) rng=d1:d45 cdim=1
$GDXIN table1.gdx
$load  i  ji(j)  jo(j)
$GDXIN


parameter slice(j) slice of data
          eff_k(i) efficiency report;

Positive Variables v(ji) input weights
                   u(jo) output weights;

table  data(i,j)
  18
**** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
**** Msg : No such file or directory
  20  $GDXIN table1.gdx
****                  $510
  21  $load  i  ji(j)  jo(j)
****      $502

 Thanks!


On Tuesday, November 26, 2013 1:33:08 PM UTC+1, Renger van Nieuwkoop wrote:

    Hi Golliii

    You use the xls as extension but your file has the extension xlsx, so replace xls by xlsx.

    Cheers

    Renger

    From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of goliii
    Sent: Dienstag, 26. November 2013 12:42
    To: gams...@googlegroups.com
    Subject: Re: Importing Data from Text file



    Hi Renger,


    now I want to import data from an Excel file and I used following code:


    ets
       i     Units    /DMU01*DMU44/
       j     inputs and outputs  /Budget, Personal,Absolventen /
       ji(j) inputs              /Budget, Personal             /
       jo(j)            outputs/                   Absolventen /;

    Alias (i,k);

    table  data(i,j)

    $Call GDXXRW.exe table1.xls dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1  rdim=1 dset=jo(j) rng=d1:d45 cdim=1
    $GDXIN table1.gdx
    $load  i  ji(j)  jo(j)
    $GDXIN


    parameter slice(j) slice of data
              eff_k(i) efficiency report;

    Positive Variables v(ji) input weights
                       u(jo) output weights;

    Variable eff efficiency;


    but I faced with error number 510 (no such a file!!!):

    table  data(i,j)
      18
    **** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
    **** Msg : No such file or directory
      20  $GDXIN table1.gdx
    ****                  $510
      21  $load  i  ji(j)  jo(j)
    ****      $502
      23
      24
      25  parameter slice(j) slice of data
    ****  $463
      26            eff_k(i) efficiency report;



    could you please tell me what's wrong is with this model ?

    I send you my Excel file too.


    Thanks.

    --
    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/groups/opt_out.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


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/groups/opt_out.


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/groups/opt_out.

Hi Renger,

Thanks but it doesnt work and get same error!

I do not know if there is any influence but I specify A1:d45 but in the error log it mentions b2.:d45 !

Any ideas what could be wrong?

I am attaching the Error Log.

Thank you, Cheers,





On Wednesday, November 27, 2013 6:47:36 AM UTC+1, Renger van Nieuwkoop wrote:

Slice instead of slice(j)
Cheers
Renger


sent from my iPad

Am 27.11.2013 um 06:46 schrieb “goliii” :

Hi Renger,


thank you for your help!

I added Trace=3 to the call and I tried to change the staff which you said but I still have problem. I guess the error caused by "$load slice(j) " but I dont know what could I write instead of it??!!

Sets
   i     Units    /DMU01*DMU44/
   j     inputs and outputs  /Budget, Personal,Absolventen /
   ji(j) inputs              /Budget, Personal             /
   jo(j)            outputs/                   Absolventen /;

Alias (i,k);


$Call GDXXRW.exe table1.xlsx set=i rng=a1:a45 cdim=1 set=j rng=b1:d45 rdim=1 Par=slice rng=a1:d45 cdim=1 rdim=1  Trace=3



parameter slice(j) slice of data
          eff_k(i) efficiency report;


$GDXIN table1.gdx
$load slice(j)
$GDXIN

Positive Variables v(ji) input weights
                   u(jo) output weights;

Variable eff efficiency;

Equations defe    efficiency defiition - weighed output
          denom   weighted input
          lime(i) 'output/input

   Sets
  10     i     Units    /DMU01*DMU44/
  11     j     inputs and outputs  /Budget, Personal,Absolventen /
  12     ji(j) inputs              /Budget, Personal             /
  13     jo(j)            outputs/                   Absolventen /;
  14
  15  Alias (i,k);
  16
  17
  19
  20
  21
  22  parameter slice(j) slice of data
  23            eff_k(i) efficiency report;
  24
  25
GDXIN   C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
--- MERGE j = 2:j
  27  $load slice(j)
****            $495,496,194,496
  29
  30  Positive Variables v(ji) input weights
  31                     u(jo) output weights;
  32
  33  Variable eff efficiency;

Thanks a lot.






On Tuesday, November 26, 2013 2:15:34 PM UTC+1, Renger van Nieuwkoop wrote:

    Hi Goliii



    In order to find the  error you can add Trace=3 to the call



    $Call GDXXRW.exe table1.xlsx dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1  rdim=1 dset=jo(j) rng=d1:d45 cdim=1 Trace=3



    If you do that, you will see some of the errors in your output window.



    Furthermore, you should

    ·         not use ji(j) but just ji (same for jo) in the call,

    ·         not define the sets explicitly if you want to read them from the excel file (so only set i, j, ij(j), jo(j);)

    ·         check the ranges for the sets and read all the sets (you forgot j and have some mistakes in the ranges).

    Hope this helps



    Cheers

    Rneger





    From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of goliii
    Sent: Dienstag, 26. November 2013 13:44
    To: gams...@googlegroups.com
    Subject: Re: Importing Data from Text file



    Dear Renger,

    I changed it to .xlsx, but I faced again with same error!


    Sets
       i     Units    /DMU01*DMU44/
       j     inputs and outputs  /Budget, Personal,Absolventen /
       ji(j) inputs              /Budget, Personal             /
       jo(j)            outputs/                   Absolventen /;

    Alias (i,k);

    table  data(i,j)

    $Call GDXXRW.exe table1.xlsx dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1  rdim=1 dset=jo(j) rng=d1:d45 cdim=1
    $GDXIN table1.gdx
    $load  i  ji(j)  jo(j)
    $GDXIN


    parameter slice(j) slice of data
              eff_k(i) efficiency report;

    Positive Variables v(ji) input weights
                       u(jo) output weights;

    table  data(i,j)
      18
    **** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
    **** Msg : No such file or directory
      20  $GDXIN table1.gdx
    ****                  $510
      21  $load  i  ji(j)  jo(j)
    ****      $502

     Thanks!


    On Tuesday, November 26, 2013 1:33:08 PM UTC+1, Renger van Nieuwkoop wrote:

        Hi Golliii

        You use the xls as extension but your file has the extension xlsx, so replace xls by xlsx.

        Cheers

        Renger

        From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of goliii
        Sent: Dienstag, 26. November 2013 12:42
        To: gams...@googlegroups.com
        Subject: Re: Importing Data from Text file



        Hi Renger,


        now I want to import data from an Excel file and I used following code:


        ets
           i     Units    /DMU01*DMU44/
           j     inputs and outputs  /Budget, Personal,Absolventen /
           ji(j) inputs              /Budget, Personal             /
           jo(j)            outputs/                   Absolventen /;

        Alias (i,k);

        table  data(i,j)

        $Call GDXXRW.exe table1.xls dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1  rdim=1 dset=jo(j) rng=d1:d45 cdim=1
        $GDXIN table1.gdx
        $load  i  ji(j)  jo(j)
        $GDXIN


        parameter slice(j) slice of data
                  eff_k(i) efficiency report;

        Positive Variables v(ji) input weights
                           u(jo) output weights;

        Variable eff efficiency;


        but I faced with error number 510 (no such a file!!!):

        table  data(i,j)
          18
        **** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
        **** Msg : No such file or directory
          20  $GDXIN table1.gdx
        ****                  $510
          21  $load  i  ji(j)  jo(j)
        ****      $502
          23
          24
          25  parameter slice(j) slice of data
        ****  $463
          26            eff_k(i) efficiency report;



        could you please tell me what's wrong is with this model ?

        I send you my Excel file too.


        Thanks.

        --

try3.png

Hi Goliii

You define slice over one set (j), but you gdx command says it is a two-dimensional parameter (cdim=1, rdim=1)

Cheers

Renger



Von: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] Im Auftrag von goliii
Gesendet: Mittwoch, 27. November 2013 12:02
An: gamsworld@googlegroups.com
Betreff: Re: Importing Data from Text file



Hi Renger,

Thanks but it doesnt work and get same error!

I do not know if there is any influence but I specify A1:d45 but in the error log it mentions b2.:d45 !



Any ideas what could be wrong?

I am attaching the Error Log.



Thank you, Cheers,






On Wednesday, November 27, 2013 6:47:36 AM UTC+1, Renger van Nieuwkoop wrote:

Slice instead of slice(j)

Cheers

Renger



sent from my iPad


Am 27.11.2013 um 06:46 schrieb “goliii” :

Hi Renger,


thank you for your help!

I added Trace=3 to the call and I tried to change the staff which you said but I still have problem. I guess the error caused by "$load slice(j) " but I dont know what could I write instead of it??!!

Sets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);


$Call GDXXRW.exe table1.xlsx set=i rng=a1:a45 cdim=1 set=j rng=b1:d45 rdim=1 Par=slice rng=a1:d45 cdim=1 rdim=1 Trace=3



parameter slice(j) slice of data
eff_k(i) efficiency report;


$GDXIN table1.gdx
$load slice(j)
$GDXIN

Positive Variables v(ji) input weights
u(jo) output weights;

Variable eff efficiency;

Equations defe efficiency defiition - weighed output
denom weighted input
lime(i) ‘output/input < 1’;


Sets
10 i Units /DMU01*DMU44/
11 j inputs and outputs /Budget, Personal,Absolventen /
12 ji(j) inputs /Budget, Personal /
13 jo(j) outputs/ Absolventen /;
14
15 Alias (i,k);
16
17
19
20
21
22 parameter slice(j) slice of data
23 eff_k(i) efficiency report;
24
25
GDXIN C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
— MERGE j = 2:j
27 $load slice(j)
**** $495,496,194,496
29
30 Positive Variables v(ji) input weights
31 u(jo) output weights;
32
33 Variable eff efficiency;

Thanks a lot.






On Tuesday, November 26, 2013 2:15:34 PM UTC+1, Renger van Nieuwkoop wrote:

Hi Goliii



In order to find the error you can add Trace=3 to the call



$Call GDXXRW.exe table1.xlsx dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1 Trace=3



If you do that, you will see some of the errors in your output window.



Furthermore, you should

· not use ji(j) but just ji (same for jo) in the call,

· not define the sets explicitly if you want to read them from the excel file (so only set i, j, ij(j), jo(j):wink:

· check the ranges for the sets and read all the sets (you forgot j and have some mistakes in the ranges).

Hope this helps



Cheers

Rneger





From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of goliii
Sent: Dienstag, 26. November 2013 13:44
To: gams...@googlegroups.com
Subject: Re: Importing Data from Text file



Dear Renger,

I changed it to .xlsx, but I faced again with same error!


Sets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

table data(i,j)

$Call GDXXRW.exe table1.xlsx dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1
$GDXIN table1.gdx
$load i ji(j) jo(j)
$GDXIN


parameter slice(j) slice of data
eff_k(i) efficiency report;

Positive Variables v(ji) input weights
u(jo) output weights;

table data(i,j)
18
**** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
**** Msg : No such file or directory
20 $GDXIN table1.gdx
**** $510
21 $load i ji(j) jo(j)
**** $502

Thanks!


On Tuesday, November 26, 2013 1:33:08 PM UTC+1, Renger van Nieuwkoop wrote:

Hi Golliii

You use the xls as extension but your file has the extension xlsx, so replace xls by xlsx.

Cheers

Renger

From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of goliii
Sent: Dienstag, 26. November 2013 12:42
To: gams...@googlegroups.com
Subject: Re: Importing Data from Text file



Hi Renger,


now I want to import data from an Excel file and I used following code:


ets
i Units /DMU01*DMU44/
j inputs and outputs /Budget, Personal,Absolventen /
ji(j) inputs /Budget, Personal /
jo(j) outputs/ Absolventen /;

Alias (i,k);

table data(i,j)

$Call GDXXRW.exe table1.xls dset=i rng=a2:a45 rdim=1 dset=ji(j) rng=b1:c45 cdim=1 rdim=1 dset=jo(j) rng=d1:d45 cdim=1
$GDXIN table1.gdx
$load i ji(j) jo(j)
$GDXIN


parameter slice(j) slice of data
eff_k(i) efficiency report;

Positive Variables v(ji) input weights
u(jo) output weights;

Variable eff efficiency;


but I faced with error number 510 (no such a file!!!):

table data(i,j)
18
**** File: C:\Users\Golnaz\Documents\gamsdir\projdir\table1.gdx
**** Msg : No such file or directory
20 $GDXIN table1.gdx
**** $510
21 $load i ji(j) jo(j)
**** $502
23
24
25 parameter slice(j) slice of data
**** $463
26 eff_k(i) efficiency report;



could you please tell me what’s wrong is with this model ?

I send you my Excel file too.


Thanks.


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/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


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/groups/opt_out.


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/groups/opt_out.