help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MI


From: Noli Sicad
Subject: Re: [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MIP results)
Date: Sat, 12 Jun 2010 12:05:19 +1000

Hi Xypron,

This is interesting. I think we can do the same to write gnuplot
scripts (e.g "lp_result_sqlite3.gms" file) from MathProg. I

Xypron, Is this right way, (please see the example below)? I don't see
"shell" command in MathProg but AMPL has shell command. If shell is
implemented in MathProg, we can invoke gnuplot with glpsol. Then, we
see the gnuplot graph right away.

shell 'command-line"
shell;

>From the AMPL Book, pp 334 AMPL Reference manual Appendix A.

" the first version runs command-line, which is contained in a literal
string. In the second version, AMPL invokes an operation-system
shell....."

I hope Andrew is reading this and will implement 'shell" command :-)

shell 'gnuplot.exe'
shell;

> # filename
> param file, symbolic := 'random.xml';
> # generate some data
> set I := 1..10;
> param p{I} := Uniform01();
> # output data to xml
> printf '<?xml version="1.0" encoding="ISO-8859-1"?>' > file;
> printf '<resultset date="%s">',time2str(gmtime(),"%FT%TZ") >> file;
> for {i in I}
>   printf '<random index="%i">%g</random>',i,p[i] >> file;
> printf '</resultset>' >> file;
> end;

Here is the example for gnuplot.gms
~~~~~~~~~~~
$ gnuplot
set style data lines
set datafile separator "|"
set style data histograms
plot "< sqlite3 sqlite1.db  'select * from data'"
      using 2:xtic(1) title "hair", "" using 4 t "vision"
http://www.linux.com/news/software/developer/26873:generating-graphs-with-gnuplot-part-3%3E
~~~~~~~~~~~~~~


# filename for gnuplot
param file, symbolic := 'lp_result_sqlite3.gms';

# start printing the gnuplot script
printf 'set style data lines' > file;
printf 'set datafile separator "|">> file;
print 'set style data histograms'>>file;
plot ' "< sqlite3 sqlite1.db  'select * from data'"
      using 2:xtic(1) title "hair", "" using 4 t "vision" ' >>file;

# if shell is impemented in MathProg
shell 'gnuplot.exe lp_result_sqlite3.gms';
shell;
end;

I have not tried it yet.

Thanks. Noli



reply via email to

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