Re: Solver delivers wrong answer when 2 constraints are close
Domingo Alvarez Duarte <[email protected]> Thu, 4 Mar 2021 10:38:19 +0100
| Newsgroups | gmane.comp.gnu.glpk |
|---|---|
| Message-ID | <[email protected]> |
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). ==== /param min_bound default 0;/ /var x >= 0; minimize y: x;/ * */*s.t. PART_MIN_X: x >= 1 + min_bound;* / /*s.t. LIM_INF_X: x >= 1; * / /solve; display min_bound; display x; # EXPECTED RESULT: X == 1.0001 data; param min_bound := 1e-4; end;/ ==== Output: ==== x.val = 1.0001 ==== On 3/3/21 19:19, Thiago Neves wrote: > 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 >