[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] [Fwd: Read Excel data into subscripted set]

From: Xypron
Subject: Re: [Help-glpk] [Fwd: Read Excel data into subscripted set]
Date: Fri, 26 Oct 2012 19:24:48 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.9) Gecko/20121014 Icedove/10.0.9

Hello Christian,

your mail had to be forwarded manually because you are not subscribed to
the GLPK help list.

Two dimensional tables cannot be read by GMPL. Organize your data in
Vitamin C, Hamburger, 0
Water, Wine, 0.93

glpk-4.47/doc/gmpl.pdf provides the syntax. GLPK for Windows has example
files in glpk-4.47/examples/sql.

Best regards


On 26.10.2012 15:27, Andrew Makhorin wrote:
> -------- Forwarded Message --------
> Subject: Read Excel data into subscripted set
> Date: Fri, 26 Oct 2012 14:46:44 +0200
> Hi,
> I have troubles with reading a 2-dimensional table in MS Excel and
> putting the data into a subscripted set. In a first step, I try to read
> a 2-dimensional table and fill its data into a 2-dimensional parameter.
> The example from the AMPL book pp.196-197 (can be found online:
> describes exactly this
> situation. It uses the diet problem to demonstrate, how the parameter
> amt (param amt {NUTR,FOOD} >= 0) can be read from MS Excel by 
> table dietAmts IN "ODBX" DIET2D.xls":
> [i ~ NUTR], {j in FOOD} <amt[i,j] ~ (j)>;
> Since the database connection in GMPL looks a little bit different, I
> adopted my working command for reading in the data of a 1-dimensional MS
> Excel table to the 2-dimensional case like that:
> table dietAmts IN 'ODBC'
>   'DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm,
> *.xlsb)};dbq=.\test.xlsx'
>   'SELECT * FROM [Tabelle2$]' :
>   [i ~ NUTR], {j in FOOD} <amt[i,j] ~ (j)>;
> Putting everything together in one model file (why the table definition
> needs to be before the data part, I still do not understand..), Gusek
> gives me an error message:
> syntax error in field list
> Context:  , FOOD } >= 0 ; table dietAmts IN '...' '...' '...' : [ i ~
> MathProg model processing error
> I would appreciate every help!
> Regards,
> Christian
> _______________________________________________
> Help-glpk mailing list
> address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]