bug-glpk
[Top][All Lists]
Advanced

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

Re: [Bug-glpk] indexed sets in GNU MathProg


From: Andrew Makhorin
Subject: Re: [Bug-glpk] indexed sets in GNU MathProg
Date: Sun, 11 May 2003 19:12:04 +0400

>While playing around with glpsol, I noticed that
>the following set definition generates an assertion failure.
>
>set S{i in 1..20} dimen 1 :=
>  if i < 3 then i..i+3
>  else S[i-1] symdiff (i..i+1 union S[i-2]);
>
>(Without the 'dimen 1' bit, it complains that the
>else clause has dimension 0.)

Thank you very much for your bug report!

I will fix the bug in the next release of glpk. If you wish to fix it
right now, please do the following changes.

1. Replace the line 1808 in the file glpmpl1.c:

      code = make_ternary(mpl, O_FORK, x, y, z, y->type, 0);

   by the following:

      code = make_ternary(mpl, O_FORK, x, y, z, y->type, y->dim);

2. Add the following fragment after the line 3746 in the file glpmpl3.c:

         case O_FORK:
            /* if-then-else */
            if (eval_logical(mpl, code->arg.arg.x))
               value = eval_elemset(mpl, code->arg.arg.y);
            else
               value = eval_elemset(mpl, code->arg.arg.z);
            break;

3. Recompile or reinstall the package.

The dimen attribute in your example cannot be omitted and must be
specified before other set attributes, because the set S is referenced
recursively in its own declaration. Of course, the error message issued
is inappropriate, and I will replace it in the next version.

Due to your report I've found another bug (namely, the construction
like 'if ... in (if ... then ... else ...) ...' also doesn't work).
Once I'll have fixed all the bugs, I'll post a complete patch to the
bug-glpk mailing list.


Andrew Makhorin






reply via email to

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