|
NLPInterfacePack: C++ Interfaces and Implementation for Non-Linear Programs
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 BARRIER_NLP_H 00043 #define BARRIER_NLP_H 00044 00045 #include "NLPInterfacePack_NLPObjGrad.hpp" 00046 00047 namespace NLPInterfacePack { 00048 00053 class NLPBarrier : public NLPObjGrad 00054 { 00055 public: 00056 00059 00061 void mu(const value_type mu); 00062 00064 value_type barrier_term() const; 00065 00067 value_type objective_term() const; 00068 00070 const Teuchos::RCP<Vector> grad_barrier_term() const; 00071 00073 const Teuchos::RCP<Vector> grad_objective_term() const; 00074 00076 00079 00082 NLPBarrier(); 00083 00085 void InitializeFromNLP( 00086 Teuchos::RCP<NLP> original_nlp 00087 ); 00088 00090 00093 00095 void initialize(bool test_setup) 00096 { nlp_->initialize(test_setup); } 00098 bool is_initialized() const 00099 { return nlp_->is_initialized(); } 00101 void set_Gf(VectorMutable* Gf) 00102 { nlp_->set_Gf(Gf); } 00104 VectorMutable* get_Gf() 00105 { return nlp_->get_Gf(); } 00107 VectorMutable& Gf() 00108 { return nlp_->Gf(); } 00110 const Vector& Gf() const 00111 { return nlp_->Gf(); } 00113 void calc_Gf(const Vector& x, bool newx = true) const; 00115 size_type num_Gf_evals() const 00116 { return nlp_->num_Gf_evals(); } 00117 00119 00122 00124 void force_xinit_in_bounds(bool force_xinit_in_bounds) 00125 { nlp_->force_xinit_in_bounds(force_xinit_in_bounds); } 00127 bool force_xinit_in_bounds() const 00128 { return nlp_->force_xinit_in_bounds(); } 00130 size_type n() const 00131 { return nlp_->n(); } 00133 size_type m() const 00134 { return nlp_->m(); } 00136 vec_space_ptr_t space_x() const 00137 { return nlp_->space_x(); } 00139 vec_space_ptr_t space_c() const 00140 { return nlp_->space_c(); } 00142 size_type num_bounded_x() const 00143 { return nlp_->num_bounded_x(); } 00145 const Vector& xl() const 00146 { return nlp_->xl(); } 00148 const Vector& xu() const 00149 { return nlp_->xu(); } 00151 value_type max_var_bounds_viol() const 00152 { return nlp_->max_var_bounds_viol(); } 00154 const Vector& xinit() const 00155 { return nlp_->xinit(); } 00157 void get_init_lagrange_mult( 00158 VectorMutable* lambda 00159 ,VectorMutable* nu 00160 ) const 00161 { nlp_->get_init_lagrange_mult(lambda, nu); } 00163 void set_f(value_type* f) 00164 { nlp_->set_f(f); } 00166 value_type* get_f() 00167 { return nlp_->get_f(); } 00169 value_type& f() 00170 { return nlp_->f(); } 00172 const value_type& f() const 00173 { return nlp_->f(); } 00175 void set_c(VectorMutable* c) 00176 { nlp_->set_c(c); } 00178 VectorMutable* get_c() 00179 { return nlp_->get_c(); } 00181 VectorMutable& c() 00182 { return nlp_->c(); } 00184 const Vector& c() const 00185 { return nlp_->c(); } 00187 void scale_f( value_type scale_f ) 00188 { nlp_->scale_f(); } 00190 value_type scale_f() const 00191 { return nlp_->scale_f(); } 00193 void calc_f(const Vector& x, bool newx = true) const; 00195 void calc_c(const Vector& x, bool newx = true) const 00196 { nlp_->calc_c(x, newx); } 00198 void report_final_solution( 00199 const Vector& x 00200 ,const Vector* lambda 00201 ,const Vector* nu 00202 ,bool is_optimal 00203 ) 00204 { nlp_->report_final_solution( 00205 x, lambda, nu, is_optimal 00206 ); 00207 } 00209 size_type num_f_evals() const 00210 { return nlp_->num_f_evals(); } 00212 size_type num_c_evals() const 00213 { return nlp_->num_c_evals(); } 00215 size_type ns() const 00216 { return nlp_->ns(); } 00218 vec_space_ptr_t space_c_breve() const 00219 { return nlp_->space_c_breve(); } 00221 vec_space_ptr_t space_h_breve() const 00222 { return nlp_->space_h_breve(); } 00224 const Vector& hl_breve() const 00225 { return nlp_->hl_breve(); } 00227 const Vector& hu_breve() const 00228 { return nlp_->hu_breve(); } 00230 void set_c_breve(VectorMutable* c_breve) 00231 { nlp_->set_c_breve(c_breve); } 00233 VectorMutable* get_c_breve() 00234 { return nlp_->get_c_breve(); } 00236 VectorMutable& c_breve() 00237 { return nlp_->c_breve(); } 00239 const Vector& c_breve() const 00240 { return nlp_->c_breve(); } 00242 void set_h_breve(VectorMutable* h_breve) 00243 { nlp_->set_h_breve(h_breve); } 00245 VectorMutable* get_h_breve() 00246 { return nlp_->get_h_breve(); } 00248 VectorMutable& h_breve() 00249 { return nlp_->h_breve(); } 00251 const Vector& h_breve() const 00252 { return nlp_->h_breve(); } 00254 const Permutation& P_var() const 00255 { return nlp_->P_var(); } 00257 const Permutation& P_equ() const 00258 { return nlp_->P_equ(); } 00260 void calc_c_breve(const Vector& x, bool newx ) const 00261 { nlp_->calc_c_breve(x,newx); } 00263 void calc_h_breve(const Vector& x, bool newx ) const 00264 { nlp_->calc_h_breve(x,newx); } 00265 00267 00268 protected: 00269 00270 /* protected members Overridden from NLP */ 00272 00274 void imp_calc_f( 00275 const Vector& x 00276 ,bool newx 00277 ,const ZeroOrderInfo& zero_order_info 00278 ) const; 00280 void imp_calc_c( 00281 const Vector& x 00282 ,bool newx 00283 ,const ZeroOrderInfo& zero_order_info 00284 ) const; 00286 void imp_calc_c_breve( 00287 const Vector& x 00288 ,bool newx 00289 ,const ZeroOrderInfo& zero_order_info_breve 00290 ) const; 00292 void imp_calc_h_breve( 00293 const Vector& x 00294 ,bool newx 00295 ,const ZeroOrderInfo& zero_order_info_breve 00296 ) const; 00297 00299 00300 /* protected members Overridden from NLPObjGrad */ 00302 00304 void imp_calc_Gf( 00305 const Vector& x, 00306 bool newx, 00307 const ObjGradInfo& obj_grad_info 00308 ) const; 00309 00311 00312 private: 00313 00314 Teuchos::RCP<NLPObjGrad> nlp_; 00315 value_type mu_; 00316 mutable value_type barrier_term_; 00317 mutable value_type objective_term_; 00318 mutable Teuchos::RCP<VectorMutable> grad_barrier_term_; 00319 mutable Teuchos::RCP<VectorMutable> grad_barrier_term_temp_; 00320 mutable Teuchos::RCP<VectorMutable> grad_objective_term_; 00321 00322 value_type CalculateBarrierTerm(const Vector& x) const; 00323 00324 }; // end class NLPBarrier 00325 00326 } // end namespace NLPInterfacePack 00327 00328 #endif // BARRIER_NLP_H
1.7.6.1