ConstrainedOptPack_QPSolverStats.hpp

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef COP_QP_SOLVER_STATS_H
00030 #define COP_QP_SOLVER_STATS_H
00031 
00032 #include "ConstrainedOptPack_Types.hpp"
00033 
00034 namespace ConstrainedOptPack {
00035 
00038 class QPSolverStats {
00039 public:
00040 
00041   // Public types
00042 
00044   enum { NOT_KNOWN = -1 };
00045 
00047   enum ESolutionType {
00048     SOLUTION_TYPE_NOT_KNOWN = static_cast<int>(NOT_KNOWN),
00049     OPTIMAL_SOLUTION    = 0,
00050     PRIMAL_FEASIBLE_POINT = 1,
00051     DUAL_FEASIBLE_POINT   = 2,
00052     SUBOPTIMAL_POINT    = 3
00053     };
00055   enum EConvexity {
00056     CONVEXITY_NOT_KNOWN = static_cast<int>(NOT_KNOWN),
00057     CONVEX              = 0,
00058     NONCONVEX           = 1
00059   };
00060 
00061   // Public interface
00062 
00064   QPSolverStats()
00065     : solution_type_(SOLUTION_TYPE_NOT_KNOWN)
00066     , convexity_(CONVEXITY_NOT_KNOWN)
00067     , num_qp_iter_(NOT_KNOWN)
00068     , num_adds_(NOT_KNOWN), num_drops_(NOT_KNOWN)
00069     , warm_start_(false), infeasible_qp_(false)
00070   {}
00072   void set_stats(
00073     ESolutionType solution_type, EConvexity convexity
00074     ,int num_qp_iter, int num_adds, int num_drops
00075     , bool warm_start, bool infeasible_qp )
00076   {
00077     solution_type_  = solution_type;
00078     convexity_      = convexity;
00079     num_qp_iter_  = num_qp_iter; 
00080     num_adds_   = num_adds;
00081     num_drops_    = num_drops;
00082     warm_start_   = warm_start;
00083     infeasible_qp_  = infeasible_qp;
00084   }
00086   ESolutionType solution_type() const
00087   {
00088     return solution_type_;
00089   }
00091   EConvexity convexity() const
00092   {
00093     return convexity_;
00094   }
00096   int num_qp_iter() const
00097   {
00098     return num_qp_iter_;
00099   }
00101   int num_adds() const
00102   {
00103     return num_adds_;
00104   }
00106   int num_drop() const
00107   {
00108     return num_drops_;
00109   }
00111   int warm_start() const
00112   {
00113     return warm_start_;
00114   }
00116   int infeasible_qp() const
00117   {
00118     return infeasible_qp_;
00119   }
00120 
00121 private:
00122   ESolutionType solution_type_;
00123   EConvexity      convexity_;
00124   int       num_qp_iter_;
00125   int       num_adds_;
00126   int       num_drops_;
00127   bool      warm_start_;
00128   bool      infeasible_qp_;
00129 
00130 };  // end class QPSolverStats
00131 
00132 inline
00133 std::string toString( const QPSolverStats::ESolutionType &solution_type )
00134 {
00135   switch(solution_type) {
00136     case QPSolverStats::SOLUTION_TYPE_NOT_KNOWN:
00137       return "SOLUTION_TYPE_NOT_KNOWN";
00138       break;
00139     case QPSolverStats::OPTIMAL_SOLUTION:
00140       return "OPTIMAL_SOLUTION";
00141       break;
00142     case QPSolverStats::PRIMAL_FEASIBLE_POINT:
00143       return "PRIMAL_FEASIBLE_POINT";
00144       break;
00145     case QPSolverStats::DUAL_FEASIBLE_POINT:
00146       return "DUAL_FEASIBLE_POINT";
00147       break;
00148     case QPSolverStats::SUBOPTIMAL_POINT:
00149       return "SUBOPTIMAL_POINT";
00150       break;
00151     default:
00152       TEST_FOR_EXCEPT(true);
00153   }
00154 }
00155 
00156 } // end namespace ConstrainedOptPack
00157 
00158 #endif  // COP_QP_SOLVER_STATS_H

Generated on Thu Sep 18 12:35:15 2008 for MOOCHO (Single Doxygen Collection) by doxygen 1.3.9.1