[Top][All Lists]
[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: |
Sun, 13 Jun 2010 11:35:01 +1000 |
Re: MathProg + txt model + gnuplot.
This is not working yet. But I will be working on this. I just post
before I will lost scripts.
Gnuplot users, I need you help how to plot the result - "plot" function
Noli
~~~~~~~~~~~~
# Add to script below to transp.mod model found in the examples directory
solve;
#RESULTS SECTION
printf '#################################\n';
printf 'TRANSPORTATION PROBLEM\n';
printf '\n';
printf 'Total_Cost = %.2f\n',
sum{i in I, j in J} c[i,j] * x[i,j];
printf '\n';
printf '\n';
printf 'Variables\n';
printf 'ORIGIN DESTINATION Quantity Dual\n';
printf{i in I, j in J}:'%10s %11s %10.2f %10.2f\n',i,j,x[i,j].val,x[i,j].dual;
printf '\n';
# filename for gnuplot transp_result.dat';
param file1, symbolic := 'transp_result.dat';
printf 'ORIGIN DESTINATION Quantity Dual \n'> file1;
printf{i in I, j in J}:'%10s %11s %10.2f
%10.2f\n',i,j,x[i,j].val,x[i,j].dual>> file1;
printf '\n';
# Dual or Reduced cost for the variables?
/* 'transp_result.dat' Output
ORIGIN DESTINATION Quantity Dual
Seattle New-York 50.00 0.00
Seattle Chicago 300.00 0.00
Seattle Topeka 0.00 0.04
San-Diego New-York 275.00 0.00
San-Diego Chicago 0.00 0.01
San-Diego Topeka 275.00 0.00
*/
# filename for gnuplot
param file, symbolic := 'transp_graph.gnu';
# start printing the gnuplot script
printf 'set style data lines\n' > file;
#printf 'set datafile separator "\t" \n' >> file;
printf 'set style data histograms \n' >>file;
# printf 'plot " < transp_result.dat using 2:xtic(1) title "primal",
"" using 4 t "dual" ' >>file;
# gnuplot gurus, I need help here for plot - histogram and (line
graphs for later use)
~~~~~~~~~~~~~
On 6/13/10, Noli Sicad <address@hidden> wrote:
> Hi Xypron,
>
>> The first syntax executes command_line.
>> The second syntax invokes a shell (Linux console, or Windows console
>> ("cmd"))and returns to AMPL when the shell is terminated.
>>
>> (see Robert Fourer, AMPL, 2nd edition)
>>
>> These commands make sense in AMPL, because it is an interactive language.
>>
>> What will be the added value for GLPK users compared to using a shell
>> script?
>
> I think it would useful to run third parties console application e.g.
> gnuplot.
>
> shell 'wgnuplot.exe lp_result-graph.gnu';
> shell;
>
> Display the window graph.
>
> I don't know if this makes sense.
>
> Anyway, back to graphing example in Mathprog. Here is my idea below.
> This is not working yet.
>
> solve;
> table result{i in I, j in J: x[i,j]} OUT "ODBC"
> 'DSN=SQLITE3'
> 'DELETE FROM transp_result;'
> 'INSERT INTO transp_result VALUES (?,?,?)' :
> i ~ LOC1, j ~ LOC2, x[i,j].val ~ PRIMAL, x[i,j].dual ~ DUAL;
>
> Xypron, how to write LOC1 and LOC2 into one data entry, e.g. ROUTE
>
> ROUTE for LOC1 and LOC2
> 'Seattle - New York',
>
> # filename for gnuplot
> param file, symbolic := 'lp_result_sqlite3.gnu';
> # start printing the gnuplot script
> printf 'set style data lines\n' > file;
> printf 'set datafile separator "|" \n' >> file;
> printf 'set style data histograms \n' >>file;
>
> # not working yet. Needs to be fixed with one label "ROUTE"
> printf 'plot " < sqlite3 C:\\gusek\\xypron\\transp_sqlite3.db3 select
> * from transp_result" \n' >>file;
> printf ' using 2:xtic(1) title "primal", "" using 4 t "dual" ' >>file;
>
> Probably would be best using lp_result.dat for gnuplot data for
> instead of using SQL statement.
>
> Any gnuplot users in this group who want to help, how we can get
> interactive graphing in MathProg.
>
> Thanks. Noli
>
- [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MIP results), Noli Sicad, 2010/06/10
- Re: [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MIP results), Nigel Galloway, 2010/06/11
- Re: [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MIP results), glpk xypron, 2010/06/11
- Re: [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MIP results), Noli Sicad, 2010/06/11
- Re: [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MIP results), Noli Sicad, 2010/06/11
- Re: [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MIP results), Xypron, 2010/06/12
- Re: [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MIP results), Noli Sicad, 2010/06/12
- Re: [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MIP results),
Noli Sicad <=
- Re: [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MIP results), Andrew Makhorin, 2010/06/13
Re: [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MIP results), Noli Sicad, 2010/06/11