[Cbc] integer overflow in CglGomory.cpp

John Forrest john.forrest at fastercoin.com
Tue May 16 12:54:13 EDT 2017


Tobias,

CglGomory is assuming that if it can get a rational number which is 
within 1.0e-10 of double then that will do.  The trouble is that 
1.0/1.0e-10 overflows an integer.  A very crude solution would be to 
change that to 1.0e-7 but I suspect that would lead to inaccurate cuts.

Changing int to long long int fixes the problem.  I think the solution 
is to be more accurate e.g. 1.0e-12 but convert back to int if possible 
or else say no rational.

Shall I modify to use long long int?

John Forrest

On 16/05/17 10:47, Tobias Stengel wrote:
>
> Hi,
>
> I noticed an integer overflow in CglGomory.cpp / 
> nearestRational(double, int) lines 445 and 446. That specific MIP is 
> solved correctly, but I have no idea whether such an overflow can lead 
> to wrong cuts that e.g. cut off the optimal solution. Anyway integer 
> overflow is undefined behaviour in C/C++ and the returned fractional 
> is not „near“ the input…
>
> 2 parameter sets for nearestRational that lead to overflow can be 
> found in the attached test program. Does anyone know how 
> nearestRational works and how the overflow can be fixed properly?
>
> Thanks
>
> Tobias
>
>
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_cbc&d=DwICAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=js2M0T-3OIMIVDvokcKjokJbk0F8QOCd0mT4FsVFE88&m=L7AT776VDQX3BSKmHST7549RZsaJ2y94DaRP4TUG7Q4&s=nhL5_z_yBvb0pFHQ119ru9uHYjq2HWhTiD1goMhbxt8&e=


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20170516/47ececfb/attachment.html>


More information about the Cbc mailing list