[Top][All Lists]

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

[Help-glpk] CSV output?

From: Kevin Hunter
Subject: [Help-glpk] CSV output?
Date: Sun, 25 Jul 2010 16:27:40 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100528 Thunderbird/3.0.5

Hello List,

I'm attempting to programmatically parse the solution output from GLPK. From what I currently see, there's no way to unambiguously parse the output because of a lack of delimiters. The only "mostly correct" way that I see is to use column indices. The problem with this is if the value exceeds the column width, parsing gets much more difficult.

What I would like would be an unambiguous format like what CSV could provide. For example, the 1st example below could be unambiguously (and much more easily) parsed if presented as a CSV:

$ glpsol ... --output solution.soln
$ cat solution.soln | grep -A3 'No.   Row name'

   No.   Row name   St   Activity     Lower bound   Upper bound    Marginal
------ ------------ -- ------------- ------------- ------------- -------------
     1 cost         B        153.675
     2 supply[Se]   B            300                         350

$ glpsol ... --output_format csv --output solution.soln
$ cat solution.soln | grep -A3 'No.,Row name'

No.,Row name,St,Activity,Lower bound,Upper bound,Marginal

(Please excuse the email formatting, if possible. If not, I can resend the output as an attachment so that it won't get muddled.)

This also has the virtue of

 - Creating a smaller output file

 - The output can more easily be understood by a multitude of tools
   and libraries (for instance, Excel/Calc, scripting CSV libraries,
   etc.).  Less ad-hoc and specific parsing necessary.

 - Making unambiguous output, for example, like what currently happens
    - when row name exceeds 12 characters,
    - if a string representation of a value exceeds the column width,
    - or if a value is not specified (like index 2, lower bound)

 - Keeping the "human readable" names of constraints and variables,
   unlike the -w output format

Is there another way to unambiguously represent the solution output? If not, and if CSV would be welcomed by the developers, I'm happy to create a patch.



reply via email to

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