> the model below leads to glpsol ending without result or error.

> I would have expected an error message like "illegal recursion" if
> the param statement cannot be resolved by the current implementation.

(FYI: In error messages the GNU Coding Standards recommends to use
the adjective "invalid" rather than "illegal".)

> set I := {0..10};
> param p{i in I} := if (i==0) then 1 else i * p[i-1],
>   >= if (i==10) then 10^9 else p[i+1];
> var x;
> s.t. c : x = p[3];
> solve;
> printf x;
> end;

This issue was discussed earlier; please see:
http://lists.gnu.org/archive/html/help-glpk/2008-06/msg00056.html
http://lists.gnu.org/archive/html/help-glpk/2008-06/msg00064.html
http://lists.gnu.org/archive/html/help-glpk/2008-06/msg00065.html

In general case it is impossible, not actually running the code,
to determine if it is finite or causes an infinite loop. (This is so
called the halting problem; you can find details at:
http://en.wikipedia.org/wiki/Halting_problem )

Since recursion is allowed in MathProg, the only way to prevent
possible errors is to limit the maximum recursion level. The control
program just does so in a non-elegant way abnormally terminating
glpsol due to stack overflow or segmentation fault. :)



_______________________________________________
Bug-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-glpk

Reply via email to