|
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 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 // @HEADER 00041 00042 #ifndef QP_SOLVER_RELAXED_QP_SCHUR_H 00043 #define QP_SOLVER_RELAXED_QP_SCHUR_H 00044 00045 #include "ConstrainedOptPack_QPSolverRelaxed.hpp" 00046 #include "ConstrainedOptPack_QPSchur.hpp" 00047 #include "ConstrainedOptPack_QPInitFixedFreeStd.hpp" 00048 #include "ConstrainedOptPack_MatrixSymHessianRelaxNonSing.hpp" 00049 #include "ConstrainedOptPack_ConstraintsRelaxedStd.hpp" 00050 #include "ConstrainedOptPack_MatrixSymAddDelBunchKaufman.hpp" 00051 #include "AbstractLinAlgPack_VectorMutableDense.hpp" 00052 #include "Teuchos_StandardCompositionMacros.hpp" 00053 #include "Teuchos_StandardMemberCompositionMacros.hpp" 00054 00055 namespace ConstrainedOptPack { 00056 00063 class QPSolverRelaxedQPSchur : public QPSolverRelaxed { 00064 public: 00065 00071 class InitKKTSystem { 00072 public: 00074 typedef std::vector<size_type> i_x_free_t; 00076 typedef std::vector<size_type> i_x_fixed_t; 00078 typedef std::vector<EBounds> bnd_fixed_t; 00080 typedef std::vector<size_type> j_f_decomp_t; 00082 typedef Teuchos::RCP<const MatrixSymOpNonsing> 00083 Ko_ptr_t; 00085 virtual ~InitKKTSystem() {} 00159 virtual void initialize_kkt_system( 00160 const Vector &g 00161 ,const MatrixOp &G 00162 ,value_type etaL 00163 ,const Vector *dL 00164 ,const Vector *dU 00165 ,const MatrixOp *F 00166 ,BLAS_Cpp::Transp trans_F 00167 ,const Vector *f 00168 ,const Vector *d 00169 ,const Vector *nu 00170 ,size_type *n_R 00171 ,i_x_free_t *i_x_free 00172 ,i_x_fixed_t *i_x_fixed 00173 ,bnd_fixed_t *bnd_fixed 00174 ,j_f_decomp_t *j_f_decomp 00175 ,DVector *b_X 00176 ,Ko_ptr_t *Ko 00177 ,DVector *fo 00178 ) const = 0; 00179 00180 }; // end class InitKKTSystem 00181 00191 class ReinitKKTSystem : public InitKKTSystem { 00192 public: 00193 // ToDo: Create method reinitailze_kkt_system(...) 00194 }; // end class ReinitKKTSystem 00195 00198 STANDARD_COMPOSITION_MEMBERS( InitKKTSystem, init_kkt_sys ); 00199 00202 STANDARD_COMPOSITION_MEMBERS( QPSchurPack::ConstraintsRelaxedStd, constraints ); 00203 00206 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, max_qp_iter_frac ); 00207 00210 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, max_real_runtime ); 00211 00214 STANDARD_MEMBER_COMPOSITION_MEMBERS( 00215 QPSchurPack::ConstraintsRelaxedStd::EInequalityPickPolicy 00216 ,inequality_pick_policy 00217 ); 00218 00220 enum ELocalOutputLevel { 00221 USE_INPUT_ARG = -1 // Use the value input to solve_qp(...) 00222 ,NO_OUTPUT = 0 // 00223 ,OUTPUT_BASIC_INFO = 1 // values sent to QPSchur::solve_qp(...) 00224 ,OUTPUT_ITER_SUMMARY = 2 // ... 00225 ,OUTPUT_ITER_STEPS = 3 00226 ,OUTPUT_ACT_SET = 4 00227 ,OUTPUT_ITER_QUANTITIES = 5 00228 }; 00229 00232 STANDARD_MEMBER_COMPOSITION_MEMBERS( ELocalOutputLevel, print_level ); 00233 00236 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, bounds_tol ); 00237 00240 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, inequality_tol ); 00241 00244 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, equality_tol ); 00245 00248 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, loose_feas_tol ); 00249 00253 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, dual_infeas_tol ); 00254 00259 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, huge_primal_step ); 00260 00265 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, huge_dual_step ); 00266 00269 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, bigM ); 00270 00273 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, warning_tol ); 00274 00277 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, error_tol ); 00278 00282 STANDARD_MEMBER_COMPOSITION_MEMBERS( size_type, iter_refine_min_iter ); 00283 00287 STANDARD_MEMBER_COMPOSITION_MEMBERS( size_type, iter_refine_max_iter ); 00288 00292 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, iter_refine_opt_tol ); 00293 00297 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, iter_refine_feas_tol ); 00298 00302 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, iter_refine_at_solution ); 00303 00308 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, pivot_warning_tol ); 00309 00314 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, pivot_singular_tol ); 00315 00320 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, pivot_wrong_inertia_tol ); 00321 00325 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, add_equalities_initially ); 00326 00328 QPSolverRelaxedQPSchur( 00329 const init_kkt_sys_ptr_t& init_kkt_sys = Teuchos::null 00330 ,const constraints_ptr_t& constraints = Teuchos::rcp(new QPSchurPack::ConstraintsRelaxedStd) 00331 ,value_type max_qp_iter_frac = 10.0 00332 ,value_type max_real_runtime = 1e+20 00333 ,QPSchurPack::ConstraintsRelaxedStd::EInequalityPickPolicy 00334 inequality_pick_policy 00335 = QPSchurPack::ConstraintsRelaxedStd::ADD_BOUNDS_THEN_MOST_VIOLATED_INEQUALITY 00336 ,ELocalOutputLevel print_level = USE_INPUT_ARG // Deduce from input arguments 00337 ,value_type bounds_tol = -1.0 // use default 00338 ,value_type inequality_tol = -1.0 // use default 00339 ,value_type equality_tol = -1.0 // use default 00340 ,value_type loose_feas_tol = -1.0 // use default 00341 ,value_type dual_infeas_tol = -1.0 // use default 00342 ,value_type huge_primal_step = -1.0 // use defalut 00343 ,value_type huge_dual_step = -1.0 // use default 00344 ,value_type bigM = 1e+10 00345 ,value_type warning_tol = 1e-10 00346 ,value_type error_tol = 1e-5 00347 ,size_type iter_refine_min_iter = 1 00348 ,size_type iter_refine_max_iter = 3 00349 ,value_type iter_refine_opt_tol = 1e-12 00350 ,value_type iter_refine_feas_tol = 1e-12 00351 ,bool iter_refine_at_solution = true 00352 ,value_type pivot_warning_tol = 1e-8 00353 ,value_type pivot_singular_tol = 1e-11 00354 ,value_type pivot_wrong_inertia_tol = 1e-11 00355 ,bool add_equalities_initially= true 00356 ); 00357 00359 ~QPSolverRelaxedQPSchur(); 00360 00363 00365 QPSolverStats get_qp_stats() const; 00367 void release_memory(); 00368 00370 00371 protected: 00372 00375 00377 QPSolverStats::ESolutionType imp_solve_qp( 00378 std::ostream* out, EOutputLevel olevel, ERunTests test_what 00379 ,const Vector& g, const MatrixSymOp& G 00380 ,value_type etaL 00381 ,const Vector* dL, const Vector* dU 00382 ,const MatrixOp* E, BLAS_Cpp::Transp trans_E, const Vector* b 00383 ,const Vector* eL, const Vector* eU 00384 ,const MatrixOp* F, BLAS_Cpp::Transp trans_F, const Vector* f 00385 ,value_type* obj_d 00386 ,value_type* eta, VectorMutable* d 00387 ,VectorMutable* nu 00388 ,VectorMutable* mu, VectorMutable* Ed 00389 ,VectorMutable* lambda, VectorMutable* Fd 00390 ); 00391 00393 00394 private: 00395 00396 // //////////////////////////// 00397 // Private data members 00398 00399 QPSolverStats qp_stats_; 00400 QPSchur qp_solver_; 00401 QPSchurPack::QPInitFixedFreeStd qp_; 00402 MatrixSymHessianRelaxNonSing G_relaxed_; 00403 VectorMutableDense bigM_vec_; 00404 MatrixSymAddDelBunchKaufman schur_comp_; 00405 DVector g_relaxed_; 00406 DVector b_X_; 00407 InitKKTSystem::Ko_ptr_t Ko_; 00408 DVector fo_; 00409 00410 }; // end class QPSolverRelaxedQPSchur 00411 00412 } // end namespace ConstrainedOptPack 00413 00414 #endif // QP_SOLVER_RELAXED_QP_SCHUR_H
1.7.6.1