[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: |
Tue, 30 Oct 2012 20:56:19 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.9) Gecko/20121014 Icedove/10.0.9 |
Hello,
>> is there also a way to read two key columns, where the first consists
>> of elements of a set (let's call them element e1 from set S1) and fill
>> a subscripted set with the elements of the second column
The following solution will need O(n^2) time, where n is the number of
table lines:
set T, dimen 2;
set S1 := setof{(x,y) in T}x;
set S2{x in S1} := setof{(x,y) in T}y;
table t IN "CSV" "test.csv" :
T <- [x,y];
display S2;
end;
test.csv has the following content:
x,y
x1,y1
x1,y2
x3,y3
x4,y4
Best regards
Xypron