help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Special key in csv output


From: Xypron
Subject: Re: [Help-glpk] Special key in csv output
Date: Fri, 22 Oct 2010 19:27:14 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.14) Gecko/20100930 SeaMonkey/2.0.9

Hello Jiri,

the example below relies on Trucks and Stocks being ordered sets.

Best regards

Xypron

set Trucks;
set Stocks;
param load{Trucks, Stocks} := if (Uniform01()) < .5 then 0. else Uniform01();
solve;
table ta {t in Trucks, s in Stocks : load[t,s] > 0} OUT 'CSV' 'test.csv' :
sum{u in Trucks, v in Stocks : load[u,v] > 0 && (u < t || (u == t && v < s ) ) } 1 + 1 ~ Counter,
t ~ Truck, s ~ Stock, load[t,s] ~ Load;
display load;
data;
set Trucks := T1 T2 T3 T4;
set Stocks := S1 S2 S3;
end;


Jiri K wrote:
Hello,
I am using the standalone GLPK solver and I extract outputs into csv file.
Would anyone have an idea how to achieve the following?:

In the table:
table result {t in TRUCK:sum{s in STOCK}load[s,t]>0} OUT "CSV"
".output.csv": (etc)

I would like to have a field with numbers going 1, 2, 3... as far as the
table reaches. Please note that load[s,t] is a variable, so only at the end
of the calculation it is clear, which t in TRUCK will be included in the
output.

I will be happy for any advice.

Jiri





reply via email to

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