COIN-OR::LEMON - Graph Library

Changeset 1364:ee5959aa4410 in lemon-0.x for src/lemon


Ignore:
Timestamp:
04/17/05 20:57:22 (19 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1809
Message:
  • compile failure fixed
  • newLp(), copyLp() added
  • more doc.
Location:
src/lemon
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/lp_base.cc

    r1359 r1364  
    2626  LpSolverBase::NaN = std::numeric_limits<Value>::quiet_NaN();
    2727
    28   const LpSolverBase::Constr::Value
    29   LpSolverBase::Constr::INF = std::numeric_limits<Value>::infinity();
    30   const LpSolverBase::Constr::Value
    31   LpSolverBase::Constr::NaN = std::numeric_limits<Value>::quiet_NaN();
     28//   const LpSolverBase::Constr::Value
     29//   LpSolverBase::Constr::INF = std::numeric_limits<Value>::infinity();
     30//   const LpSolverBase::Constr::Value
     31//   LpSolverBase::Constr::NaN = std::numeric_limits<Value>::quiet_NaN();
    3232 
    3333} //namespace lemon
  • src/lemon/lp_base.h

    r1359 r1364  
    199199    ///container.
    200200    ///- Its it fully compatible with \c std::map<Col,double>, so for expamle
    201     ///if \c e is an Expr and \c v and \c w are of type \ref Col then you can
     201    ///if \c e is an Expr and \c v and \c w are of type \ref Col, then you can
    202202    ///read and modify the coefficients like
    203203    ///these.
     
    319319    ///Linear constraint
    320320
    321     ///\todo document please
    322     ///
     321    ///This data stucture represents a linear constraint in the LP.
     322    ///Basically it is a linear expression with a lower or an upper bound
     323    ///(or both). These parts of the constraint can be obtained by the member
     324    ///functions \ref expr(), \ref lowerBound() and \ref upperBound(),
     325    ///respectively.
     326    ///There are two ways to construct a constraint.
     327    ///- You can set the linear expression and the bounds directly
     328    ///  by the functions above.
     329    ///- The operators <tt>\<=</tt>, <tt>==</tt> and  <tt>\>=</tt>
     330    ///  are defined between expressions, or even between constraints whenever
     331    ///  it makes sense. Therefore if \c e and \c f are linear expressions and
     332    ///  \c s and \c t are numbers, then the followings are valid expressions
     333    ///  and thus they can be used directly e.g. in \ref addRow() whenever
     334    ///  it makes sense.
     335    ///  \code
     336    ///  e<=s
     337    ///  e<=f
     338    ///  s<=e<=t
     339    ///  e>=t
     340    ///  \endcode
     341    ///\warning The validity of a constraint is checked only at run time, so
     342    ///e.g. \ref addRow(<tt>x[1]\<=x[2]<=5</tt>) will compile, but will throw a
     343    ///\ref LogicError exception.
    323344    class Constr
    324345    {
     
    328349      typedef Expr::Value Value;
    329350     
    330       static const Value INF;
    331       static const Value NaN;
    332       //     static const Value INF=0;
    333       //     static const Value NaN=1;
    334      
     351//       static const Value INF;
     352//       static const Value NaN;
     353
    335354    protected:
    336355      Expr _expr;
     
    357376        _lb=_ub=NaN;
    358377      }
    359       ///\e
     378
     379      ///Reference to the linear expression
    360380      Expr &expr() { return _expr; }
    361       ///\e
     381      ///Cont reference to the linear expression
    362382      const Expr &expr() const { return _expr; }
    363       ///\e
     383      ///Reference to the lower bound.
     384
     385      ///\return
     386      ///- -\ref INF: the constraint is lower unbounded.
     387      ///- -\ref NaN: lower bound has not been set.
     388      ///- finite number: the lower bound
    364389      Value &lowerBound() { return _lb; }
    365       ///\e
     390      ///The const version of \ref lowerBound()
    366391      const Value &lowerBound() const { return _lb; }
    367       ///\e
     392      ///Reference to the upper bound.
     393
     394      ///\return
     395      ///- -\ref INF: the constraint is upper unbounded.
     396      ///- -\ref NaN: upper bound has not been set.
     397      ///- finite number: the upper bound
    368398      Value &upperBound() { return _ub; }
    369       ///\e
     399      ///The const version of \ref upperBound()
    370400      const Value &upperBound() const { return _ub; }
    371       ///\e
     401      ///Is the constraint lower bounded?
    372402      bool lowerBounded() const {
    373403        using namespace std;
    374404        return isfinite(_lb);
    375405      }
    376       ///\e
     406      ///Is the constraint upper bounded?
    377407      bool upperBounded() const {
    378408        using namespace std;
     
    387417
    388418    //Abstract virtual functions
     419    virtual LpSolverBase &_newLp() = 0;
     420    virtual LpSolverBase &_copyLp() = 0;
     421
    389422    virtual int _addCol() = 0;
    390423    virtual int _addRow() = 0;
     
    427460    virtual ~LpSolverBase() {}
    428461
     462    ///Creates a new LP problem
     463    LpSolverBase &newLp() {return _newLp();}
     464    ///Make a copy of the LP problem
     465    LpSolverBase &copyLp() {return _copyLp();}
     466   
    429467    ///\name Build up and modify of the LP
    430468
     
    452490    ///like
    453491    ///\code
    454     ///std::map<AnyStatus,LpSolverBase::Col>
     492    ///std::map<AnyType,LpSolverBase::Col>
    455493    ///\endcode
    456494    ///- an iterable lemon \ref concept::WriteMap "write map" like
     
    460498    ///\endcode
    461499    ///\return The number of the created column.
    462     ///\bug Iterable nodemap hasn't been implemented yet.
    463500#ifdef DOXYGEN
    464501    template<class T>
     
    669706    ///- \ref INF or -\ref INF means either infeasibility or unboundedness
    670707    /// of the primal problem, depending on whether we minimize or maximize.
    671     ///- \ref NAN if no primal solution is found.
     708    ///- \ref NaN if no primal solution is found.
    672709    ///- The (finite) objective value if an optimal solution is found.
    673710    Value primalValue() { return _getPrimalValue()+obj_const_comp;}
     
    684721  {
    685722    LpSolverBase::Expr tmp(a);
    686     tmp+=b; ///\todo Don't STL have some special 'merge' algorithm?
     723    tmp+=b; ///\todo Doesn't STL have some special 'merge' algorithm?
    687724    return tmp;
    688725  }
     
    695732  {
    696733    LpSolverBase::Expr tmp(a);
    697     tmp-=b; ///\todo Don't STL have some special 'merge' algorithm?
     734    tmp-=b; ///\todo Doesn't STL have some special 'merge' algorithm?
    698735    return tmp;
    699736  }
     
    706743  {
    707744    LpSolverBase::Expr tmp(a);
    708     tmp*=b; ///\todo Don't STL have some special 'merge' algorithm?
     745    tmp*=b; ///\todo Doesn't STL have some special 'merge' algorithm?
    709746    return tmp;
    710747  }
     
    718755  {
    719756    LpSolverBase::Expr tmp(b);
    720     tmp*=a; ///\todo Don't STL have some special 'merge' algorithm?
     757    tmp*=a; ///\todo Doesn't STL have some special 'merge' algorithm?
    721758    return tmp;
    722759  }
     
    729766  {
    730767    LpSolverBase::Expr tmp(a);
    731     tmp/=b; ///\todo Don't STL have some special 'merge' algorithm?
     768    tmp/=b; ///\todo Doesn't STL have some special 'merge' algorithm?
    732769    return tmp;
    733770  }
  • src/lemon/lp_glpk.cc

    r1359 r1364  
    2525namespace lemon {
    2626
     27  ///\e
     28
     29  ///\bug Unimplemented!
     30  ///
     31  LpSolverBase &LpGlpk::_newLp()
     32  {
     33    return *((LpSolverBase *)0);
     34  }
     35 
     36  ///\e
     37
     38  ///\bug Unimplemented!
     39  ///
     40  LpSolverBase &LpGlpk::_copyLp()
     41  {
     42    return *((LpSolverBase *)0);
     43  }
     44
    2745  LpGlpk::LpGlpk() : Parent(),
    2846                     lp(lpx_create_prob()) {
  • src/lemon/lp_glpk.h

    r1359 r1364  
    3232  /// \brief Wrapper for GLPK solver
    3333  ///
    34   /// This class implements a lemon wrapper for GLPK.
     34  /// This class implements an interface for GLPK.
    3535  ///\ingroup gen_opt_group
    3636  class LpGlpk : public LpSolverBase {
     
    4646   
    4747  protected:
     48    virtual LpSolverBase &_newLp();
     49    virtual LpSolverBase &_copyLp();
     50
    4851    virtual int _addCol();
    4952    virtual int _addRow();
  • src/lemon/lp_skeleton.cc

    r1362 r1364  
    2222namespace lemon {
    2323 
     24  LpSolverBase &LpSkeleton::_newLp()
     25  {
     26    return *((LpSolverBase *)0);
     27  }
     28 
     29  LpSolverBase &LpSkeleton::_copyLp()
     30  {
     31    return *((LpSolverBase *)0);
     32  }
     33
    2434  int LpSkeleton::_addCol()
    2535  {
  • src/lemon/lp_skeleton.h

    r1359 r1364  
    3030   
    3131  protected:
     32    ///\e
     33    virtual LpSolverBase &_newLp();
     34    ///\e
     35    virtual LpSolverBase &_copyLp();
    3236    /// \e
    3337    virtual int _addCol();
Note: See TracChangeset for help on using the changeset viewer.