# HG changeset patch # User alpar # Date 1112855463 0 # Node ID 48f9299b390d145d363628e04368cc1bff309336 # Parent b810a07248a00a6a8b41d7ea3306542672807d67 max() [_setMax()], min() [_setMin()], primalValue() [_getPrimalValue()] added diff -r b810a07248a0 -r 48f9299b390d src/lemon/lp_base.h --- a/src/lemon/lp_base.h Wed Apr 06 17:19:54 2005 +0000 +++ b/src/lemon/lp_base.h Thu Apr 07 06:31:03 2005 +0000 @@ -392,8 +392,11 @@ virtual void _setObjCoeff(int i, Value obj_coef) = 0; virtual SolveExitStatus _solve() = 0; virtual Value _getPrimal(int i) = 0; - virtual SolutionStatus _getPrimalType() = 0; - + virtual Value _getPrimalValue() = 0; + virtual SolutionStatus _getPrimalStatus() = 0; + virtual void _setMax() = 0; + virtual void _setMin() = 0; + void clearObj() {} public: @@ -427,7 +430,7 @@ ///\ref Col as its \c mapped_type ///like ///\code - ///std::map + ///std::map ///\endcode ///- an iterable lemon \ref concept::WriteMap "write map" like ///\code @@ -606,6 +609,12 @@ objCoeff((*i).first,(*i).second); } + ///Maximize + void max() { _setMax(); } + ///Minimize + void min() { _setMin(); } + + ///@} @@ -623,13 +632,21 @@ ///@{ ///\e - SolutionStatus primalType() { - return _getPrimalType(); + SolutionStatus primalStatus() { + return _getPrimalStatus(); } ///\e Value primal(Col c) { return _getPrimal(cols.floatingId(c.id)); } + ///\e + + ///\return + ///- \ref INF or -\ref INF means either infeasibility or unboundedness + /// of the primal problem, depending on whether we minimize or maximize. + ///- \ref NAN if no primal solution is found. + ///- The (finite) objective value if an optimal solution is found. + Value primalValue() { return _getPrimalValue();} ///@} }; diff -r b810a07248a0 -r 48f9299b390d src/lemon/lp_glpk.cc --- a/src/lemon/lp_glpk.cc Wed Apr 06 17:19:54 2005 +0000 +++ b/src/lemon/lp_glpk.cc Thu Apr 07 06:31:03 2005 +0000 @@ -255,8 +255,13 @@ return lpx_get_col_prim(lp,i); } + LpGlpk::Value LpGlpk::_getPrimalValue() + { + return 0; + } + - LpGlpk::SolutionStatus LpGlpk::_getPrimalType() + LpGlpk::SolutionStatus LpGlpk::_getPrimalStatus() { int stat= lpx_get_status(lp); switch (stat) { @@ -283,6 +288,14 @@ } + void LpGlpk::_setMax() + { + } + void LpGlpk::_setMin() + { + } + + } //END OF NAMESPACE LEMON #endif //LEMON_LP_GLPK_CC diff -r b810a07248a0 -r 48f9299b390d src/lemon/lp_glpk.h --- a/src/lemon/lp_glpk.h Wed Apr 06 17:19:54 2005 +0000 +++ b/src/lemon/lp_glpk.h Thu Apr 07 06:31:03 2005 +0000 @@ -80,8 +80,24 @@ ///\bug Unimplemented /// - virtual SolutionStatus _getPrimalType(); + virtual Value _getPrimalValue(); + ///\e + + ///\bug Unimplemented + /// + virtual SolutionStatus _getPrimalStatus(); + ///\e + + ///\bug Unimplemented + /// + virtual void _setMax(); + ///\e + + ///\bug Unimplemented + /// + virtual void _setMin(); + }; } //END OF NAMESPACE LEMON diff -r b810a07248a0 -r 48f9299b390d src/lemon/lp_solver_skeleton.cc --- a/src/lemon/lp_solver_skeleton.cc Wed Apr 06 17:19:54 2005 +0000 +++ b/src/lemon/lp_solver_skeleton.cc Thu Apr 07 06:31:03 2005 +0000 @@ -65,6 +65,13 @@ { } + void LpSolverSkeleton::_setMax() + { + } + void LpSolverSkeleton::_setMin() + { + } + LpSolverSkeleton::SolveExitStatus LpSolverSkeleton::_solve() { return SOLVED; @@ -75,7 +82,12 @@ return 0; } - LpSolverSkeleton::SolutionStatus LpSolverSkeleton::_getPrimalType() + LpSolverSkeleton::Value LpSolverSkeleton::_getPrimalValue() + { + return 0; + } + + LpSolverSkeleton::SolutionStatus LpSolverSkeleton::_getPrimalStatus() { return OPTIMAL; } diff -r b810a07248a0 -r 48f9299b390d src/lemon/lp_solver_skeleton.h --- a/src/lemon/lp_solver_skeleton.h Wed Apr 06 17:19:54 2005 +0000 +++ b/src/lemon/lp_solver_skeleton.h Thu Apr 07 06:31:03 2005 +0000 @@ -93,7 +93,18 @@ ///\bug Wrong interface /// - virtual SolutionStatus _getPrimalType(); + virtual Value _getPrimalValue(); + ///\e + + ///\bug Wrong interface + /// + virtual SolutionStatus _getPrimalStatus(); + + ///\e + virtual void _setMax(); + ///\e + virtual void _setMin(); + public: LpSolverSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}