I could not check, because: aclocal-1.7: command not found
authorathos
Thu, 09 Jun 2005 15:03:58 +0000
changeset 14607c58aabb9eea
parent 1459 2ee881cf30a8
child 1461 9f99ede44d59
I could not check, because: aclocal-1.7: command not found
lemon/lp_base.h
lemon/lp_cplex.cc
lemon/lp_cplex.h
lemon/lp_glpk.cc
lemon/lp_glpk.h
lemon/lp_skeleton.cc
lemon/lp_skeleton.h
     1.1 --- a/lemon/lp_base.h	Thu Jun 09 09:49:56 2005 +0000
     1.2 +++ b/lemon/lp_base.h	Thu Jun 09 15:03:58 2005 +0000
     1.3 @@ -118,7 +118,7 @@
     1.4        UNSOLVED = 1
     1.5      };
     1.6        
     1.7 -    ///\e
     1.8 +      ///\e
     1.9      enum SolutionStatus {
    1.10        ///Feasible solution has'n been found (but may exist).
    1.11  
    1.12 @@ -137,6 +137,20 @@
    1.13        ///corresponding bases)
    1.14        INFINITE = 4
    1.15      };
    1.16 +
    1.17 +      ///\e The type of the investigated LP problem
    1.18 +      enum Problemtypes {
    1.19 +	  ///Primal-dual feasible
    1.20 +	  PRIMAL_DUAL_FEASIBLE = 0,
    1.21 +	  ///Primal feasible dual infeasible
    1.22 +	  PRIMAL_FEASIBLE_DUAL_INFEASIBLE = 1,
    1.23 +	  ///Primal infeasible dual feasible
    1.24 +	  PRIMAL_INFEASIBLE_DUAL_FEASIBLE = 2,
    1.25 +	  ///Primal-dual infeasible
    1.26 +	  PRIMAL_DUAL_INFEASIBLE = 3,
    1.27 +	  ///Could not determine so far
    1.28 +	  UNKNOWN = 4
    1.29 +      };
    1.30        
    1.31      ///The floating point type used by the solver
    1.32      typedef double Value;
    1.33 @@ -563,6 +577,11 @@
    1.34      virtual Value _getPrimal(int i) = 0;
    1.35      virtual Value _getPrimalValue() = 0;
    1.36      virtual SolutionStatus _getPrimalStatus() = 0;
    1.37 +    virtual SolutionStatus _getDualStatus() = 0;
    1.38 +    ///\todo This could be implemented here, too, using _getPrimalStatus() and
    1.39 +    ///_getDualStatus()
    1.40 +    virtual ProblemTypes _getProblemType() = 0;
    1.41 +
    1.42      virtual void _setMax() = 0;
    1.43      virtual void _setMin() = 0;
    1.44      
    1.45 @@ -930,11 +949,21 @@
    1.46  
    1.47      ///@{
    1.48  
    1.49 -    ///\e 
    1.50 +    /// The status of the primal problem (the original LP problem)
    1.51      SolutionStatus primalStatus() {
    1.52        return _getPrimalStatus();
    1.53      }
    1.54  
    1.55 +    /// The status of the dual (of the original LP) problem 
    1.56 +    SolutionStatus dualStatus() {
    1.57 +      return _getDualStatus();
    1.58 +    }
    1.59 +
    1.60 +    ///The type of the original LP problem
    1.61 +    Problemtypes problemType() {
    1.62 +      return _getProblemType();
    1.63 +    }
    1.64 +
    1.65      ///\e
    1.66      Value primal(Col c) { return _getPrimal(cols.floatingId(c.id)); }
    1.67  
     2.1 --- a/lemon/lp_cplex.cc	Thu Jun 09 09:49:56 2005 +0000
     2.2 +++ b/lemon/lp_cplex.cc	Thu Jun 09 15:03:58 2005 +0000
     2.3 @@ -260,6 +260,21 @@
     2.4      }
     2.5    }
     2.6  
     2.7 +  LpCplex::Value LpCplex::_getPrimal(int i)
     2.8 +  {
     2.9 +    Value x;
    2.10 +    CPXgetx (env, lp, &x, i, i);
    2.11 +    return x;
    2.12 +  }
    2.13 +  
    2.14 +  LpCplex::Value LpCplex::_getPrimalValue()
    2.15 +  {
    2.16 +    Value objval;
    2.17 +    //method = CPXgetmethod (env, lp);
    2.18 +    status = CPXgetobjval (env, lp, &objval);
    2.19 +    return objval;
    2.20 +  }
    2.21 +  
    2.22  
    2.23  //7.5-os cplex statusai (Vigyazat: a 9.0-asei masok!)
    2.24  // This table lists the statuses, returned by the CPXgetstat() routine, for solutions to LP problems or mixed integer problems. If no solution exists, the return value is zero.
    2.25 @@ -377,22 +392,24 @@
    2.26        //FIXME error
    2.27      }
    2.28  
    2.29 -  LpCplex::Value LpCplex::_getPrimal(int i)
    2.30 + 
    2.31 +  LpCplex::ProblemTypes LpCplex::_getProblemType()
    2.32    {
    2.33 -    Value x;
    2.34 -    CPXgetx (env, lp, &x, i, i);
    2.35 -    return x;
    2.36 -  }
    2.37 -  
    2.38 -  LpCplex::Value LpCplex::_getPrimalValue()
    2.39 -  {
    2.40 -    Value objval;
    2.41 -    //method = CPXgetmethod (env, lp);
    2.42 -    status = CPXgetobjval (env, lp, &objval);
    2.43 -    return objval;
    2.44 -  }
    2.45 -  
    2.46 - 
    2.47 +    int stat = CPXgetstat (env, lp);
    2.48 +    switch (stat) {
    2.49 +    case CPX_OPTIMAL://Optimal
    2.50 +	return PRIMAL_DUAL_FEASIBLE;
    2.51 +    case CPX_UNBOUNDED:
    2.52 + 	return PRIMAL_FEASIBLE_DUAL_INFEASIBLE;
    2.53 +// 	return PRIMAL_INFEASIBLE_DUAL_FEASIBLE;
    2.54 +// 	return PRIMAL_DUAL_INFEASIBLE;
    2.55 +
    2.56 +//Seems to be that this is all we can say for sure
    2.57 +    default:
    2.58 +	//In all other cases
    2.59 +	return UNKNOWN;
    2.60 +      //FIXME error
    2.61 +    }
    2.62  
    2.63  
    2.64    void LpCplex::_setMax()
     3.1 --- a/lemon/lp_cplex.h	Thu Jun 09 09:49:56 2005 +0000
     3.2 +++ b/lemon/lp_cplex.h	Thu Jun 09 15:03:58 2005 +0000
     3.3 @@ -75,34 +75,19 @@
     3.4      virtual void _clearObj();
     3.5      ///\e
     3.6      
     3.7 -    ///\bug Unimplemented
     3.8 -    ///
     3.9      virtual SolveExitStatus _solve();
    3.10 -    ///\e
    3.11  
    3.12 -    ///\bug Unimplemented
    3.13 -    ///
    3.14      virtual Value _getPrimal(int i);
    3.15 -    ///\e
    3.16 +
    3.17      
    3.18 -    ///\bug Unimplemented
    3.19 -    ///
    3.20      virtual Value _getPrimalValue();
    3.21 -    ///\e
    3.22      
    3.23 -    ///\bug Unimplemented
    3.24 -    ///
    3.25      virtual SolutionStatus _getPrimalStatus();
    3.26 +    virtual SolutionStatus _getDualStatus();
    3.27 +    virtual ProblemTypes _getProblemType();
    3.28  
    3.29 -    ///\e
    3.30      
    3.31 -    ///\bug Unimplemented
    3.32 -    ///
    3.33      virtual void _setMax();
    3.34 -    ///\e
    3.35 -    
    3.36 -    ///\bug Unimplemented
    3.37 -    ///
    3.38      virtual void _setMin();
    3.39  
    3.40    };
     4.1 --- a/lemon/lp_glpk.cc	Thu Jun 09 09:49:56 2005 +0000
     4.2 +++ b/lemon/lp_glpk.cc	Thu Jun 09 15:03:58 2005 +0000
     4.3 @@ -444,7 +444,7 @@
     4.4      case LPX_D_UNDEF://Undefined (no solve has been run yet)
     4.5        return UNDEFINED;
     4.6      case LPX_D_NOFEAS://There is no feasible solution (primal, I guess)
     4.7 -    case LPX_D_INFEAS://Infeasible 
     4.8 +//    case LPX_D_INFEAS://Infeasible 
     4.9        return INFEASIBLE;
    4.10      case LPX_FEAS://Feasible    
    4.11        int stat2=  lpx_get_prim_stat(lp);
    4.12 @@ -464,30 +464,19 @@
    4.13  
    4.14    LpGlpk::ProblemTypes LpGlpk::_problemType()
    4.15    {
    4.16 -    int stat=  lpx_get_status(lp);
    4.17 +      //int stat=  lpx_get_status(lp);
    4.18      int statp=  lpx_get_prim_stat(lp);
    4.19      int statd=  lpx_get_dual_stat(lp);
    4.20 -    switch (stat) {
    4.21 -    case LPX_UNDEF://Undefined (no solve has been run yet)
    4.22 -      return UNDEFINED;
    4.23 -      break;
    4.24 -    case LPX_NOFEAS://There is no feasible solution (primal, I guess)
    4.25 -    case LPX_INFEAS://Infeasible 
    4.26 -      return INFEASIBLE;
    4.27 -      break;
    4.28 -    case LPX_UNBND://Unbounded
    4.29 -      return INFINITE;
    4.30 -      break;
    4.31 -    case LPX_FEAS://Feasible
    4.32 -      return FEASIBLE;
    4.33 -      break;
    4.34 -    case LPX_OPT://Feasible
    4.35 -      return OPTIMAL;
    4.36 -      break;
    4.37 -    default:
    4.38 -      return UNDEFINED; //to avoid gcc warning
    4.39 -      //FIXME error
    4.40 -    }
    4.41 +    if (statp==LP_P_FEAS && statd==LP_D_FEAS)
    4.42 +	return PRIMAL_DUAL_FEASIBLE;
    4.43 +    if (statp==LP_P_FEAS && statd==LP_D_NOFEAS)
    4.44 +	return PRIMAL_FEASIBLE_DUAL_INFEASIBLE;
    4.45 +    if (statp==LP_P_NOFEAS && statd==LP_D_FEAS)
    4.46 +	return PRIMAL_INFEASIBLE_DUAL_FEASIBLE;
    4.47 +    if (statp==LP_P_NOFEAS && statd==LP_D_NOFEAS)
    4.48 +	return PRIMAL_DUAL_INFEASIBLE;
    4.49 +    //In all other cases
    4.50 +    return UNKNOWN;
    4.51    }
    4.52  
    4.53    void LpGlpk::_setMax()
     5.1 --- a/lemon/lp_glpk.h	Thu Jun 09 09:49:56 2005 +0000
     5.2 +++ b/lemon/lp_glpk.h	Thu Jun 09 15:03:58 2005 +0000
     5.3 @@ -85,6 +85,9 @@
     5.4      ///\todo It should be clarified
     5.5      ///
     5.6      virtual SolutionStatus _getPrimalStatus();
     5.7 +    virtual SolutionStatus _getDualStatus();
     5.8 +    virtual ProblemTypes _getProblemType();
     5.9 +
    5.10      virtual void _setMax();
    5.11      virtual void _setMin();
    5.12  
     6.1 --- a/lemon/lp_skeleton.cc	Thu Jun 09 09:49:56 2005 +0000
     6.2 +++ b/lemon/lp_skeleton.cc	Thu Jun 09 15:03:58 2005 +0000
     6.3 @@ -120,7 +120,17 @@
     6.4    
     6.5    LpSkeleton::SolutionStatus LpSkeleton::_getPrimalStatus()
     6.6    {
     6.7 -    return OPTIMAL;
     6.8 +    return UNDEFINED;
     6.9 +  }
    6.10 +
    6.11 +  LpSkeleton::SolutionStatus LpSkeleton::_getDualStatus()
    6.12 +  {
    6.13 +    return UNDEFINED;
    6.14 +  }
    6.15 +
    6.16 +  LpSkeleton::ProblemTypes LpSkeleton::_getProblemType()
    6.17 +  {
    6.18 +    return UNKNOWN;
    6.19    }
    6.20    
    6.21  } //namespace lemon
     7.1 --- a/lemon/lp_skeleton.h	Thu Jun 09 09:49:56 2005 +0000
     7.2 +++ b/lemon/lp_skeleton.h	Thu Jun 09 15:03:58 2005 +0000
     7.3 @@ -118,6 +118,13 @@
     7.4      ///
     7.5      virtual SolutionStatus _getPrimalStatus();
     7.6  
     7.7 +    ////e
     7.8 +    virtual SolutionStatus _getDualStatus();
     7.9 +
    7.10 +
    7.11 +    ///\e
    7.12 +    virtual ProblemTypes _getProblemType();
    7.13 +
    7.14      ///\e
    7.15      virtual void _setMax();
    7.16      ///\e