[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-glpk] second issue
From: |
Andrew Makhorin |
Subject: |
Re: [Bug-glpk] second issue |
Date: |
Mon, 13 Jan 2003 20:35:39 +0300 |
>The second issue comes from a bug report submitted to the Debian
>package of GLPK. The bug report itself is at
>http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=175205
>
>A user complains that while the following assignment works:
>
> TCasualA[i,j] := table(i in Tattiche, j in Tattiche:
> carica attacca circonda agguato ferma ritira:
> carica, Cp2, ., Cp1, ., ., Cp3,
> attacca, Cp2, Cp1, ., ., Cm1, Cp2/2,
> circonda, ., Cp1, ., ., Cp2, Cm1/2,
> agguato, Cp2, Cp1, Cm1, ., Cm1, Cm1/2,
> ferma, Cp2, ., ., ., ., .,
> ritira, ., 0/2, 0/2, Cm1/2, ., . );
>
>The following alternative does not:
>
> TCasualA[i,j] := table(i in Tattiche, j in Tattiche:
> carica attacca circonda agguato ferma ritira:
> carica Cp2 . Cp1 . . Cp3
> attacca Cp2 Cp1 . . Cm1 Cp2/2
> circonda . Cp1 . . Cp2 Cm1/2
> agguato Cp2 Cp1 Cm1 . Cm1 Cm1/2
> ferma Cp2 . . . . .
> ritira . 0/2 0/2 Cm1/2 . . );
>
>Cp1, Cp2, and Cm1 are parameters.
>
>The problem is that GLPK interprets the first `.' as indicating a
>suffix for Cp2. But parameters can't have suffixes, so GLPK exits on
>error.
Implicit parameters (like x.lo, x.fx, etc.) have suffices and can be
used as ordinary parameters. Since `.' is recognized as a separate
token (unlike numeric constants, where `.' is a part of the constant),
the comma should follow an identifier as in the first version while the
second version is syntactically incorrect. However, there is other way
to attain the same effect: one may enclose each expression (which is not
a constant) in parentheses, in which case the comma may be omitted, for
example:
TCasualA[i,j] := table(i in Tattiche, j in Tattiche:
carica attacca circonda agguato ferma ritira:
carica (Cp2) . (Cp1) . . (Cp3)
attacca (Cp2) (Cp1) . . (Cm1) (Cp2/2)
etc.
>One solution is to make the documentation more clear by stating that
>commas may be omitted only if following numerical constants or
>periods. Then the second version above is clearly invalid input.
Agree.
>Another alternative is to change the way that designators are parsed
>in glplan5.c. Instead of checking for a `.' always, it could only be
>checked if the token is a variable. Then both versions above should
>work.
As I explained above expressions used as entries in the table and data
clauses can contain `.'.
Andrew Makhorin