max() [_setMax()], min() [_setMin()], primalValue() [_getPrimalValue()] added
authoralpar
Thu, 07 Apr 2005 06:31:03 +0000
changeset 131248f9299b390d
parent 1311 b810a07248a0
child 1313 96b74270c3a1
max() [_setMax()], min() [_setMin()], primalValue() [_getPrimalValue()] added
src/lemon/lp_base.h
src/lemon/lp_glpk.cc
src/lemon/lp_glpk.h
src/lemon/lp_solver_skeleton.cc
src/lemon/lp_solver_skeleton.h
     1.1 --- a/src/lemon/lp_base.h	Wed Apr 06 17:19:54 2005 +0000
     1.2 +++ b/src/lemon/lp_base.h	Thu Apr 07 06:31:03 2005 +0000
     1.3 @@ -392,8 +392,11 @@
     1.4      virtual void _setObjCoeff(int i, Value obj_coef) = 0;
     1.5      virtual SolveExitStatus _solve() = 0;
     1.6      virtual Value _getPrimal(int i) = 0;
     1.7 -    virtual SolutionStatus _getPrimalType() = 0;
     1.8 -
     1.9 +    virtual Value _getPrimalValue() = 0;
    1.10 +    virtual SolutionStatus _getPrimalStatus() = 0;
    1.11 +    virtual void _setMax() = 0;
    1.12 +    virtual void _setMin() = 0;
    1.13 +    
    1.14  
    1.15      void clearObj() {}
    1.16    public:
    1.17 @@ -427,7 +430,7 @@
    1.18      ///\ref Col as its \c mapped_type
    1.19      ///like
    1.20      ///\code
    1.21 -    ///std::map<AnyType,LpSolverBase::Col>
    1.22 +    ///std::map<AnyStatus,LpSolverBase::Col>
    1.23      ///\endcode
    1.24      ///- an iterable lemon \ref concept::WriteMap "write map" like 
    1.25      ///\code
    1.26 @@ -606,6 +609,12 @@
    1.27  	objCoeff((*i).first,(*i).second);
    1.28      }
    1.29  
    1.30 +    ///Maximize
    1.31 +    void max() { _setMax(); }
    1.32 +    ///Minimize
    1.33 +    void min() { _setMin(); }
    1.34 +
    1.35 +    
    1.36      ///@}
    1.37  
    1.38  
    1.39 @@ -623,13 +632,21 @@
    1.40      ///@{
    1.41  
    1.42      ///\e
    1.43 -    SolutionStatus primalType() {
    1.44 -      return _getPrimalType();
    1.45 +    SolutionStatus primalStatus() {
    1.46 +      return _getPrimalStatus();
    1.47      }
    1.48  
    1.49      ///\e
    1.50      Value primal(Col c) { return _getPrimal(cols.floatingId(c.id)); }
    1.51  
    1.52 +    ///\e
    1.53 +
    1.54 +    ///\return
    1.55 +    ///- \ref INF or -\ref INF means either infeasibility or unboundedness
    1.56 +    /// of the primal problem, depending on whether we minimize or maximize.
    1.57 +    ///- \ref NAN if no primal solution is found.
    1.58 +    ///- The (finite) objective value if an optimal solution is found.
    1.59 +    Value primalValue() { return _getPrimalValue();}
    1.60      ///@}
    1.61      
    1.62    };  
     2.1 --- a/src/lemon/lp_glpk.cc	Wed Apr 06 17:19:54 2005 +0000
     2.2 +++ b/src/lemon/lp_glpk.cc	Thu Apr 07 06:31:03 2005 +0000
     2.3 @@ -255,8 +255,13 @@
     2.4      return lpx_get_col_prim(lp,i);
     2.5    }
     2.6    
     2.7 +  LpGlpk::Value LpGlpk::_getPrimalValue()
     2.8 +  {
     2.9 +    return 0;
    2.10 +  }
    2.11 +  
    2.12   
    2.13 -  LpGlpk::SolutionStatus LpGlpk::_getPrimalType()
    2.14 +  LpGlpk::SolutionStatus LpGlpk::_getPrimalStatus()
    2.15    {
    2.16      int stat=  lpx_get_status(lp);
    2.17      switch (stat) {
    2.18 @@ -283,6 +288,14 @@
    2.19    }
    2.20  
    2.21  
    2.22 +  void LpGlpk::_setMax()
    2.23 +  {
    2.24 +  }
    2.25 +  void LpGlpk::_setMin()
    2.26 +  {
    2.27 +  }
    2.28 +
    2.29 + 
    2.30  } //END OF NAMESPACE LEMON
    2.31  
    2.32  #endif //LEMON_LP_GLPK_CC
     3.1 --- a/src/lemon/lp_glpk.h	Wed Apr 06 17:19:54 2005 +0000
     3.2 +++ b/src/lemon/lp_glpk.h	Thu Apr 07 06:31:03 2005 +0000
     3.3 @@ -80,8 +80,24 @@
     3.4      
     3.5      ///\bug Unimplemented
     3.6      ///
     3.7 -    virtual SolutionStatus _getPrimalType();
     3.8 +    virtual Value _getPrimalValue();
     3.9 +    ///\e
    3.10 +    
    3.11 +    ///\bug Unimplemented
    3.12 +    ///
    3.13 +    virtual SolutionStatus _getPrimalStatus();
    3.14  
    3.15 +    ///\e
    3.16 +    
    3.17 +    ///\bug Unimplemented
    3.18 +    ///
    3.19 +    virtual void _setMax();
    3.20 +    ///\e
    3.21 +    
    3.22 +    ///\bug Unimplemented
    3.23 +    ///
    3.24 +    virtual void _setMin();
    3.25 +  
    3.26    };
    3.27  } //END OF NAMESPACE LEMON
    3.28  
     4.1 --- a/src/lemon/lp_solver_skeleton.cc	Wed Apr 06 17:19:54 2005 +0000
     4.2 +++ b/src/lemon/lp_solver_skeleton.cc	Thu Apr 07 06:31:03 2005 +0000
     4.3 @@ -65,6 +65,13 @@
     4.4    {
     4.5    }
     4.6  
     4.7 +  void LpSolverSkeleton::_setMax()
     4.8 +  {
     4.9 +  }
    4.10 +  void LpSolverSkeleton::_setMin()
    4.11 +  {
    4.12 +  }
    4.13 +
    4.14    LpSolverSkeleton::SolveExitStatus LpSolverSkeleton::_solve()
    4.15    {
    4.16      return SOLVED;
    4.17 @@ -75,7 +82,12 @@
    4.18      return 0;
    4.19    }
    4.20    
    4.21 -  LpSolverSkeleton::SolutionStatus LpSolverSkeleton::_getPrimalType()
    4.22 +  LpSolverSkeleton::Value LpSolverSkeleton::_getPrimalValue()
    4.23 +  {
    4.24 +    return 0;
    4.25 +  }
    4.26 +  
    4.27 +  LpSolverSkeleton::SolutionStatus LpSolverSkeleton::_getPrimalStatus()
    4.28    {
    4.29      return OPTIMAL;
    4.30    }
     5.1 --- a/src/lemon/lp_solver_skeleton.h	Wed Apr 06 17:19:54 2005 +0000
     5.2 +++ b/src/lemon/lp_solver_skeleton.h	Thu Apr 07 06:31:03 2005 +0000
     5.3 @@ -93,7 +93,18 @@
     5.4  
     5.5      ///\bug Wrong interface
     5.6      ///
     5.7 -    virtual SolutionStatus _getPrimalType();
     5.8 +    virtual Value _getPrimalValue();
     5.9 +    ///\e
    5.10 +
    5.11 +    ///\bug Wrong interface
    5.12 +    ///
    5.13 +    virtual SolutionStatus _getPrimalStatus();
    5.14 +
    5.15 +    ///\e
    5.16 +    virtual void _setMax();
    5.17 +    ///\e
    5.18 +    virtual void _setMin();
    5.19 +    
    5.20  
    5.21    public:
    5.22      LpSolverSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}