bug-glpk
[Top][All Lists]
Advanced

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

Bad expression parsing/evaluation


From: Domingo Alvarez Duarte
Subject: Bad expression parsing/evaluation
Date: Sun, 15 Aug 2021 16:06:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

Comparing how AMPL and GMPL calculate random expressions I found some of then where they differ or GMPL can't manage see bellow, also one of then that references itself makes glpsol segfault but ampl gives an error message explaining the problem:

====

param a0 := (((((((788)*(8.46))))+8342*1.803-1))*4186.4*(15));
printf "%f\n", a0;

param a1 := (((22 mod 284/((7530/((2)*(((((25))-421))))))*597 mod 2663)+7283.8-9.60+167 mod ((3))))+(8871);
printf "%f\n", a1;

#param a2 := a1 * a2; #glpsol segfault
param a2 := a0 * a1;
printf "%f\n", a2;

param a = (((((((788)*(8.46))))+8342*1.803-1))*4186.4*(15))*(((22 mod 284/((7530/((2)*(((((25))-421))))))*597 mod 2663)+7283.8-9.60+167 mod ((3))))+(8871);
#param a := 3+2;
printf "%f\n", a;

param b = (((((((788)*(8.46))))+8342*1.803-1))*4186.4*(15))*(((22 mod 284/((7530/((2)*(((((25))-421))))))*597 mod 2663)+7283.8-9.60+167.8644 mod ((3))))+(8871);
#param a := 3+2;
printf "%f\n", b;

param c = (((((((788)*(8.46))))+8342*1.803-1))*4186.4*(15))*(((22/((7530/((2)*(((((25))-421))))))*597)+7283.8-9.60+167))+(8871);
#param a := 3+2;
printf "%f\n", c;

param d = (((((((788.0)*(8.46))))+8342.0*1.803-1.0))*4186.4*(15.0))*(((22.0/((7530.0/((2.0)*(((((25.0))-421))))))*597.0)+7283.8-9.60+167.0))+(8871.0);
#param a := 3+2;
printf "%f\n", d;

====

AMPL output:

====

ampl test.ampl
1363056632.376000
14765.775299
20126587953209.562500
8034912576273.071289
8036090802426.097656
8259816920615.111328
8259816920615.111328

====

GLPSOL output:

====

glpsol -m test.ampl
GLPSOL: GLPK LP/MIP Solver, v4.65
Parameter(s) specified in the command line:
 -m test.ampl
Reading model section from test.ampl...
test.ampl:25: warning: unexpected end of file; missing end statement inserted
25 lines were read
1363056632.376000
17428.775299
23756407765226.851562
test.ampl:13: no value for a
MathProg model processing error

====

With a incorrect expression:

====

param a2 := a1 * a2; #glpsol segfault
#param a2 := a0 * a1;

====

AMPL output:

====

ampl test.ampl
1363056632.376000
14765.775299

test.ampl, line 7 (offset 228):
    a2 is not defined
context:  param a2 := a1 *  >>> a2; <<<  #glpsol segfault

====

GLPSOL output:

====

glpsol -m test.ampl
GLPSOL: GLPK LP/MIP Solver, v4.65
Parameter(s) specified in the command line:
 -m test.ampl
Reading model section from test.ampl...
test.ampl:25: warning: unexpected end of file; missing end statement inserted
25 lines were read
1363056632.376000
17428.775299
Segmentation fault (core dumped)

====

Cheers !




reply via email to

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