COIN-OR::LEMON - Graph Library

Ticket #441: 55c6560a7c0f.patch

File 55c6560a7c0f.patch, 2.0 KB (added by Balazs Dezso, 8 years ago)
  • lemon/bits/solver_bits.h

    # 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  
    4444
    4545      void clear() {
    4646        first_item = -1;
     47        last_item = -1;
    4748        first_free_item = -1;
    4849        items.clear();
    4950        cross.clear();
  • lemon/lp_skeleton.cc

    diff -r cfbabca1b4e9 -r 55c6560a7c0f lemon/lp_skeleton.cc
    a b  
    8787
    8888  void SkeletonSolverBase::_clear() {
    8989    row_num = col_num = 0;
     90    rows.clear(); cols.clear();
    9091  }
    9192
    9293  void SkeletonSolverBase::_messageLevel(MessageLevel) {}
  • test/lp_test.cc

    diff -r cfbabca1b4e9 -r 55c6560a7c0f test/lp_test.cc
    a b  
    4141
    4242using namespace lemon;
    4343
     44int countCols(LpSolver& lp) {
     45  int count = 0;
     46  for (LpSolver::ColIt c(lp); c != INVALID; ++c) ++count;
     47  return count;
     48}
     49
     50int countRows(LpSolver& lp) {
     51  int count = 0;
     52  for (LpSolver::RowIt r(lp); r != INVALID; ++r) ++count;
     53  return count;
     54}
     55
    4456void lpTest(LpSolver& lp)
    4557{
    4658
     
    244256       );
    245257  }
    246258
     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  }
    247276}
    248277
    249278void solveAndCheck(LpSolver& lp, LpSolver::ProblemType stat,