[Lemon-commits] [lemon_svn] athos: r2906 - hugo/trunk/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 21:51:10 CET 2006
Author: athos
Date: Wed Aug 30 18:08:03 2006
New Revision: 2906
Modified:
hugo/trunk/lemon/lp_base.h
hugo/trunk/lemon/mip_glpk.cc
hugo/trunk/lemon/mip_glpk.h
Log:
Fixed the mip error (mipstatus was incorrect).
Modified: hugo/trunk/lemon/lp_base.h
==============================================================================
--- hugo/trunk/lemon/lp_base.h (original)
+++ hugo/trunk/lemon/lp_base.h Wed Aug 30 18:08:03 2006
@@ -121,7 +121,7 @@
///\e
enum SolutionStatus {
- ///Feasible solution has'n been found (but may exist).
+ ///Feasible solution hasn't been found (but may exist).
///\todo NOTFOUND might be a better name.
///
@@ -1205,10 +1205,16 @@
return (colType(c)==INTEGER);
}
+ /// The status of the MIP problem
+ SolutionStatus mipStatus() {
+ return _getMipStatus();
+ }
+
protected:
virtual ColTypes _colType(int col) = 0;
virtual void _colType(int col, ColTypes col_type) = 0;
+ virtual SolutionStatus _getMipStatus()=0;
};
Modified: hugo/trunk/lemon/mip_glpk.cc
==============================================================================
--- hugo/trunk/lemon/mip_glpk.cc (original)
+++ hugo/trunk/lemon/mip_glpk.cc Wed Aug 30 18:08:03 2006
@@ -69,7 +69,30 @@
return UNSOLVED;
}
}
-
+
+
+ LpGlpk::SolutionStatus MipGlpk::_getMipStatus(){
+
+ //Meg kell nezni: ha az LP is infinite, akkor ez is, ha az is
+ //infeasible, akkor ez is, de ez lehet maskepp is infeasible.
+ int stat= lpx_mip_status(lp);
+ switch (stat) {
+ case LPX_I_UNDEF://Undefined (no solve has been run yet)
+ return UNDEFINED;
+ case LPX_I_NOFEAS://There is no feasible integral solution (primal, I guess)
+ return INFEASIBLE;
+// case LPX_UNBND://Unbounded
+// return INFINITE;
+ case LPX_I_FEAS://Feasible
+ return FEASIBLE;
+ case LPX_I_OPT://Feasible
+ return OPTIMAL;
+ default:
+ return UNDEFINED; //to avoid gcc warning
+ //FIXME error
+ }
+ }
+
MipGlpk::Value MipGlpk::_getPrimal(int i){
return lpx_mip_col_val(lp,i);
}
Modified: hugo/trunk/lemon/mip_glpk.h
==============================================================================
--- hugo/trunk/lemon/mip_glpk.h (original)
+++ hugo/trunk/lemon/mip_glpk.h Wed Aug 30 18:08:03 2006
@@ -49,6 +49,7 @@
virtual void _colType(int col, ColTypes col_type);
virtual LpGlpk::SolveExitStatus _solve();
+ virtual LpGlpk::SolutionStatus _getMipStatus();
virtual ParentLp::Value _getPrimal(int i);
virtual ParentLp::Value _getPrimalValue();
};
More information about the Lemon-commits
mailing list