|
ConstrainedOptPack: C++ Tools for Constrained (and Unconstrained) Optimization Version of the Day
|
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 QP_SOLVER_RELAXED_QPOPTSOL_H 00030 #define QP_SOLVER_RELAXED_QPOPTSOL_H 00031 00032 #include <vector> 00033 00034 #include "ConstrainedOptPack_QPSolverRelaxed.hpp" 00035 #include "DenseLinAlgPack_DVectorClass.hpp" 00036 #include "DenseLinAlgPack_DMatrixClass.hpp" 00037 #include "Teuchos_StandardMemberCompositionMacros.hpp" 00038 00039 namespace ConstrainedOptPack { 00040 00047 class QPSolverRelaxedQPOPTSOL : public QPSolverRelaxed 00048 { 00049 public: 00050 00051 // ///////////////////////////////////// 00054 00056 typedef FortranTypes::f_int f_int; 00058 typedef FortranTypes::f_dbl_prec f_dbl_prec; 00060 typedef FortranTypes::f_logical f_logical; 00061 00063 00065 QPSolverRelaxedQPOPTSOL(); 00066 00068 ~QPSolverRelaxedQPOPTSOL(); 00069 00071 virtual const MatrixOp* G() const; 00072 00074 virtual value_type use_as_bigM() const; 00075 00076 // ///////////////////////////////// 00077 // Overridden from QPSolverRelaxed 00078 00080 QPSolverStats get_qp_stats() const; 00081 00083 void release_memory(); 00084 00085 protected: 00086 00087 // ///////////////////////////////// 00088 // Overridden from QPSolverRelaxed 00089 00091 QPSolverStats::ESolutionType imp_solve_qp( 00092 std::ostream* out, EOutputLevel olevel, ERunTests test_what 00093 ,const Vector& g, const MatrixSymOp& G 00094 ,value_type etaL 00095 ,const Vector* dL, const Vector* dU 00096 ,const MatrixOp* E, BLAS_Cpp::Transp trans_E, const Vector* b 00097 ,const Vector* eL, const Vector* eU 00098 ,const MatrixOp* F, BLAS_Cpp::Transp trans_F, const Vector* f 00099 ,value_type* obj_d 00100 ,value_type* eta, VectorMutable* d 00101 ,VectorMutable* nu 00102 ,VectorMutable* mu, VectorMutable* Ed 00103 ,VectorMutable* lambda, VectorMutable* Fd 00104 ); 00105 00106 // ////////////////////////////////////////////////////////////// 00107 // Protected types 00108 00110 typedef std::vector<f_int> ISTATE_t; 00112 typedef std::vector<f_int> IWORK_t; 00114 typedef std::vector<f_dbl_prec> WORK_t; 00115 public: // RAB: 2001/05/03: MS VC++ 6.0 must have this public ??? 00117 enum EInform { 00118 STRONG_LOCAL_MIN, 00119 WEAK_LOCAL_MIN, 00120 MAX_ITER_EXCEEDED, 00121 OTHER_ERROR 00122 }; 00123 00124 protected: 00125 00126 // ////////////////////////////////////////////////////////////// 00127 // Protected Data Members. 00128 00129 QPSolverStats qp_stats_; 00130 00137 00139 f_int N_; 00141 f_int NCLIN_; 00143 DMatrix A_; 00145 DVector BL_; 00147 DVector BU_; 00149 DVector CVEC_; 00151 ISTATE_t ISTATE_; 00153 DVector X_; 00155 DVector AX_; 00157 DVector CLAMDA_; 00159 f_int ITER_; 00161 f_dbl_prec OBJ_; 00163 f_int LIWORK_; 00165 IWORK_t IWORK_; 00167 f_int LWORK_; 00169 WORK_t WORK_; 00170 00172 00173 // ///////////////////////////////////////////////////////////// 00174 // Template method primatives to be overridden. 00175 00177 virtual f_int liwork(f_int N, f_int NCLIN) const = 0; 00178 00180 virtual f_int lrwork(f_int N, f_int NCLIN) const = 0; 00181 00185 virtual EInform call_qp_solver(bool warm_start) = 0; 00186 00187 private: 00188 00189 // ///////////////////////// 00190 // Private types 00191 00192 typedef std::vector<f_int> ibnds_t; 00193 00194 // /////////////////////////// 00195 // Private data members 00196 00197 size_type n_inequ_bnds_; // Used to record the number of bounds with at least 00198 // one bound existing in eL and eU. 00199 ibnds_t i_inequ_bnds_; // size(nbounds_). Remembers which bounds in 00200 // eL, eU had at least one bound present. This is 00201 // needed to map from CLAMDA_ to mu. 00202 value_type bigM_; // Big M value used to construct relaxation. 00203 value_type use_as_bigM_; // Big M value used in QPHESS. 00204 const MatrixOp* G_; // used to compute HESS * x = [ G, 0; 0, bigM ] * x products. 00205 00206 // /////////////////////////// 00207 // Private member functions 00208 00209 // not defined and not to be called. 00210 QPSolverRelaxedQPOPTSOL(const QPSolverRelaxedQPOPTSOL&); 00211 QPSolverRelaxedQPOPTSOL& operator=(const QPSolverRelaxedQPOPTSOL&); 00212 00213 }; // end class QPSolverRelaxedQPOPTSOL 00214 00215 } // end namespace ConstrainedOptimizationPackTypes 00216 00217 #endif // QP_SOLVER_RELAXED_QPOPTSOL_H
1.7.4