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: glpk xypron
Subject: Re: [Help-glpk] Mathprog > SQLite/MySQL > GNUPlot - (Graphing LP and MIP results)
Date: Sun, 13 Jun 2010 13:25:04 +0200

Hello Noli,

another fancy plot of transp.mod can be generated by adding the
following lines to the model:

solve;

printf '' > 'transp.dat';
for { i in I  } {
  for { j in J } {
    printf '%i "%s"', sum{k in I: k < i} 1, i >> 'transp.dat';
    printf ' %i "%s"', sum{l in J: l < j} 1, j >> 'transp.dat';
    printf ' %f', x[i,j] >> 'transp.dat';
    printf '\n' >> 'transp.dat';

    printf '%i "%s"', sum{k in I: k < i} 1, i >> 'transp.dat';
    printf ' %i "%s"', sum{l in J: l <= j} 1, '' >> 'transp.dat';
    printf ' %f', x[i,j] >> 'transp.dat';
    printf '\n' >> 'transp.dat';
    }
    printf '\n' >> 'transp.dat';
  for { j in J } {
    printf '%i "%s"', sum{k in I: k <= i} 1, '' >> 'transp.dat';
    printf ' %i "%s"', sum{l in J: l < j} 1, j >> 'transp.dat';
    printf ' %f', x[i,j] >> 'transp.dat';
    printf '\n' >> 'transp.dat';

    printf '%i "%s"', sum{k in I: k <= i} 1, '' >> 'transp.dat';
    printf ' %i "%s"', sum{l in J: l <= j} 1, '' >> 'transp.dat';
    printf ' %f', x[i,j] >> 'transp.dat';
    printf '\n' >> 'transp.dat';
    }
    printf '\n' >> 'transp.dat';
  }
data;

set I := San-Diego Seattle;

set J := Chicago New-York Topeka;


And calling gnuplot with

reset
set terminal png font "Arial, 16" transparent size 800,800
set output "transp.png"
set title 'Result of transp.mod'
set xtic offset first .5, first -.25, first 0 mirror 
set ytic offset first .25, first .5, first 0 mirror
set nokey
set pm3d
set palette gray
set grid x y z
splot 'transp.dat' using 1:3:5:xtic(2):ytic(4) with pm3d
exit

Resulting in the appended image.

Best regards

Xypron
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome

Attachment: transp.png
Description: PNG image


reply via email to

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