Opened 13 years ago
Closed 12 years ago
#441 closed defect (fixed)
LpBase::clear() bug
Reported by: | Alpar Juttner | Owned by: | Alpar Juttner |
---|---|---|---|
Priority: | major | Milestone: | LEMON 1.3 release |
Component: | core | Version: | hg main |
Keywords: | Cc: | athos@… | |
Revision id: |
Description
From: athos
There is something I don't understand: I add columns to an lp, then I say lp.clear(), then again I add columns, and it seems that it does not add the columns again. Can you explain this to me?
See the attached code.
#include <lemon/list_graph.h> #include <lemon/glpk.h> using namespace lemon; typedef GlpkLp Lp; ///Query function about the LP int numberOfCols(Lp & lp) { int count=0; for (Lp::ColIt c(lp); c!=lemon::INVALID; ++c) ++count; return count; } int main(){ typedef lemon::ListGraph Graph; Graph g; Graph::Node a=g.addNode(); Graph::Node b=g.addNode(); g.addEdge(a,b); Graph::EdgeMap< Lp::Col > x(g); Lp lp; lp.clear(); std::cout << "The number of columns="<<numberOfCols(lp)<< std::endl; lp.addColSet(x); std::cout << "The number of columns="<<numberOfCols(lp)<< std::endl; lp.clear(); std::cout << "The number of columns="<<numberOfCols(lp)<< std::endl; lp.addColSet(x); std::cout << "The number of columns="<<numberOfCols(lp)<< std::endl; }
Attachments (1)
Change History (5)
comment:1 Changed 13 years ago by
Cc: | athos@… added |
---|
Changed 13 years ago by
Attachment: | 55c6560a7c0f.patch added |
---|
comment:2 follow-up: 3 Changed 13 years ago by
comment:3 Changed 13 years ago by
Replying to deba:
The patch [55c6560a7c0f] should fix the problem. There was a bug in the clear() method of lemon::solver_bits::VarIndex?.
Thanks for the patch. Meanwhile, I pushed [8d281761dea4] to all affected branches (1.1, 1.2, main). In addition to your fix, it also moves to re-initialization of rows
and cols
to LpBase::clear()
comment:4 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
The patch [55c6560a7c0f] should fix the problem. There was a bug in the clear() method of lemon::solver_bits::VarIndex?.