|
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 // 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 BARRIER_NLP_H 00030 #define BARRIER_NLP_H 00031 00032 #include "NLPInterfacePack_NLPObjGrad.hpp" 00033 00034 namespace NLPInterfacePack { 00035 00040 class NLPBarrier : public NLPObjGrad 00041 { 00042 public: 00043 00046 00048 void mu(const value_type mu); 00049 00051 value_type barrier_term() const; 00052 00054 value_type objective_term() const; 00055 00057 const Teuchos::RCP<Vector> grad_barrier_term() const; 00058 00060 const Teuchos::RCP<Vector> grad_objective_term() const; 00061 00063 00066 00069 NLPBarrier(); 00070 00072 void InitializeFromNLP( 00073 Teuchos::RCP<NLP> original_nlp 00074 ); 00075 00077 00080 00082 void initialize(bool test_setup) 00083 { nlp_->initialize(test_setup); } 00085 bool is_initialized() const 00086 { return nlp_->is_initialized(); } 00088 void set_Gf(VectorMutable* Gf) 00089 { nlp_->set_Gf(Gf); } 00091 VectorMutable* get_Gf() 00092 { return nlp_->get_Gf(); } 00094 VectorMutable& Gf() 00095 { return nlp_->Gf(); } 00097 const Vector& Gf() const 00098 { return nlp_->Gf(); } 00100 void calc_Gf(const Vector& x, bool newx = true) const; 00102 size_type num_Gf_evals() const 00103 { return nlp_->num_Gf_evals(); } 00104 00106 00109 00111 void force_xinit_in_bounds(bool force_xinit_in_bounds) 00112 { nlp_->force_xinit_in_bounds(force_xinit_in_bounds); } 00114 bool force_xinit_in_bounds() const 00115 { return nlp_->force_xinit_in_bounds(); } 00117 size_type n() const 00118 { return nlp_->n(); } 00120 size_type m() const 00121 { return nlp_->m(); } 00123 vec_space_ptr_t space_x() const 00124 { return nlp_->space_x(); } 00126 vec_space_ptr_t space_c() const 00127 { return nlp_->space_c(); } 00129 size_type num_bounded_x() const 00130 { return nlp_->num_bounded_x(); } 00132 const Vector& xl() const 00133 { return nlp_->xl(); } 00135 const Vector& xu() const 00136 { return nlp_->xu(); } 00138 value_type max_var_bounds_viol() const 00139 { return nlp_->max_var_bounds_viol(); } 00141 const Vector& xinit() const 00142 { return nlp_->xinit(); } 00144 void get_init_lagrange_mult( 00145 VectorMutable* lambda 00146 ,VectorMutable* nu 00147 ) const 00148 { nlp_->get_init_lagrange_mult(lambda, nu); } 00150 void set_f(value_type* f) 00151 { nlp_->set_f(f); } 00153 value_type* get_f() 00154 { return nlp_->get_f(); } 00156 value_type& f() 00157 { return nlp_->f(); } 00159 const value_type& f() const 00160 { return nlp_->f(); } 00162 void set_c(VectorMutable* c) 00163 { nlp_->set_c(c); } 00165 VectorMutable* get_c() 00166 { return nlp_->get_c(); } 00168 VectorMutable& c() 00169 { return nlp_->c(); } 00171 const Vector& c() const 00172 { return nlp_->c(); } 00174 void scale_f( value_type scale_f ) 00175 { nlp_->scale_f(); } 00177 value_type scale_f() const 00178 { return nlp_->scale_f(); } 00180 void calc_f(const Vector& x, bool newx = true) const; 00182 void calc_c(const Vector& x, bool newx = true) const 00183 { nlp_->calc_c(x, newx); } 00185 void report_final_solution( 00186 const Vector& x 00187 ,const Vector* lambda 00188 ,const Vector* nu 00189 ,bool is_optimal 00190 ) 00191 { nlp_->report_final_solution( 00192 x, lambda, nu, is_optimal 00193 ); 00194 } 00196 size_type num_f_evals() const 00197 { return nlp_->num_f_evals(); } 00199 size_type num_c_evals() const 00200 { return nlp_->num_c_evals(); } 00202 size_type ns() const 00203 { return nlp_->ns(); } 00205 vec_space_ptr_t space_c_breve() const 00206 { return nlp_->space_c_breve(); } 00208 vec_space_ptr_t space_h_breve() const 00209 { return nlp_->space_h_breve(); } 00211 const Vector& hl_breve() const 00212 { return nlp_->hl_breve(); } 00214 const Vector& hu_breve() const 00215 { return nlp_->hu_breve(); } 00217 void set_c_breve(VectorMutable* c_breve) 00218 { nlp_->set_c_breve(c_breve); } 00220 VectorMutable* get_c_breve() 00221 { return nlp_->get_c_breve(); } 00223 VectorMutable& c_breve() 00224 { return nlp_->c_breve(); } 00226 const Vector& c_breve() const 00227 { return nlp_->c_breve(); } 00229 void set_h_breve(VectorMutable* h_breve) 00230 { nlp_->set_h_breve(h_breve); } 00232 VectorMutable* get_h_breve() 00233 { return nlp_->get_h_breve(); } 00235 VectorMutable& h_breve() 00236 { return nlp_->h_breve(); } 00238 const Vector& h_breve() const 00239 { return nlp_->h_breve(); } 00241 const Permutation& P_var() const 00242 { return nlp_->P_var(); } 00244 const Permutation& P_equ() const 00245 { return nlp_->P_equ(); } 00247 void calc_c_breve(const Vector& x, bool newx ) const 00248 { nlp_->calc_c_breve(x,newx); } 00250 void calc_h_breve(const Vector& x, bool newx ) const 00251 { nlp_->calc_h_breve(x,newx); } 00252 00254 00255 protected: 00256 00257 /* protected members Overridden from NLP */ 00259 00261 void imp_calc_f( 00262 const Vector& x 00263 ,bool newx 00264 ,const ZeroOrderInfo& zero_order_info 00265 ) const; 00267 void imp_calc_c( 00268 const Vector& x 00269 ,bool newx 00270 ,const ZeroOrderInfo& zero_order_info 00271 ) const; 00273 void imp_calc_c_breve( 00274 const Vector& x 00275 ,bool newx 00276 ,const ZeroOrderInfo& zero_order_info_breve 00277 ) const; 00279 void imp_calc_h_breve( 00280 const Vector& x 00281 ,bool newx 00282 ,const ZeroOrderInfo& zero_order_info_breve 00283 ) const; 00284 00286 00287 /* protected members Overridden from NLPObjGrad */ 00289 00291 void imp_calc_Gf( 00292 const Vector& x, 00293 bool newx, 00294 const ObjGradInfo& obj_grad_info 00295 ) const; 00296 00298 00299 private: 00300 00301 Teuchos::RCP<NLPObjGrad> nlp_; 00302 value_type mu_; 00303 mutable value_type barrier_term_; 00304 mutable value_type objective_term_; 00305 mutable Teuchos::RCP<VectorMutable> grad_barrier_term_; 00306 mutable Teuchos::RCP<VectorMutable> grad_barrier_term_temp_; 00307 mutable Teuchos::RCP<VectorMutable> grad_objective_term_; 00308 00309 value_type CalculateBarrierTerm(const Vector& x) const; 00310 00311 }; // end class NLPBarrier 00312 00313 } // end namespace NLPInterfacePack 00314 00315 #endif // BARRIER_NLP_H
1.7.4