COIN-OR::LEMON - Graph Library

Ticket #203: c8a0d6a69a47.patch

File c8a0d6a69a47.patch, 3.0 KB (added by Alpar Juttner, 10 years ago)
  • lemon/clp.h

    # HG changeset patch
    # User Alpar Juttner <alpar@cs.elte.hu>
    # Date 1232526238 0
    # Node ID c8a0d6a69a47604cc9642aab23a4773dcbc6d754
    # Parent  2eb5c8ca2c919205c0674b905a1e8c3edfaa48ed
    Smarter _addRow() API function (#203)
    
    diff --git a/lemon/clp.h b/lemon/clp.h
    a b  
    7272    virtual const char* _solverName() const;
    7373
    7474    virtual int _addCol();
     75    using LpBase::_addRow;
    7576    virtual int _addRow();
    7677
    7778    virtual void _eraseCol(int i);
  • lemon/glpk.h

    diff --git a/lemon/glpk.h b/lemon/glpk.h
    a b  
    5252  protected:
    5353
    5454    virtual int _addCol();
     55    using LpBase::_addRow;
    5556    virtual int _addRow();
    5657
    5758    virtual void _eraseCol(int i);
  • lemon/lp_base.h

    diff --git a/lemon/lp_base.h b/lemon/lp_base.h
    a b  
    941941    virtual void _setRowName(int row, const std::string& name) = 0;
    942942    virtual int _rowByName(const std::string& name) const = 0;
    943943
     944    virtual int _addRow(ExprIterator b, ExprIterator e){
     945      int i=_addRow();_setRowCoeffs(i, b, e); return i;
     946    };
    944947    virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e) = 0;
    945948    virtual void _getRowCoeffs(int i, InsertIterator b) const = 0;
    946949
     
    11971200    ///\param u is the upper bound (\ref INF means no bound)
    11981201    ///\return The created row.
    11991202    Row addRow(Value l,const Expr &e, Value u) {
    1200       Row r=addRow();
    1201       row(r,l,e,u);
     1203      Row r;     
     1204      e.simplify();
     1205      int id=_addRow(ExprIterator(e.comps.begin(), cols),
     1206                    ExprIterator(e.comps.end(), cols));
     1207      r._id=_addRowId(id);
     1208      _setRowLowerBound(r._id,l - *e);
     1209      _setRowUpperBound(r._id,u - *e);   
    12021210      return r;
    12031211    }
    12041212
     
    12071215    ///\param c is a linear expression (see \ref Constr)
    12081216    ///\return The created row.
    12091217    Row addRow(const Constr &c) {
    1210       Row r=addRow();
    1211       row(r,c);
     1218      Row r=addRow(c.lowerBounded()?c.lowerBound():-INF,
     1219            c.expr(), c.upperBounded()?c.upperBound():INF);
    12121220      return r;
    12131221    }
    12141222    ///Erase a column (i.e a variable) from the LP
  • lemon/lp_skeleton.cc

    diff --git a/lemon/lp_skeleton.cc b/lemon/lp_skeleton.cc
    a b  
    4343  void SkeletonSolverBase::_setRowName(int, const std::string &) {}
    4444  int SkeletonSolverBase::_rowByName(const std::string&) const { return -1; }
    4545
     46  int SkeletonSolverBase::_addRow(ExprIterator, ExprIterator) { return ++row_num; }
    4647  void SkeletonSolverBase::_setRowCoeffs(int, ExprIterator, ExprIterator) {}
    4748  void SkeletonSolverBase::_getRowCoeffs(int, InsertIterator) const {}
    4849
  • lemon/lp_skeleton.h

    diff --git a/lemon/lp_skeleton.h b/lemon/lp_skeleton.h
    a b  
    5858    virtual int _rowByName(const std::string& name) const;
    5959
    6060    /// \e
     61    virtual int _addRow(ExprIterator b, ExprIterator e);
     62    /// \e
    6163    virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e);
    6264    /// \e
    6365    virtual void _getRowCoeffs(int i, InsertIterator b) const;