help-glpk
[Top][All Lists]

## Re: [Help-glpk] glpsol, arbitrary precision and large numbers

 From: Andrew Makhorin Subject: Re: [Help-glpk] glpsol, arbitrary precision and large numbers Date: Mon, 25 Jun 2012 17:42:23 +0400

```> As part of my research I am attempting to do an interval analysis on 64-bit
> x64
> binaries. This involves working with large numbers in the range [0, 2^64-1].
> These numbers suffer from floating point imprecision and this became apparent
> when solving with lpsolve, which uses a double for internal representation.
>
> I am wondering if glpk can help here, as I know it can use libgmp.
>
> I tried a simple test:
>
> ---8<---
> var x, integer;
> var y, integer;
>
> minimize f: x + y;
>
> s.t. c1: 1*x = 2^64-1;
> s.t. c2: 1*y = 2^64-5;
> ---8<---
>
> Which gives the result:
>
> ---8<---
>    No. Column name       Activity     Lower bound   Upper bound
> ------ ------------    ------------- ------------- -------------
>      1 x            *    1.84467e+19
>      2 y            *    1.84467e+19
> ---8<---
>
> I am not sure if the activity column is showing the "exact" result, or if
> it has been rounded in printing the result.
>
> I guess my question is, can I model these large numbers with GLPK and if
> so, can glpsol print the unrounded outcomes of variables? Is my approach
> just fundamentally flawed altogether?
>

All glpk routines use 64-bit floating-point arithmetic. (The only
exception is the exact simplex solver, which converts input data from
the floating-point format to rational numbers, solves the lp instance in
rationals, and then converts the solution from rationals back to the
floating-point format.) Thus, it is impossible to use exact arithmetic
in MathProg models as well as to obtain solutions in that format.

```