COIN-OR::LEMON - Graph Library

Changeset 1323:3aaadfb7de3d in lemon-0.x


Ignore:
Timestamp:
04/08/05 08:46:12 (15 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1762
Message:

The case when the objective function contains a const component is handled
correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/lp_base.h

    r1312 r1323  
    102102  ///Common base class for LP solvers
    103103  class LpSolverBase {
    104    
     104
    105105  public:
    106106
     
    376376    _FixId cols;
    377377
     378    //Abstract virtual functions
    378379    virtual int _addCol() = 0;
    379380    virtual int _addRow() = 0;
     
    398399    virtual void _setMin() = 0;
    399400   
    400 
     401    //Own protected stuff
     402   
     403    //Constant component of the objective function
     404    Value obj_const_comp;
     405   
     406    ///\e
     407   
     408    ///\bug Unimplemented
    401409    void clearObj() {}
     410   
    402411  public:
    403412
     413    ///\e
     414    LpSolverBase() : obj_const_comp(0) {}
    404415
    405416    ///\e
     
    603614   
    604615    ///\param e is a linear expression of type \ref Expr.
    605     ///\todo What to do with the constant component?
     616    ///\bug The previous objective function is not cleared!
    606617    void setObj(Expr e) {
    607618      clearObj();
    608619      for (Expr::iterator i=e.begin(); i!=e.end(); ++i)
    609620        objCoeff((*i).first,(*i).second);
     621      obj_const_comp=e.constComp();
    610622    }
    611623
     
    647659    ///- \ref NAN if no primal solution is found.
    648660    ///- The (finite) objective value if an optimal solution is found.
    649     Value primalValue() { return _getPrimalValue();}
     661    Value primalValue() { return _getPrimalValue()+obj_const_comp;}
    650662    ///@}
    651663   
Note: See TracChangeset for help on using the changeset viewer.