|
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_SCHUR_CONSTRAINTS_RELAXED_STD_H 00043 #define QP_SCHUR_CONSTRAINTS_RELAXED_STD_H 00044 00045 #include <list> 00046 00047 #include "ConstrainedOptPack_QPSchur.hpp" 00048 #include "AbstractLinAlgPack_MatrixOp.hpp" 00049 #include "AbstractLinAlgPack_VectorSpaceBlocked.hpp" 00050 00051 namespace ConstrainedOptPack { 00052 namespace QPSchurPack { 00053 00089 class ConstraintsRelaxedStd : public Constraints { 00090 public: 00091 00092 // ///////////////////////////////////////////// 00093 // Public types 00094 00105 class MatrixConstraints : public MatrixOp { 00106 public: 00107 00112 MatrixConstraints(); 00113 00123 void initialize( 00124 const VectorSpace::space_ptr_t &space_d_eta 00125 ,const size_type m_in 00126 ,const size_type m_eq 00127 ,const MatrixOp *E 00128 ,BLAS_Cpp::Transp trans_E 00129 ,const Vector *b 00130 ,const MatrixOp *F 00131 ,BLAS_Cpp::Transp trans_F 00132 ,const Vector *f 00133 ,size_type m_undecomp 00134 ,const size_type j_f_undecomp[] 00135 ); 00136 00139 00141 size_type nd() const 00142 { return nd_; } 00144 size_type m_in() const 00145 { return m_in_; } 00147 size_type m_eq() const 00148 { return m_eq_; } 00150 const MatrixOp* E() const 00151 { return E_; } 00153 BLAS_Cpp::Transp trans_E() const 00154 { return trans_E_; } 00156 const Vector* b() const 00157 { return b_; } 00159 const MatrixOp* F() const 00160 { return F_; } 00162 BLAS_Cpp::Transp trans_F() const 00163 { return trans_F_; } 00165 const Vector* f() const 00166 { return f_; } 00168 const GenPermMatrixSlice& P_u() const 00169 { return P_u_; } 00170 00172 00175 00177 const VectorSpace& space_cols() const; 00179 const VectorSpace& space_rows() const; 00181 MatrixOp& operator=(const MatrixOp& m); 00182 // /// 00183 // void Mp_StPtMtP( 00184 // DMatrixSlice* gms_lhs, value_type alpha 00185 // ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00186 // ,BLAS_Cpp::Transp M_trans 00187 // ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans 00188 // ) const ; 00190 void Vp_StMtV( 00191 VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00192 ,const Vector& vs_rhs2, value_type beta 00193 ) const; 00195 void Vp_StPtMtV( 00196 VectorMutable* vs_lhs, value_type alpha 00197 ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00198 ,BLAS_Cpp::Transp M_rhs2_trans 00199 ,const SpVectorSlice& sv_rhs3, value_type beta 00200 ) const; 00201 00203 00204 private: 00205 typedef std::vector<size_type> row_i_t; 00206 typedef std::vector<size_type> col_j_t; 00207 size_type nd_; // # unknowns d 00208 size_type m_in_; // # op(E)*d inequality constraints 00209 size_type m_eq_; // # op(F)*d equality constraints 00210 const MatrixOp *E_; // If NULL then no general inequalities 00211 BLAS_Cpp::Transp trans_E_; 00212 const Vector *b_; 00213 const MatrixOp *F_; // If NULL then no general equalities 00214 BLAS_Cpp::Transp trans_F_; 00215 const Vector *f_; 00216 GenPermMatrixSlice P_u_; 00217 row_i_t P_u_row_i_; 00218 col_j_t P_u_col_j_; 00219 VectorSpace::space_ptr_t space_cols_; 00220 VectorSpaceBlocked space_rows_; 00221 }; // end class MatrixConstraints 00222 00224 enum EInequalityPickPolicy { 00225 ADD_BOUNDS_THEN_MOST_VIOLATED_INEQUALITY 00226 ,ADD_BOUNDS_THEN_FIRST_VIOLATED_INEQUALITY 00227 ,ADD_MOST_VIOLATED_BOUNDS_AND_INEQUALITY 00228 }; 00229 00232 00235 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, bounds_tol ); 00236 00239 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, inequality_tol ); 00240 00243 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, equality_tol ); 00244 00247 STANDARD_MEMBER_COMPOSITION_MEMBERS( EInequalityPickPolicy, inequality_pick_policy ); 00248 00250 ConstraintsRelaxedStd(); 00251 00295 void initialize( 00296 const VectorSpace::space_ptr_t &space_d_eta 00297 ,value_type etaL 00298 ,const Vector *dL 00299 ,const Vector *dU 00300 ,const MatrixOp *E 00301 ,BLAS_Cpp::Transp trans_E 00302 ,const Vector *b 00303 ,const Vector *eL 00304 ,const Vector *eU 00305 ,const MatrixOp *F 00306 ,BLAS_Cpp::Transp trans_F 00307 ,const Vector *f 00308 ,size_type m_undecomp 00309 ,const size_type j_f_undecomp[] 00310 ,VectorMutable *Ed 00311 ,bool check_F = true 00312 ,value_type bounds_tol = 1e-10 00313 ,value_type inequality_tol = 1e-10 00314 ,value_type equality_tol = 1e-10 00315 ); 00316 00318 const MatrixConstraints& A_bar_relaxed() const; 00319 00321 00324 00326 size_type n() const; 00328 size_type m_breve() const; 00337 const MatrixOp& A_bar() const; 00339 void pick_violated_policy( EPickPolicy pick_policy ); 00341 EPickPolicy pick_violated_policy() const; 00382 void pick_violated( 00383 const DVectorSlice& x, size_type* j_viol, value_type* constr_val 00384 ,value_type* viol_bnd_val, value_type* norm_2_constr, EBounds* bnd, bool* can_ignore 00385 ) const; 00387 void ignore( size_type j ); 00389 value_type get_bnd( size_type j, EBounds bnd ) const; 00390 00392 00393 private: 00394 00395 // ////////////////////////////// 00396 // Private types 00397 00398 typedef std::list<size_type> passed_over_equalities_t; 00399 00400 // ////////////////////////////// 00401 // Private data members 00402 00403 MatrixConstraints A_bar_; 00404 value_type etaL_; 00405 const Vector *dL_; // If NULL then no simple bounds 00406 const Vector *dU_; 00407 const Vector *eL_; 00408 const Vector *eU_; 00409 VectorMutable *Ed_; 00410 bool check_F_; 00411 mutable size_type last_added_j_; // Remember the last bound added so that 00412 mutable value_type last_added_bound_; // we can save our selfs some work. 00413 mutable EBounds last_added_bound_type_; // ... 00414 mutable size_type next_undecomp_f_k_; 00415 // Determines the next constraint [P_u'*op(F)*d + (1 - eta) * P_u'*f](next_undecomp_f_k) 00416 // to be checked to see if it is violated. If next_undecomp_f_k > P_u.nz() then all 00417 // of the constriants have been checked. 00418 mutable passed_over_equalities_t passed_over_equalities_; 00419 // This is a list that keeps track of those equality constraints that were checked 00420 // for being violated but were within tolerance and therefore passed over and not added. 00421 // This list can be traversed again and again to check these constraints. Specifically, the 00422 // indexes of f(k) are sorted, not the indexes in P_u'. 00423 00424 // ////////////////////////////// 00425 // Private member functions 00426 00428 void cache_last_added( 00429 size_type last_added_j, value_type last_added_bound 00430 ,EBounds last_added_bound_type 00431 ) const; 00432 00433 }; // end class ConstraintsRelaxedStd 00434 00435 } // end namespace QPSchurPack 00436 } // end namespace ConstrainedOptPack 00437 00438 #endif // QP_SCHUR_CONSTRAINTS_RELAXED_STD_H
1.7.6.1