[Top][All Lists]

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

Re: [Bug-glpk] GLPSOL ends unexpectedly due to recursion

From: Andrew Makhorin
Subject: Re: [Bug-glpk] GLPSOL ends unexpectedly due to recursion
Date: Mon, 15 Dec 2008 07:59:11 +0300

> 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:

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. :)

reply via email to

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