help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] RES: script file foo.run


From: Andrew Makhorin
Subject: Re: [Help-glpk] RES: script file foo.run
Date: Sat, 30 Jul 2011 08:04:57 +0400

> 
> param nruns := 5;
> param optvalue {1..nruns};
> for {k in 1..nruns} {
>   reset data avail;
>   solve;
>   let optvalue[k] := total_profit;
> }
> display (sum {k in 1..nruns} optvalue[k]) / nruns;
> 

This would require including into MathProg many programming language
features, that seems to me impractical. In my opinion it would be much
better to have api routines for communicating with MathProg objects
(something like sql), for example:

   gmpl_stmt("param n := 5");
   gmpl_stmt("var x[1..n], >= 0");
   gmpl_stmt("s.t. sum{i in n} x[i] = 1");
   gmpl_stmt("solve");
   for (i = 1; i <= gmpl_param("n"); i++)
      printf("x[%d] = %g\n", i, gmpl_var("x[%d]", i));





reply via email to

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