> 
> 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));



_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to