[Lemon-commits] [lemon_svn] alpar: r1751 - hugo/trunk/src/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:47:20 CET 2006
Author: alpar
Date: Thu Apr 7 08:31:03 2005
New Revision: 1751
Modified:
hugo/trunk/src/lemon/lp_base.h
hugo/trunk/src/lemon/lp_glpk.cc
hugo/trunk/src/lemon/lp_glpk.h
hugo/trunk/src/lemon/lp_solver_skeleton.cc
hugo/trunk/src/lemon/lp_solver_skeleton.h
Log:
max() [_setMax()], min() [_setMin()], primalValue() [_getPrimalValue()] added
Modified: hugo/trunk/src/lemon/lp_base.h
==============================================================================
--- hugo/trunk/src/lemon/lp_base.h (original)
+++ hugo/trunk/src/lemon/lp_base.h Thu Apr 7 08:31:03 2005
@@ -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<AnyType,LpSolverBase::Col>
+ ///std::map<AnyStatus,LpSolverBase::Col>
///\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();}
///@}
};
Modified: hugo/trunk/src/lemon/lp_glpk.cc
==============================================================================
--- hugo/trunk/src/lemon/lp_glpk.cc (original)
+++ hugo/trunk/src/lemon/lp_glpk.cc Thu Apr 7 08:31:03 2005
@@ -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
Modified: hugo/trunk/src/lemon/lp_glpk.h
==============================================================================
--- hugo/trunk/src/lemon/lp_glpk.h (original)
+++ hugo/trunk/src/lemon/lp_glpk.h Thu Apr 7 08:31:03 2005
@@ -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
Modified: hugo/trunk/src/lemon/lp_solver_skeleton.cc
==============================================================================
--- hugo/trunk/src/lemon/lp_solver_skeleton.cc (original)
+++ hugo/trunk/src/lemon/lp_solver_skeleton.cc Thu Apr 7 08:31:03 2005
@@ -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;
}
Modified: hugo/trunk/src/lemon/lp_solver_skeleton.h
==============================================================================
--- hugo/trunk/src/lemon/lp_solver_skeleton.h (original)
+++ hugo/trunk/src/lemon/lp_solver_skeleton.h Thu Apr 7 08:31:03 2005
@@ -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) {}
More information about the Lemon-commits
mailing list