COIN-OR::LEMON - Graph Library

Ticket #325: stl-iterators-Lp-df948ed5f35f.patch

File stl-iterators-Lp-df948ed5f35f.patch, 21.8 KB (added by Gábor Gévay, 10 years ago)
  • contrib/CMakeLists.txt

    # HG changeset patch
    # User Gabor Gevay <ggab90@gmail.com>
    # Date 1390224652 -3600
    #      Mon Jan 20 14:30:52 2014 +0100
    # Node ID df948ed5f35f60643b78d4d8340276063b0e1361
    # Parent  2463647b2411f53666b2182090dcca27a32c7da8
    STL style iterators in LpBase.
    
    diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt
    a b  
    1919
    2020
    2121ADD_EXECUTABLE(stlit_test stlit_test/stlit_test.cc)
    22 TARGET_LINK_LIBRARIES(stlit_test lemon)
     22TARGET_LINK_LIBRARIES(stlit_test lemon glpk)
    2323
  • contrib/stlit_test/stlit_test.cc

    diff --git a/contrib/stlit_test/stlit_test.cc b/contrib/stlit_test/stlit_test.cc
    a b  
    99#include <lemon/path.h>
    1010#include <lemon/bfs.h>
    1111#include <lemon/bellman_ford.h>
    12 #include <lemon/euler.h>
     12#include <lemon/concepts/digraph.h>
     13//#include <lemon/euler.h>
    1314#include <lemon/maps.h>
     15//#include <lemon/matching.h>
     16#include <lemon/glpk.h>
    1417
    1518
    1619using namespace std;
     
    189192      cout<<g.id(v)<<endl;
    190193  }
    191194
     195//  cout<<endl;
     196//
     197//  {
     198//    ListGraph g;
     199//    auto u=g.addNode(), v=g.addNode();
     200//    g.addEdge(u,v);  g.addEdge(v,u);
     201//    ListGraph::EdgeMap<int> m(g);
     202//    MaxWeightedMatching<ListGraph> alg(g, m);
     203//    alg.run();
     204//    //for(auto u: alg.blossomNodes(0))
     205//      //cout<<g.id(u)<<endl;
     206//    auto beg = alg.blossomNodes(0).begin();
     207//    auto end = alg.blossomNodes(0).end();
     208//  }
     209
     210  cout<<endl;
     211
     212  {
     213    typedef GlpkLp Lp;
     214    Lp lp;
     215    lp.max();
     216    Lp::Col x1 = lp.addCol(), x2 = lp.addCol();
     217    lp.addRow(x1+x2 <= 100);
     218    for(auto c: lp.cols())
     219      cout<<lp.id(c)<<endl;
     220    for(auto r: lp.rows())
     221      cout<<lp.id(r)<<endl;
     222  }
     223
     224
    192225  return 0;
    193226}
    194227
  • lemon/cbc.cc

    diff --git a/lemon/cbc.cc b/lemon/cbc.cc
    a b  
    111111  }
    112112
    113113  void CbcMip::_eraseColId(int i) {
    114     cols.eraseIndex(i);
     114    _cols.eraseIndex(i);
    115115  }
    116116
    117117  void CbcMip::_eraseRowId(int i) {
    118     rows.eraseIndex(i);
     118    _rows.eraseIndex(i);
    119119  }
    120120
    121121  void CbcMip::_getColName(int c, std::string& name) const {
  • lemon/clp.cc

    diff --git a/lemon/clp.cc b/lemon/clp.cc
    a b  
    2929
    3030  ClpLp::ClpLp(const ClpLp& other) {
    3131    _prob = new ClpSimplex(*other._prob);
    32     rows = other.rows;
    33     cols = other.cols;
     32    _rows = other._rows;
     33    _cols = other._cols;
    3434    _init_temporals();
    3535    messageLevel(MESSAGE_NOTHING);
    3636  }
     
    103103  }
    104104
    105105  void ClpLp::_eraseColId(int i) {
    106     cols.eraseIndex(i);
    107     cols.shiftIndices(i);
     106    _cols.eraseIndex(i);
     107    _cols.shiftIndices(i);
    108108  }
    109109
    110110  void ClpLp::_eraseRowId(int i) {
    111     rows.eraseIndex(i);
    112     rows.shiftIndices(i);
     111    _rows.eraseIndex(i);
     112    _rows.shiftIndices(i);
    113113  }
    114114
    115115  void ClpLp::_getColName(int c, std::string& name) const {
  • lemon/clp.h

    diff --git a/lemon/clp.h b/lemon/clp.h
    a b  
    151151    SolveExitStatus solveBarrier();
    152152
    153153    ///Returns the constraint identifier understood by CLP.
    154     int clpRow(Row r) const { return rows(id(r)); }
     154    int clpRow(Row r) const { return _rows(id(r)); }
    155155
    156156    ///Returns the variable identifier understood by CLP.
    157     int clpCol(Col c) const { return cols(id(c)); }
     157    int clpCol(Col c) const { return _cols(id(c)); }
    158158
    159159  };
    160160
  • lemon/cplex.cc

    diff --git a/lemon/cplex.cc b/lemon/cplex.cc
    a b  
    8787    : LpBase() {
    8888    int status;
    8989    _prob = CPXcloneprob(cplexEnv(), cplex._prob, &status);
    90     rows = cplex.rows;
    91     cols = cplex.cols;
     90    _rows = cplex._rows;
     91    _cols = cplex._cols;
    9292    messageLevel(MESSAGE_NOTHING);
    9393  }
    9494
     
    155155  }
    156156
    157157  void CplexBase::_eraseColId(int i) {
    158     cols.eraseIndex(i);
    159     cols.shiftIndices(i);
     158    _cols.eraseIndex(i);
     159    _cols.shiftIndices(i);
    160160  }
    161161  void CplexBase::_eraseRowId(int i) {
    162     rows.eraseIndex(i);
    163     rows.shiftIndices(i);
     162    _rows.eraseIndex(i);
     163    _rows.shiftIndices(i);
    164164  }
    165165
    166166  void CplexBase::_getColName(int col, std::string &name) const {
  • lemon/glpk.cc

    diff --git a/lemon/glpk.cc b/lemon/glpk.cc
    a b  
    3838    lp = glp_create_prob();
    3939    glp_copy_prob(lp, other.lp, GLP_ON);
    4040    glp_create_index(lp);
    41     rows = other.rows;
    42     cols = other.cols;
     41    _rows = other._rows;
     42    _cols = other._cols;
    4343    messageLevel(MESSAGE_NOTHING);
    4444  }
    4545
     
    108108  }
    109109
    110110  void GlpkBase::_eraseColId(int i) {
    111     cols.eraseIndex(i);
    112     cols.shiftIndices(i);
     111    _cols.eraseIndex(i);
     112    _cols.shiftIndices(i);
    113113  }
    114114
    115115  void GlpkBase::_eraseRowId(int i) {
    116     rows.eraseIndex(i);
    117     rows.shiftIndices(i);
     116    _rows.eraseIndex(i);
     117    _rows.shiftIndices(i);
    118118  }
    119119
    120120  void GlpkBase::_getColName(int c, std::string& name) const {
  • lemon/glpk.h

    diff --git a/lemon/glpk.h b/lemon/glpk.h
    a b  
    141141    _solver_bits::VoidPtr lpx() const {return lp;}
    142142
    143143    ///Returns the constraint identifier understood by GLPK.
    144     int lpxRow(Row r) const { return rows(id(r)); }
     144    int lpxRow(Row r) const { return _rows(id(r)); }
    145145
    146146    ///Returns the variable identifier understood by GLPK.
    147     int lpxCol(Col c) const { return cols(id(c)); }
     147    int lpxCol(Col c) const { return _cols(id(c)); }
    148148
    149149#ifdef DOXYGEN
    150150    /// Write the problem or the solution to a file in the given format
  • lemon/lp_base.h

    diff --git a/lemon/lp_base.h b/lemon/lp_base.h
    a b  
    3131#include<lemon/core.h>
    3232#include<lemon/bits/solver_bits.h>
    3333
     34#include<lemon/bits/stl_iterators.h>
     35
    3436///\file
    3537///\brief The interface of the LP solver interface.
    3638///\ingroup lp_group
     
    4547
    4648  protected:
    4749
    48     _solver_bits::VarIndex rows;
    49     _solver_bits::VarIndex cols;
     50    _solver_bits::VarIndex _rows;
     51    _solver_bits::VarIndex _cols;
    5052
    5153  public:
    5254
     
    166168      ///
    167169      ColIt(const LpBase &solver) : _solver(&solver)
    168170      {
    169         _solver->cols.firstItem(_id);
     171        _solver->_cols.firstItem(_id);
    170172      }
    171173      /// Invalid constructor \& conversion
    172174
     
    179181      ///
    180182      ColIt &operator++()
    181183      {
    182         _solver->cols.nextItem(_id);
     184        _solver->_cols.nextItem(_id);
    183185        return *this;
    184186      }
    185187    };
    186188
     189    /// \brief Gets the collection of the columns of the LP problem.
     190    ///
     191    /// This function can be used for iterating on
     192    /// the columns of the LP problem. It returns a wrapped ColIt, which looks
     193    /// like an STL container (by having begin() and end())
     194    /// which you can use in range-based for loops, stl algorithms, etc.
     195    /// For example you can write:
     196    ///\code
     197    /// for(auto c: lp.cols())
     198    ///   doSomething(c);
     199    LemonRangeWrapper1<ColIt, LpBase> cols() {
     200      return LemonRangeWrapper1<ColIt, LpBase>(*this);
     201    }
     202
     203
    187204    /// \brief Returns the ID of the column.
    188205    static int id(const Col& col) { return col._id; }
    189206    /// \brief Returns the column with the given ID.
     
    261278      ///
    262279      RowIt(const LpBase &solver) : _solver(&solver)
    263280      {
    264         _solver->rows.firstItem(_id);
     281        _solver->_rows.firstItem(_id);
    265282      }
    266283      /// Invalid constructor \& conversion
    267284
     
    274291      ///
    275292      RowIt &operator++()
    276293      {
    277         _solver->rows.nextItem(_id);
     294        _solver->_rows.nextItem(_id);
    278295        return *this;
    279296      }
    280297    };
     298   
     299    /// \brief Gets the collection of the rows of the LP problem.
     300    ///
     301    /// This function can be used for iterating on
     302    /// the rows of the LP problem. It returns a wrapped RowIt, which looks
     303    /// like an STL container (by having begin() and end())
     304    /// which you can use in range-based for loops, stl algorithms, etc.
     305    /// For example you can write:
     306    ///\code
     307    /// for(auto c: lp.rows())
     308    ///   doSomething(c);
     309    LemonRangeWrapper1<RowIt, LpBase> rows() {
     310      return LemonRangeWrapper1<RowIt, LpBase>(*this);
     311    }
     312   
    281313
    282314    /// \brief Returns the ID of the row.
    283315    static int id(const Row& row) { return row._id; }
     
    934966
    935967    //Abstract virtual functions
    936968
    937     virtual int _addColId(int col) { return cols.addIndex(col); }
    938     virtual int _addRowId(int row) { return rows.addIndex(row); }
     969    virtual int _addColId(int col) { return _cols.addIndex(col); }
     970    virtual int _addRowId(int row) { return _rows.addIndex(row); }
    939971
    940     virtual void _eraseColId(int col) { cols.eraseIndex(col); }
    941     virtual void _eraseRowId(int row) { rows.eraseIndex(row); }
     972    virtual void _eraseColId(int col) { _cols.eraseIndex(col); }
     973    virtual void _eraseRowId(int row) { _rows.eraseIndex(row); }
    942974
    943975    virtual int _addCol() = 0;
    944976    virtual int _addRow() = 0;
     
    10031035    //Constant component of the objective function
    10041036    Value obj_const_comp;
    10051037
    1006     LpBase() : rows(), cols(), obj_const_comp(0) {}
     1038    LpBase() : _rows(), _cols(), obj_const_comp(0) {}
    10071039
    10081040  public:
    10091041
     
    11151147    ///a better one.
    11161148    void col(Col c, const DualExpr &e) {
    11171149      e.simplify();
    1118       _setColCoeffs(cols(id(c)), ExprIterator(e.comps.begin(), rows),
    1119                     ExprIterator(e.comps.end(), rows));
     1150      _setColCoeffs(_cols(id(c)), ExprIterator(e.comps.begin(), _rows),
     1151                    ExprIterator(e.comps.end(), _rows));
    11201152    }
    11211153
    11221154    ///Get a column (i.e a dual constraint) of the LP
     
    11251157    ///\return the dual expression associated to the column
    11261158    DualExpr col(Col c) const {
    11271159      DualExpr e;
    1128       _getColCoeffs(cols(id(c)), InsertIterator(e.comps, rows));
     1160      _getColCoeffs(_cols(id(c)), InsertIterator(e.comps, _rows));
    11291161      return e;
    11301162    }
    11311163
     
    12121244    ///\param u is the upper bound (\ref INF means no bound)
    12131245    void row(Row r, Value l, const Expr &e, Value u) {
    12141246      e.simplify();
    1215       _setRowCoeffs(rows(id(r)), ExprIterator(e.comps.begin(), cols),
    1216                     ExprIterator(e.comps.end(), cols));
    1217       _setRowLowerBound(rows(id(r)),l - *e);
    1218       _setRowUpperBound(rows(id(r)),u - *e);
     1247      _setRowCoeffs(_rows(id(r)), ExprIterator(e.comps.begin(), _cols),
     1248                    ExprIterator(e.comps.end(), _cols));
     1249      _setRowLowerBound(_rows(id(r)),l - *e);
     1250      _setRowUpperBound(_rows(id(r)),u - *e);
    12191251    }
    12201252
    12211253    ///Set a row (i.e a constraint) of the LP
     
    12341266    ///\return the expression associated to the row
    12351267    Expr row(Row r) const {
    12361268      Expr e;
    1237       _getRowCoeffs(rows(id(r)), InsertIterator(e.comps, cols));
     1269      _getRowCoeffs(_rows(id(r)), InsertIterator(e.comps, _cols));
    12381270      return e;
    12391271    }
    12401272
     
    12471279    Row addRow(Value l,const Expr &e, Value u) {
    12481280      Row r;
    12491281      e.simplify();
    1250       r._id = _addRowId(_addRow(l - *e, ExprIterator(e.comps.begin(), cols),
    1251                                 ExprIterator(e.comps.end(), cols), u - *e));
     1282      r._id = _addRowId(_addRow(l - *e, ExprIterator(e.comps.begin(), _cols),
     1283                                ExprIterator(e.comps.end(), _cols), u - *e));
    12521284      return r;
    12531285    }
    12541286
     
    12601292      Row r;
    12611293      c.expr().simplify();
    12621294      r._id = _addRowId(_addRow(c.lowerBounded()?c.lowerBound()-*c.expr():-INF,
    1263                                 ExprIterator(c.expr().comps.begin(), cols),
    1264                                 ExprIterator(c.expr().comps.end(), cols),
     1295                                ExprIterator(c.expr().comps.begin(), _cols),
     1296                                ExprIterator(c.expr().comps.end(), _cols),
    12651297                                c.upperBounded()?c.upperBound()-*c.expr():INF));
    12661298      return r;
    12671299    }
     
    12691301
    12701302    ///\param c is the column to be deleted
    12711303    void erase(Col c) {
    1272       _eraseCol(cols(id(c)));
    1273       _eraseColId(cols(id(c)));
     1304      _eraseCol(_cols(id(c)));
     1305      _eraseColId(_cols(id(c)));
    12741306    }
    12751307    ///Erase a row (i.e a constraint) from the LP
    12761308
    12771309    ///\param r is the row to be deleted
    12781310    void erase(Row r) {
    1279       _eraseRow(rows(id(r)));
    1280       _eraseRowId(rows(id(r)));
     1311      _eraseRow(_rows(id(r)));
     1312      _eraseRowId(_rows(id(r)));
    12811313    }
    12821314
    12831315    /// Get the name of a column
     
    12861318    ///\return The name of the colunm
    12871319    std::string colName(Col c) const {
    12881320      std::string name;
    1289       _getColName(cols(id(c)), name);
     1321      _getColName(_cols(id(c)), name);
    12901322      return name;
    12911323    }
    12921324
     
    12951327    ///\param c is the coresponding column
    12961328    ///\param name The name to be given
    12971329    void colName(Col c, const std::string& name) {
    1298       _setColName(cols(id(c)), name);
     1330      _setColName(_cols(id(c)), name);
    12991331    }
    13001332
    13011333    /// Get the column by its name
     
    13041336    ///\return the proper column or \c INVALID
    13051337    Col colByName(const std::string& name) const {
    13061338      int k = _colByName(name);
    1307       return k != -1 ? Col(cols[k]) : Col(INVALID);
     1339      return k != -1 ? Col(_cols[k]) : Col(INVALID);
    13081340    }
    13091341
    13101342    /// Get the name of a row
     
    13131345    ///\return The name of the row
    13141346    std::string rowName(Row r) const {
    13151347      std::string name;
    1316       _getRowName(rows(id(r)), name);
     1348      _getRowName(_rows(id(r)), name);
    13171349      return name;
    13181350    }
    13191351
     
    13221354    ///\param r is the coresponding row
    13231355    ///\param name The name to be given
    13241356    void rowName(Row r, const std::string& name) {
    1325       _setRowName(rows(id(r)), name);
     1357      _setRowName(_rows(id(r)), name);
    13261358    }
    13271359
    13281360    /// Get the row by its name
     
    13311363    ///\return the proper row or \c INVALID
    13321364    Row rowByName(const std::string& name) const {
    13331365      int k = _rowByName(name);
    1334       return k != -1 ? Row(rows[k]) : Row(INVALID);
     1366      return k != -1 ? Row(_rows[k]) : Row(INVALID);
    13351367    }
    13361368
    13371369    /// Set an element of the coefficient matrix of the LP
     
    13401372    ///\param c is the column of the element to be modified
    13411373    ///\param val is the new value of the coefficient
    13421374    void coeff(Row r, Col c, Value val) {
    1343       _setCoeff(rows(id(r)),cols(id(c)), val);
     1375      _setCoeff(_rows(id(r)),_cols(id(c)), val);
    13441376    }
    13451377
    13461378    /// Get an element of the coefficient matrix of the LP
     
    13491381    ///\param c is the column of the element
    13501382    ///\return the corresponding coefficient
    13511383    Value coeff(Row r, Col c) const {
    1352       return _getCoeff(rows(id(r)),cols(id(c)));
     1384      return _getCoeff(_rows(id(r)),_cols(id(c)));
    13531385    }
    13541386
    13551387    /// Set the lower bound of a column (i.e a variable)
     
    13581390    /// extended number of type Value, i.e. a finite number of type
    13591391    /// Value or -\ref INF.
    13601392    void colLowerBound(Col c, Value value) {
    1361       _setColLowerBound(cols(id(c)),value);
     1393      _setColLowerBound(_cols(id(c)),value);
    13621394    }
    13631395
    13641396    /// Get the lower bound of a column (i.e a variable)
     
    13671399    /// (this might be -\ref INF as well).
    13681400    ///\return The lower bound for column \c c
    13691401    Value colLowerBound(Col c) const {
    1370       return _getColLowerBound(cols(id(c)));
     1402      return _getColLowerBound(_cols(id(c)));
    13711403    }
    13721404
    13731405    ///\brief Set the lower bound of  several columns
     
    14131445    /// extended number of type Value, i.e. a finite number of type
    14141446    /// Value or \ref INF.
    14151447    void colUpperBound(Col c, Value value) {
    1416       _setColUpperBound(cols(id(c)),value);
     1448      _setColUpperBound(_cols(id(c)),value);
    14171449    };
    14181450
    14191451    /// Get the upper bound of a column (i.e a variable)
     
    14221454    /// (this might be \ref INF as well).
    14231455    /// \return The upper bound for column \c c
    14241456    Value colUpperBound(Col c) const {
    1425       return _getColUpperBound(cols(id(c)));
     1457      return _getColUpperBound(_cols(id(c)));
    14261458    }
    14271459
    14281460    ///\brief Set the upper bound of  several columns
     
    14691501    /// extended number of type Value, i.e. a finite number of type
    14701502    /// Value, -\ref INF or \ref INF.
    14711503    void colBounds(Col c, Value lower, Value upper) {
    1472       _setColLowerBound(cols(id(c)),lower);
    1473       _setColUpperBound(cols(id(c)),upper);
     1504      _setColLowerBound(_cols(id(c)),lower);
     1505      _setColUpperBound(_cols(id(c)),upper);
    14741506    }
    14751507
    14761508    ///\brief Set the lower and the upper bound of several columns
     
    15151547    /// extended number of type Value, i.e. a finite number of type
    15161548    /// Value or -\ref INF.
    15171549    void rowLowerBound(Row r, Value value) {
    1518       _setRowLowerBound(rows(id(r)),value);
     1550      _setRowLowerBound(_rows(id(r)),value);
    15191551    }
    15201552
    15211553    /// Get the lower bound of a row (i.e a constraint)
     
    15241556    /// (this might be -\ref INF as well).
    15251557    ///\return The lower bound for row \c r
    15261558    Value rowLowerBound(Row r) const {
    1527       return _getRowLowerBound(rows(id(r)));
     1559      return _getRowLowerBound(_rows(id(r)));
    15281560    }
    15291561
    15301562    /// Set the upper bound of a row (i.e a constraint)
     
    15331565    /// extended number of type Value, i.e. a finite number of type
    15341566    /// Value or -\ref INF.
    15351567    void rowUpperBound(Row r, Value value) {
    1536       _setRowUpperBound(rows(id(r)),value);
     1568      _setRowUpperBound(_rows(id(r)),value);
    15371569    }
    15381570
    15391571    /// Get the upper bound of a row (i.e a constraint)
     
    15421574    /// (this might be -\ref INF as well).
    15431575    ///\return The upper bound for row \c r
    15441576    Value rowUpperBound(Row r) const {
    1545       return _getRowUpperBound(rows(id(r)));
     1577      return _getRowUpperBound(_rows(id(r)));
    15461578    }
    15471579
    15481580    ///Set an element of the objective function
    1549     void objCoeff(Col c, Value v) {_setObjCoeff(cols(id(c)),v); };
     1581    void objCoeff(Col c, Value v) {_setObjCoeff(_cols(id(c)),v); };
    15501582
    15511583    ///Get an element of the objective function
    1552     Value objCoeff(Col c) const { return _getObjCoeff(cols(id(c))); };
     1584    Value objCoeff(Col c) const { return _getObjCoeff(_cols(id(c))); };
    15531585
    15541586    ///Set the objective function
    15551587
    15561588    ///\param e is a linear expression of type \ref Expr.
    15571589    ///
    15581590    void obj(const Expr& e) {
    1559       _setObjCoeffs(ExprIterator(e.comps.begin(), cols),
    1560                     ExprIterator(e.comps.end(), cols));
     1591      _setObjCoeffs(ExprIterator(e.comps.begin(), _cols),
     1592                    ExprIterator(e.comps.end(), _cols));
    15611593      obj_const_comp = *e;
    15621594    }
    15631595
     
    15671599    ///Expr.
    15681600    Expr obj() const {
    15691601      Expr e;
    1570       _getObjCoeffs(InsertIterator(e.comps, cols));
     1602      _getObjCoeffs(InsertIterator(e.comps, _cols));
    15711603      *e = obj_const_comp;
    15721604      return e;
    15731605    }
     
    15861618    void min() { _setSense(MIN); }
    15871619
    15881620    ///Clear the problem
    1589     void clear() { _clear(); rows.clear(); cols.clear(); }
     1621    void clear() { _clear(); _rows.clear(); _cols.clear(); }
    15901622
    15911623    /// Set the message level of the solver
    15921624    void messageLevel(MessageLevel level) { _messageLevel(level); }
     
    19291961
    19301962    /// Return the primal value of the column.
    19311963    /// \pre The problem is solved.
    1932     Value primal(Col c) const { return _getPrimal(cols(id(c))); }
     1964    Value primal(Col c) const { return _getPrimal(_cols(id(c))); }
    19331965
    19341966    /// Return the primal value of the expression
    19351967
     
    19561988    /// \pre The problem is solved and the dual problem is infeasible.
    19571989    /// \note Some solvers does not provide primal ray calculation
    19581990    /// functions.
    1959     Value primalRay(Col c) const { return _getPrimalRay(cols(id(c))); }
     1991    Value primalRay(Col c) const { return _getPrimalRay(_cols(id(c))); }
    19601992
    19611993    /// Return the dual value of the row
    19621994
    19631995    /// Return the dual value of the row.
    19641996    /// \pre The problem is solved.
    1965     Value dual(Row r) const { return _getDual(rows(id(r))); }
     1997    Value dual(Row r) const { return _getDual(_rows(id(r))); }
    19661998
    19671999    /// Return the dual value of the dual expression
    19682000
     
    19902022    /// \pre The problem is solved and the primal problem is infeasible.
    19912023    /// \note Some solvers does not provide dual ray calculation
    19922024    /// functions.
    1993     Value dualRay(Row r) const { return _getDualRay(rows(id(r))); }
     2025    Value dualRay(Row r) const { return _getDualRay(_rows(id(r))); }
    19942026
    19952027    /// Return the basis status of the column
    19962028
    19972029    /// \see VarStatus
    1998     VarStatus colStatus(Col c) const { return _getColStatus(cols(id(c))); }
     2030    VarStatus colStatus(Col c) const { return _getColStatus(_cols(id(c))); }
    19992031
    20002032    /// Return the basis status of the row
    20012033
    20022034    /// \see VarStatus
    2003     VarStatus rowStatus(Row r) const { return _getRowStatus(rows(id(r))); }
     2035    VarStatus rowStatus(Row r) const { return _getRowStatus(_rows(id(r))); }
    20042036
    20052037    ///The value of the objective function
    20062038
     
    20802112    ///Sets the type of the given column to the given type.
    20812113    ///
    20822114    void colType(Col c, ColTypes col_type) {
    2083       _setColType(cols(id(c)),col_type);
     2115      _setColType(_cols(id(c)),col_type);
    20842116    }
    20852117
    20862118    ///Gives back the type of the column.
     
    20882120    ///Gives back the type of the column.
    20892121    ///
    20902122    ColTypes colType(Col c) const {
    2091       return _getColType(cols(id(c)));
     2123      return _getColType(_cols(id(c)));
    20922124    }
    20932125    ///@}
    20942126
     
    21052137
    21062138    ///  Return the value of the row in the solution.
    21072139    /// \pre The problem is solved.
    2108     Value sol(Col c) const { return _getSol(cols(id(c))); }
     2140    Value sol(Col c) const { return _getSol(_cols(id(c))); }
    21092141
    21102142    /// Return the value of the expression in the solution
    21112143
  • lemon/soplex.cc

    diff --git a/lemon/soplex.cc b/lemon/soplex.cc
    a b  
    3737  }
    3838
    3939  SoplexLp::SoplexLp(const SoplexLp& lp) {
    40     rows = lp.rows;
    41     cols = lp.cols;
     40    _rows = lp._rows;
     41    _cols = lp._cols;
    4242
    4343    soplex = new soplex::SoPlex;
    4444    (*static_cast<soplex::SPxLP*>(soplex)) = *(lp.soplex);
     
    122122  }
    123123
    124124  void SoplexLp::_eraseColId(int i) {
    125     cols.eraseIndex(i);
    126     cols.relocateIndex(i, cols.maxIndex());
     125    _cols.eraseIndex(i);
     126    _cols.relocateIndex(i, _cols.maxIndex());
    127127  }
    128128  void SoplexLp::_eraseRowId(int i) {
    129     rows.eraseIndex(i);
    130     rows.relocateIndex(i, rows.maxIndex());
     129    _rows.eraseIndex(i);
     130    _rows.relocateIndex(i, _rows.maxIndex());
    131131  }
    132132
    133133  void SoplexLp::_getColName(int c, std::string &name) const {
     
    432432    _col_names_ref.clear();
    433433    _row_names.clear();
    434434    _row_names_ref.clear();
    435     cols.clear();
    436     rows.clear();
     435    _cols.clear();
     436    _rows.clear();
    437437    _clear_temporals();
    438438  }
    439439