help-glpk
[Top][All Lists]

## Re: [Help-glpk] Controlling Precision of Variable Bounds

 From: Heinrich Schuchardt Subject: Re: [Help-glpk] Controlling Precision of Variable Bounds Date: Wed, 4 Apr 2018 18:08:05 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

```In  src/api/prmip.c the output is limited to 6 digits of precision
(%13.6g). So this is only an output issue.

If you use the GMPL language to specify your problem you can indicate
the output precision in the printf statement.

Best Regards

Heinrich

var P, integer >= 0, <=33;
var x0, integer, >= 0;
var x1, integer, >= 0;
var x2, >= 0, <= 217.3512;
var x3, integer, >= 0;
var x4, integer, >= 0;
var x5, integer, >= 0, <= 154;
maximize obj: P;
s.t. _C1: - 9.8796 * P + 10 * x0 + 10 * x1 + x2 = -108.6756;
s.t. _C2: - 7 * P + 7 * x3 + 7 * x4 + x5 = -77;
solve;
printf "P,  %13.12g (%13.12g, %13.12g)\n", P, P.lb, P.ub;
printf "x0, %13.12g (%13.12g, %13.12g)\n", x0, x0.lb, x0.ub;
printf "x1, %13.12g (%13.12g, %13.12g)\n", x1, x1.lb, x1.ub;
printf "x2, %13.12g (%13.12g, %13.12g)\n", x2, x2.lb, x2.ub;
printf "x3, %13.12g (%13.12g, %13.12g)\n", x3, x3.lb, x3.ub;
printf "x4, %13.12g (%13.12g, %13.12g)\n", x4, x4.lb, x4.ub;
printf "x5, %13.12g (%13.12g, %13.12g)\n", x5, x5.lb, x5.ub;
end;

On 04/04/2018 04:41 PM, marky1991 . wrote:
> I'm trying to solve a problem that has noninteger bounds for its
> variables, the problem and the outputted solution attached. I'm invoking
> glpsol with the command "glpsol --lp parents_allocated-pulp.lp -o
> parents_allocated-pulp.sol --mipgap 0.000001".
>
> The trouble is that the upper bound for my "x2" variable is being
> limited to "217.351" instead of the given "217.3512" and I'm not sure
> why. Is there some parameter I can pass to make it go past 3 decimal
> places for the upper bound?
>
> I tried --exact and every other parameter that I could see but none
> helped. Is there some way to increase the number of digits in the bounds?
>
> My output with 4.65:
>
> GLPSOL: GLPK LP/MIP Solver, v4.65
> Parameter(s) specified in the command line:
>  --lp parents_allocated-pulp.lp -o parents_allocated-pulp2.sol --mipgap
> 0.000001
> Reading problem data from 'parents_allocated-pulp.lp'...
> 2 rows, 7 columns, 8 non-zeros
> 6 integer variables, none of which are binary
> GLPK Integer Optimizer, v4.65
> 2 rows, 7 columns, 8 non-zeros
> 6 integer variables, none of which are binary
> Preprocessing...
> 1 row, 2 columns, 2 non-zeros
> 2 integer variables, none of which are binary
> Scaling...
>  A: min|aij| =  1.000e+00  max|aij| =  7.000e+00  ratio =  7.000e+00
> Problem data seem to be well scaled
> Constructing initial basis...
> Size of triangular part is 1
> Solving LP relaxation...
> GLPK Simplex Optimizer, v4.65
> 1 row, 2 columns, 2 non-zeros
> *     0: obj =   1.100000000e+01 inf =   0.000e+00 (1)
> *     1: obj =   3.300000000e+01 inf =   0.000e+00 (0)
> OPTIMAL LP SOLUTION FOUND
> Integer optimization begins...
> Long-step dual simplex will be used
> +     1: mip =     not found yet <=              +inf        (1; 0)
> +     1: >>>>>   3.300000000e+01 <=   3.300000000e+01   0.0% (1; 0)
> +     1: mip =   3.300000000e+01 <=     tree is empty   0.0% (0; 1)
> INTEGER OPTIMAL SOLUTION FOUND
> Time used:   0.0 secs
> Memory used: 0.1 Mb (59394 bytes)
> Writing MIP solution to 'parents_allocated-pulp.sol'...
>
> Thanks for the help.
>
>
> _______________________________________________
> Help-glpk mailing list