help-glpk
[Top][All Lists]
Advanced

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

Solver delivers wrong answer when 2 constraints are close


From: Thiago Neves
Subject: Solver delivers wrong answer when 2 constraints are close
Date: Wed, 3 Mar 2021 15:19:48 -0300

Hi.
I've found a strange behaviour in glpk which I don't know how to fix nor how to contour it. It seems like GLPK can't distinguish constraints that differs from about 1e-4. 

Follows simple examples that explain and reproduce the problem. 

The first model gives the desired answer (x = 1.0001):

param min_bound default 0;
var x >= 0;

minimize y: x;
  
s.t. PART_MIN_X: x >= 1 + min_bound;


solve;
display min_bound;
display x; # EXPECTED RESULT: X ==  1.0001

data;
param min_bound := 1e-4;
end;

_____________________________________
OUTPUT:
x.val = 1.0001
_____________________________________  

Now, if I add a second constraint "close" to the first one, the solver will deliver an answer that is actually infeasible:

param min_bound default 0;
var x >= 0;

minimize y: x;

s.t. LIM_INF_X: x >= 1;

s.t. PART_MIN_X: x >= 1 + min_bound;

solve;
display min_bound;
display x; # EXPECTED RESULT: X ==  1.0001

data;
param min_bound := 1e-4;
end;
_____________________________________
OUTPUT:
x.val = 1
_____________________________________  

If I change the "min_bound" parameter to 1e-2, the second model works as expected (x = 1.01):

param min_bound default 0;

var x >= 0;

minimize y: x;

s.t. LIM_INF_X: x >= 1;

s.t. PART_MIN_X: x >= 1 + min_bound;

solve;

display x; # EXPECTED RESULT: X ==  1.01

data;
param min_bound := 1e-2;
end;
_____________________________________
OUTPUT:
x.val = 1.01
_____________________________________  


Att,

Thiago H. Neves
(31) 98608-0666


reply via email to

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