|
From: | Domingo Alvarez Duarte |
Subject: | Re: Solver delivers wrong answer when 2 constraints are close |
Date: | Thu, 4 Mar 2021 10:38:19 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
Testing this problem I discover that if we change the order of constraint declarations it seems to give the expected answer as stated by Thiago (what I think could be another bug).
====
====
Output:
====
x.val = 1.0001
====
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
[Prev in Thread] | Current Thread | [Next in Thread] |