[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] [Fwd: Reading a list of values into a single element of a se
From: |
Andrew Makhorin |
Subject: |
[Help-glpk] [Fwd: Reading a list of values into a single element of a set] |
Date: |
Wed, 08 Jun 2016 09:19:46 +0300 |
-------- Forwarded Message --------
From: Kadiyala, Krishna <address@hidden>
To: address@hidden <address@hidden>
Subject: Reading a list of values into a single element of a set
Date: Wed, 8 Jun 2016 04:26:17 +0000
Hi,
I have a text file that contains two rows of information like this:
egress,clash
10
10
10
I am trying to read this data into a param clash:
set Q, dimen 1;
param clash{Q};
table data IN "CSV" "Q.txt" :
Q <- [egress], clash ;
When I display clash:
clash[2] = 10
clash[17] = 10
clash[29] = 10
If I have more than on element in the text file like so:
10 12 17
10 9 14
And I want to read an entire row as a single list into clash as in:
clash[2] = 10 12 17, is this possible?
I know that is I declare set Q with 3 dimensions instead of 1, then I
can do Q <-[ egress, egress, egress], clash
But I don’t want three dimensions for Q. I want clash to have only one
dimensioned Q but include all the elements from the row of the text
file.
In other words, I want something like this, but here Q is a set:
set Q[1,1,1] := ; # empty
set Q[1,1,2] := 1 3 4 5;
set Q[1,1,3] := 1 5;
set Q[1,1,4] := 1 3 5;
Thank you for any help! I have been trying to wrap my head around this
but I am very confused right now.
Regards,
Krishna
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Help-glpk] [Fwd: Reading a list of values into a single element of a set],
Andrew Makhorin <=