help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Only one data file allowed in GLPK


From: Andrew Makhorin
Subject: Re: [Help-glpk] Only one data file allowed in GLPK
Date: Tue, 30 Sep 2008 17:23:45 +0400

> Or you could use a Virtual File System, see previous postings.
> Trust me once you've used one with a legacy system like glpk you won't
> know how you did without it. You can use any scripting language, or C,
> to pull together data from disk, database, website, or make it up to
> create any mathprog or data file you want and present it as a normal
> file to glpk. You can build the files entirely in memory if you don't
> want them on the disk. You can prompt for passwords.

I agree with Xypron that preparing model data is an important issue.
However including comprehensive features for data processing in glpk
would take it far away from its main purpose. Using existing tools
like sed, gawk, cpp, etc. is a much better idea.

> The use of gcc to build these files is inventive, but I'd use gawk.

Just an example due to David Gay
http://www.netlib.org/lp/generators/netgen
(how to convert a plain data file to ampl data section using gawk):

#convert netgen output to an AMPL data file
awk '/^NETGEN PROBLEM/ {print "data;"; next}
/^SUPPLY/       {print "param :Sources: supply :="; next}
/^ARCS/         {print ";\nparam :A: cost capacity :="; next}
/^DEMAND/       {print ";\nparam :Sinks: demand :="; next}
/^END/          {print ";\nend;"; exit}
/^[^ ]/         {next}
{print}' $*







reply via email to

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