Opened 10 years ago
Closed 10 years ago
#334 closed defect (fixed)
MIP solver gives wrong solution
Reported by: | Akos Ladanyi | Owned by: | Balazs Dezso |
---|---|---|---|
Priority: | critical | Milestone: | LEMON 1.2 release |
Component: | core | Version: | hg main |
Keywords: | Cc: | ||
Revision id: | 9cc6e98c487d |
Description
The program below gives x=1, y=0
as solution with LEMON 1.1.1, but with [9cc6e98c487d] the solution is x=1, y=1
(both with Glpk and Cbc).
#include <iostream> #include <lemon/glpk.h> #include <lemon/cbc.h> int main() { typedef lemon::GlpkMip MIP; //typedef lemon::CbcMip MIP; MIP mip; MIP::Col x, y; x = mip.addCol(); y = mip.addCol(); MIP::Expr e(x - 1.0); mip.addRow(e <= y); mip.colLowerBound(y, 0.0); mip.colType(x, MIP::INTEGER); mip.colBounds(x, 1.0, 2.0); mip.obj(y); mip.min(); if (mip.solve() != MIP::SOLVED || mip.type() != MIP::OPTIMAL) { std::cout << "could not solve it" << std::endl; return 0; } std::cout << "x=" << mip.sol(x) << std::endl; std::cout << "y=" << mip.sol(y) << std::endl; return 0; }
Attachments (1)
Change History (6)
Changed 10 years ago by
Attachment: | 207ba6c0f2e4.patch added |
---|
comment:1 follow-up: 2 Changed 10 years ago by
Milestone: | → LEMON 1.2 release |
---|
What should we do with this ticket? Does the patch correctly fix the problem?
comment:2 follow-up: 3 Changed 10 years ago by
comment:3 follow-up: 4 Changed 10 years ago by
Replying to ladanyi:
Replying to kpeter:
Does the patch correctly fix the problem?
Yes, it does.
Could you please rebase this changeset so that I can also merge it into the 1.1 branch?
E.g. on the top of [994c7df296c9].
comment:4 follow-up: 5 Changed 10 years ago by
Replying to alpar:
Could you please rebase this changeset so that I can also merge it into the 1.1 branch?
This bug is introduced in 793:[e4554cd6b2bf], which is not in the 1.1 branch. See: hg log -P 894 lemon/lp_base.h
Do you know easier solution for deciding wheter rev A is an ancestor of rev B?
comment:5 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Replying to deba:
Replying to alpar:
Could you please rebase this changeset so that I can also merge it into the 1.1 branch?
This bug is introduced in 793:[e4554cd6b2bf], which is not in the 1.1 branch. See: hg log -P 894 lemon/lp_base.h
Sorry, I misread the description of the ticket.
[207ba6c0f2e4] is in the main branch now.
Do you know easier solution for deciding wheter rev A is an ancestor of rev B?
hg debugancestor A B
This tells you the greatest common ancestor(s). Iff the answer is A, then A is an ancestor of B.
Fix addRow