# HG changeset patch # User athos # Date 1156954083 0 # Node ID e2bf51eab7f73d5e89f36e322d73a311f44b99ed # Parent 05a5e48010ab6fc0fd41f11bb3cd7c0c5ec7c27d Fixed the mip error (mipstatus was incorrect). diff -r 05a5e48010ab -r e2bf51eab7f7 lemon/lp_base.h --- a/lemon/lp_base.h Mon Aug 28 16:11:02 2006 +0000 +++ b/lemon/lp_base.h Wed Aug 30 16:08:03 2006 +0000 @@ -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; }; diff -r 05a5e48010ab -r e2bf51eab7f7 lemon/mip_glpk.cc --- a/lemon/mip_glpk.cc Mon Aug 28 16:11:02 2006 +0000 +++ b/lemon/mip_glpk.cc Wed Aug 30 16:08:03 2006 +0000 @@ -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); } diff -r 05a5e48010ab -r e2bf51eab7f7 lemon/mip_glpk.h --- a/lemon/mip_glpk.h Mon Aug 28 16:11:02 2006 +0000 +++ b/lemon/mip_glpk.h Wed Aug 30 16:08:03 2006 +0000 @@ -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(); };