|
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_QP_SCHUR_H 00030 #define QP_SOLVER_RELAXED_QP_SCHUR_H 00031 00032 #include "ConstrainedOptPack_QPSolverRelaxed.hpp" 00033 #include "ConstrainedOptPack_QPSchur.hpp" 00034 #include "ConstrainedOptPack_QPInitFixedFreeStd.hpp" 00035 #include "ConstrainedOptPack_MatrixSymHessianRelaxNonSing.hpp" 00036 #include "ConstrainedOptPack_ConstraintsRelaxedStd.hpp" 00037 #include "ConstrainedOptPack_MatrixSymAddDelBunchKaufman.hpp" 00038 #include "AbstractLinAlgPack_VectorMutableDense.hpp" 00039 #include "Teuchos_StandardCompositionMacros.hpp" 00040 #include "Teuchos_StandardMemberCompositionMacros.hpp" 00041 00042 namespace ConstrainedOptPack { 00043 00050 class QPSolverRelaxedQPSchur : public QPSolverRelaxed { 00051 public: 00052 00058 class InitKKTSystem { 00059 public: 00061 typedef std::vector<size_type> i_x_free_t; 00063 typedef std::vector<size_type> i_x_fixed_t; 00065 typedef std::vector<EBounds> bnd_fixed_t; 00067 typedef std::vector<size_type> j_f_decomp_t; 00069 typedef Teuchos::RCP<const MatrixSymOpNonsing> 00070 Ko_ptr_t; 00072 virtual ~InitKKTSystem() {} 00146 virtual void initialize_kkt_system( 00147 const Vector &g 00148 ,const MatrixOp &G 00149 ,value_type etaL 00150 ,const Vector *dL 00151 ,const Vector *dU 00152 ,const MatrixOp *F 00153 ,BLAS_Cpp::Transp trans_F 00154 ,const Vector *f 00155 ,const Vector *d 00156 ,const Vector *nu 00157 ,size_type *n_R 00158 ,i_x_free_t *i_x_free 00159 ,i_x_fixed_t *i_x_fixed 00160 ,bnd_fixed_t *bnd_fixed 00161 ,j_f_decomp_t *j_f_decomp 00162 ,DVector *b_X 00163 ,Ko_ptr_t *Ko 00164 ,DVector *fo 00165 ) const = 0; 00166 00167 }; // end class InitKKTSystem 00168 00178 class ReinitKKTSystem : public InitKKTSystem { 00179 public: 00180 // ToDo: Create method reinitailze_kkt_system(...) 00181 }; // end class ReinitKKTSystem 00182 00185 STANDARD_COMPOSITION_MEMBERS( InitKKTSystem, init_kkt_sys ); 00186 00189 STANDARD_COMPOSITION_MEMBERS( QPSchurPack::ConstraintsRelaxedStd, constraints ); 00190 00193 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, max_qp_iter_frac ); 00194 00197 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, max_real_runtime ); 00198 00201 STANDARD_MEMBER_COMPOSITION_MEMBERS( 00202 QPSchurPack::ConstraintsRelaxedStd::EInequalityPickPolicy 00203 ,inequality_pick_policy 00204 ); 00205 00207 enum ELocalOutputLevel { 00208 USE_INPUT_ARG = -1 // Use the value input to solve_qp(...) 00209 ,NO_OUTPUT = 0 // 00210 ,OUTPUT_BASIC_INFO = 1 // values sent to QPSchur::solve_qp(...) 00211 ,OUTPUT_ITER_SUMMARY = 2 // ... 00212 ,OUTPUT_ITER_STEPS = 3 00213 ,OUTPUT_ACT_SET = 4 00214 ,OUTPUT_ITER_QUANTITIES = 5 00215 }; 00216 00219 STANDARD_MEMBER_COMPOSITION_MEMBERS( ELocalOutputLevel, print_level ); 00220 00223 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, bounds_tol ); 00224 00227 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, inequality_tol ); 00228 00231 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, equality_tol ); 00232 00235 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, loose_feas_tol ); 00236 00240 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, dual_infeas_tol ); 00241 00246 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, huge_primal_step ); 00247 00252 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, huge_dual_step ); 00253 00256 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, bigM ); 00257 00260 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, warning_tol ); 00261 00264 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, error_tol ); 00265 00269 STANDARD_MEMBER_COMPOSITION_MEMBERS( size_type, iter_refine_min_iter ); 00270 00274 STANDARD_MEMBER_COMPOSITION_MEMBERS( size_type, iter_refine_max_iter ); 00275 00279 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, iter_refine_opt_tol ); 00280 00284 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, iter_refine_feas_tol ); 00285 00289 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, iter_refine_at_solution ); 00290 00295 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, pivot_warning_tol ); 00296 00301 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, pivot_singular_tol ); 00302 00307 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, pivot_wrong_inertia_tol ); 00308 00312 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, add_equalities_initially ); 00313 00315 QPSolverRelaxedQPSchur( 00316 const init_kkt_sys_ptr_t& init_kkt_sys = Teuchos::null 00317 ,const constraints_ptr_t& constraints = Teuchos::rcp(new QPSchurPack::ConstraintsRelaxedStd) 00318 ,value_type max_qp_iter_frac = 10.0 00319 ,value_type max_real_runtime = 1e+20 00320 ,QPSchurPack::ConstraintsRelaxedStd::EInequalityPickPolicy 00321 inequality_pick_policy 00322 = QPSchurPack::ConstraintsRelaxedStd::ADD_BOUNDS_THEN_MOST_VIOLATED_INEQUALITY 00323 ,ELocalOutputLevel print_level = USE_INPUT_ARG // Deduce from input arguments 00324 ,value_type bounds_tol = -1.0 // use default 00325 ,value_type inequality_tol = -1.0 // use default 00326 ,value_type equality_tol = -1.0 // use default 00327 ,value_type loose_feas_tol = -1.0 // use default 00328 ,value_type dual_infeas_tol = -1.0 // use default 00329 ,value_type huge_primal_step = -1.0 // use defalut 00330 ,value_type huge_dual_step = -1.0 // use default 00331 ,value_type bigM = 1e+10 00332 ,value_type warning_tol = 1e-10 00333 ,value_type error_tol = 1e-5 00334 ,size_type iter_refine_min_iter = 1 00335 ,size_type iter_refine_max_iter = 3 00336 ,value_type iter_refine_opt_tol = 1e-12 00337 ,value_type iter_refine_feas_tol = 1e-12 00338 ,bool iter_refine_at_solution = true 00339 ,value_type pivot_warning_tol = 1e-8 00340 ,value_type pivot_singular_tol = 1e-11 00341 ,value_type pivot_wrong_inertia_tol = 1e-11 00342 ,bool add_equalities_initially= true 00343 ); 00344 00346 ~QPSolverRelaxedQPSchur(); 00347 00350 00352 QPSolverStats get_qp_stats() const; 00354 void release_memory(); 00355 00357 00358 protected: 00359 00362 00364 QPSolverStats::ESolutionType imp_solve_qp( 00365 std::ostream* out, EOutputLevel olevel, ERunTests test_what 00366 ,const Vector& g, const MatrixSymOp& G 00367 ,value_type etaL 00368 ,const Vector* dL, const Vector* dU 00369 ,const MatrixOp* E, BLAS_Cpp::Transp trans_E, const Vector* b 00370 ,const Vector* eL, const Vector* eU 00371 ,const MatrixOp* F, BLAS_Cpp::Transp trans_F, const Vector* f 00372 ,value_type* obj_d 00373 ,value_type* eta, VectorMutable* d 00374 ,VectorMutable* nu 00375 ,VectorMutable* mu, VectorMutable* Ed 00376 ,VectorMutable* lambda, VectorMutable* Fd 00377 ); 00378 00380 00381 private: 00382 00383 // //////////////////////////// 00384 // Private data members 00385 00386 QPSolverStats qp_stats_; 00387 QPSchur qp_solver_; 00388 QPSchurPack::QPInitFixedFreeStd qp_; 00389 MatrixSymHessianRelaxNonSing G_relaxed_; 00390 VectorMutableDense bigM_vec_; 00391 MatrixSymAddDelBunchKaufman schur_comp_; 00392 DVector g_relaxed_; 00393 DVector b_X_; 00394 InitKKTSystem::Ko_ptr_t Ko_; 00395 DVector fo_; 00396 00397 }; // end class QPSolverRelaxedQPSchur 00398 00399 } // end namespace ConstrainedOptPack 00400 00401 #endif // QP_SOLVER_RELAXED_QP_SCHUR_H
1.7.4