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

2018-04-04 Thread Andrew Makhorin
On Wed, 2018-04-04 at 11:51 -0400, marky1991 . wrote:
> In that case, how am I supposed to know whether that means the
> solution's value was 217.351 or 217.3512 (or 217.3511, etc)? Is there
> no way to configure this? 
> 

Even if you print the solution with more places, please note that the
solution itself is computed with a finite relative precision which is
about 1e-6 for integer variables.


___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


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

2018-04-04 Thread Heinrich Schuchardt
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.01".
> 
> 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.01
> Reading problem data from 'parents_allocated-pulp.lp'...
> 2 rows, 7 columns, 8 non-zeros
> 6 integer variables, none of which are binary
> 22 lines were read
> 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.1e+01 inf =   0.000e+00 (1)
> * 1: obj =   3.3e+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.3e+01 <=   3.3e+01   0.0% (1; 0)
> + 1: mip =   3.3e+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
> Help-glpk@gnu.org
> https://lists.gnu.org/mailman/listinfo/help-glpk
> 


___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


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

2018-04-04 Thread marky1991 .
In that case, how am I supposed to know whether that means the solution's
value was 217.351 or 217.3512 (or 217.3511, etc)? Is there no way to
configure this?
___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


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

2018-04-04 Thread Andrew Makhorin
On Wed, 2018-04-04 at 10:41 -0400, 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.01". 
> 
> 
> 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? 

There is nothing wrong. You see 217.351 rather than 217.3512 because
glpsol prints the solution report only with 6 decimal places.

> 
> 
> 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.01
> Reading problem data from 'parents_allocated-pulp.lp'...
> 2 rows, 7 columns, 8 non-zeros
> 6 integer variables, none of which are binary
> 22 lines were read
> 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.1e+01 inf =   0.000e+00 (1)
> * 1: obj =   3.3e+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.3e+01 <=   3.3e+01   0.0% (1; 0)
> + 1: mip =   3.3e+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
> Help-glpk@gnu.org
> https://lists.gnu.org/mailman/listinfo/help-glpk



___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


[Help-glpk] Controlling Precision of Variable Bounds

2018-04-04 Thread marky1991 .
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.01".

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.01
Reading problem data from 'parents_allocated-pulp.lp'...
2 rows, 7 columns, 8 non-zeros
6 integer variables, none of which are binary
22 lines were read
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.1e+01 inf =   0.000e+00 (1)
* 1: obj =   3.3e+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.3e+01 <=   3.3e+01   0.0% (1; 0)
+ 1: mip =   3.3e+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.


parents_allocated-pulp.lp
Description: Binary data


parents_allocated-pulp.sol
Description: Binary data
___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk