Database Access [no data for set]

22 views
Skip to first unread message

Carlos Felipe Fuentes Parra

unread,
Jan 19, 2017, 8:45:05 AM1/19/17
to AMPL Modeling Language
Dear Sirs,

I am working to index data in a  linear program.
When i try to  verify if the data was indexed to AMPL (using display command) , i don't have good results

I attached the table and the work that i did.

What is the solution to this problem ? 


Sincerly yours, 


Carlos Fuentes Parra
Enel Distribución 
Chile
F2.PNG
F1.PNG

Robert Fourer

unread,
Jan 19, 2017, 5:39:39 PM1/19/17
to am...@googlegroups.com
The statement

table costo "ODBC" "trafogeneralizado.xls":
[SE,MVA,TIME], CNU IN, COC IN, COE IN, CR IN, CP;

specifies that values should be read into the params CNU, COC, COE, CR, CP, but it does not specify that values should be read into your sets. Thus you get a "no data for set SE" message. Normally your set data would be read in separately or with data for one-dimensional params, though there are alternatives. To get more specific help, reply to am...@googlegroups.com with the files trafogeneralizado.mod and trafogeneralizado.xls attached to your email; also if you have other data files, it might be helpful to attach them too.

Bob Fourer
am...@googlegroups.com

=======

Carlos Felipe Fuentes Parra

unread,
Jan 20, 2017, 9:28:11 AM1/20/17
to AMPL Modeling Language, 4...@ampl.com
Dear Bob,

Thank you for your help.
i attached the files,

Sincerly yours,



Carlos Fuentes Parra
Enel Distribución 
Chile
trafogeneralizado.dat
trafogeneralizado.mod
trafogeneralizado.run
trafogeneralizado.xls

Robert Fourer

unread,
Jan 20, 2017, 7:28:59 PM1/20/17
to am...@googlegroups.com
It appears that you have all the values for params CNU, COC, COE, CR, CP in your file trafogeneralizado.dat, so your statements

model trafogeneralizado.mod;
data trafogeneralizado.dat;

in trafogeneralizado.run are sufficient, and you do not need to read the Excel file trafogeneralizado.xls. If you want to read the data from trafogeneralizado.xls instead, then delete it from trafogeneralizado.dat, but be sure to read the set values from trafogeneralizado.dat first:

model trafogeneralizado.mod;
data trafogeneralizado.dat;

table costo "ODBC" "trafogeneralizado.xls":
[SE,MVA,TIME], CNU IN, COC IN, COE IN, CR IN, CP;
read table costo;

The values for the indexing sets of CNU, COC, etc. will then be provided in the .dat file, and thus in particular you will not get the "no data for set SE" message.

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of Carlos Felipe Fuentes Parra
Sent: Friday, January 20, 2017 8:28 AM
To: AMPL Modeling Language
Cc: 4...@ampl.com
Subject: Re: [AMPL 13402] Database Access [no data for set]

Thank you for your help.
i attached the files,

=======
Reply all
Reply to author
Forward
0 new messages