# HG changeset patch
# User Balazs Dezso <deba@inf.elte.hu>
# Date 1336237264 -7200
# Node ID 55c6560a7c0fd2334c394d2ccd9644168cd1c7df
# Parent cfbabca1b4e9b8d4ce408f853db728509d020110
Fix clear() in VarIndex
diff -r cfbabca1b4e9 -r 55c6560a7c0f lemon/bits/solver_bits.h
|
a
|
b
|
|
| 44 | 44 | |
| 45 | 45 | void clear() { |
| 46 | 46 | first_item = -1; |
| | 47 | last_item = -1; |
| 47 | 48 | first_free_item = -1; |
| 48 | 49 | items.clear(); |
| 49 | 50 | cross.clear(); |
diff -r cfbabca1b4e9 -r 55c6560a7c0f lemon/lp_skeleton.cc
|
a
|
b
|
|
| 87 | 87 | |
| 88 | 88 | void SkeletonSolverBase::_clear() { |
| 89 | 89 | row_num = col_num = 0; |
| | 90 | rows.clear(); cols.clear(); |
| 90 | 91 | } |
| 91 | 92 | |
| 92 | 93 | void SkeletonSolverBase::_messageLevel(MessageLevel) {} |
diff -r cfbabca1b4e9 -r 55c6560a7c0f test/lp_test.cc
|
a
|
b
|
|
| 41 | 41 | |
| 42 | 42 | using namespace lemon; |
| 43 | 43 | |
| | 44 | int countCols(LpSolver& lp) { |
| | 45 | int count = 0; |
| | 46 | for (LpSolver::ColIt c(lp); c != INVALID; ++c) ++count; |
| | 47 | return count; |
| | 48 | } |
| | 49 | |
| | 50 | int countRows(LpSolver& lp) { |
| | 51 | int count = 0; |
| | 52 | for (LpSolver::RowIt r(lp); r != INVALID; ++r) ++count; |
| | 53 | return count; |
| | 54 | } |
| | 55 | |
| 44 | 56 | void lpTest(LpSolver& lp) |
| 45 | 57 | { |
| 46 | 58 | |
| … |
… |
|
| 244 | 256 | ); |
| 245 | 257 | } |
| 246 | 258 | |
| | 259 | { //Tests for #441 |
| | 260 | check(countCols(lp) == 30, "Wrong number of columns"); |
| | 261 | check(countRows(lp) == 6, "Wrong number of rows"); |
| | 262 | |
| | 263 | lp.clear(); |
| | 264 | |
| | 265 | check(countCols(lp) == 0, "Wrong number of columns"); |
| | 266 | check(countRows(lp) == 0, "Wrong number of rows"); |
| | 267 | |
| | 268 | LP::Col p1; |
| | 269 | p1=lp.addCol(); |
| | 270 | std::cerr << countCols(lp) << std::endl; |
| | 271 | check(countCols(lp) == 1, "Wrong number of columns"); |
| | 272 | |
| | 273 | lp.addRow(p1==1); |
| | 274 | check(countRows(lp) == 1, "Wrong number of rows"); |
| | 275 | } |
| 247 | 276 | } |
| 248 | 277 | |
| 249 | 278 | void solveAndCheck(LpSolver& lp, LpSolver::ProblemType stat, |