help-glpk
[Top][All Lists]
Advanced

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

Re: One-off error in the MIP solver?


From: Domingo Alvarez Duarte
Subject: Re: One-off error in the MIP solver?
Date: Mon, 24 Jan 2022 10:58:17 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

Hello Harmut !

Testing it on https://meimporta.eu/myglpk-ext/ that's GLPK 4.65 plus several customizations gives this result:

===

v: 131072
v: 00011111111111111111
v: 131071
e: 0

===

I'm don't see a reason to upgrade right now.

Cheers !

On 24/1/22 10:46, Hartmut Henkel wrote:
Hi,

here seems to be some one-off error in gmpl/glpk (5.0, debian Linux):

param v := 131072;
param n := 20; # number of bits
set J  := 1..n; # set of all bits
var x{j in J}, binary;
var e, >= 0;
minimize slack: e;

s.t. cs1: sum{j in J} (2**(j - 1) * x[j]) - v <=  e;
s.t. cs2: sum{j in J} (2**(j - 1) * x[j]) - v >= -e;

solve;

printf "v: %d\nv: ", v;
for {j in J} printf "%d", x[n - j + 1];
printf "\n";
printf "v: %d\n", sum{j in J} (2**(j - 1) * x[j]);
printf "e: %d\n", e;

end;

Here it prints:

v: 131072
v: 0011111111111111111
v: 131071
e: 0

With v = 131071 or v = 131073 or v = 65536 it works fine. Also fine with
larger numbers like v = 888888. Same problem when solving the exported
.lp file, which looks ok., confirmed by another solver. Seems not to be
a general int limitation or printing issue. Do you have any idea what's
happening here?

Best Regards, Hartmut




reply via email to

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