help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] Re: Inital Proposal for UNPIVOT and PIVOT Syntax for Table I


From: glpk xypron
Subject: [Help-glpk] Re: Inital Proposal for UNPIVOT and PIVOT Syntax for Table IN and Table OUT in MathProg
Date: Sun, 19 Sep 2010 10:00:29 +0200

Hello Noli,
> >> table tblData IN "ODBC" "Otago.mdb" : [i ~ Croptype, j ~ Age], {p in
> >> PRODUCT: Type[p] <> 'Residue'} <Yield[p,i,AgeToAgeClass[j]] ~ (p)>;
> >
> > Given a CSV file with a unknown number of columns - one per product -
> > how would you fill PRODUCT?
> 
> I forget to include some of the assumption of the model.
> 
> param Status{PRODUCT} symbolic;      #  Revenue, Cost, Yield, Ignore
> 
> param Type{PRODUCT} symbolic; #  Product (Final), Thinning
> (Intermediate), Residue
> 
> This is where Type[p] is reading the values. PRODUCT is enumerated in
> the tblProduct tables in Product column and Status[p] in Status
> column.

In your special case you may have an extra table with all the column names.
In the general case such a table does not exist. E.g. think of a
spreadsheet like

Farmer | Year | Beech | Oak | Maple | Alder
Eric   | 1920 |   100 |   0 |     0 |     0
Eric   | 1940 |    50 |   0 |     0 |     0
Jonas  | 1920 |     0 |  20 |    20 |     0
Jonas  | 1940 |    10 |  20 |    20 |    10

as your sole source of input which you want to read as a set

{
(Eric, 1920, Beech, 100),
(Eric, 1940, Beech, 100),
(Jonas, 1920, Oak, 20),
(Jonas, 1920, Maple, 20),
(Jonas, 1940, Oak, 20),
(Jonas, 1940, Maple, 20),
(Jonas, 1940, Alder, 10)
}

Best regards

Xypron

-- 
GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl



reply via email to

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