MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NLPInterfacePack_NLPBarrier.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef BARRIER_NLP_H
43 #define BARRIER_NLP_H
44 
46 
47 namespace NLPInterfacePack {
48 
53 class NLPBarrier : public NLPObjGrad
54 {
55 public:
56 
59 
61  void mu(const value_type mu);
62 
64  value_type barrier_term() const;
65 
67  value_type objective_term() const;
68 
71 
74 
76 
79 
82  NLPBarrier();
83 
85  void InitializeFromNLP(
86  Teuchos::RCP<NLP> original_nlp
87  );
88 
90 
93 
95  void initialize(bool test_setup)
96  { nlp_->initialize(test_setup); }
98  bool is_initialized() const
99  { return nlp_->is_initialized(); }
102  { nlp_->set_Gf(Gf); }
105  { return nlp_->get_Gf(); }
108  { return nlp_->Gf(); }
110  const Vector& Gf() const
111  { return nlp_->Gf(); }
113  void calc_Gf(const Vector& x, bool newx = true) const;
116  { return nlp_->num_Gf_evals(); }
117 
119 
122 
125  { nlp_->force_xinit_in_bounds(force_xinit_in_bounds); }
128  { return nlp_->force_xinit_in_bounds(); }
130  size_type n() const
131  { return nlp_->n(); }
133  size_type m() const
134  { return nlp_->m(); }
137  { return nlp_->space_x(); }
140  { return nlp_->space_c(); }
143  { return nlp_->num_bounded_x(); }
145  const Vector& xl() const
146  { return nlp_->xl(); }
148  const Vector& xu() const
149  { return nlp_->xu(); }
152  { return nlp_->max_var_bounds_viol(); }
154  const Vector& xinit() const
155  { return nlp_->xinit(); }
158  VectorMutable* lambda
159  ,VectorMutable* nu
160  ) const
161  { nlp_->get_init_lagrange_mult(lambda, nu); }
164  { nlp_->set_f(f); }
167  { return nlp_->get_f(); }
170  { return nlp_->f(); }
172  const value_type& f() const
173  { return nlp_->f(); }
176  { nlp_->set_c(c); }
179  { return nlp_->get_c(); }
182  { return nlp_->c(); }
184  const Vector& c() const
185  { return nlp_->c(); }
188  { nlp_->scale_f(); }
191  { return nlp_->scale_f(); }
193  void calc_f(const Vector& x, bool newx = true) const;
195  void calc_c(const Vector& x, bool newx = true) const
196  { nlp_->calc_c(x, newx); }
199  const Vector& x
200  ,const Vector* lambda
201  ,const Vector* nu
202  ,bool is_optimal
203  )
204  { nlp_->report_final_solution(
205  x, lambda, nu, is_optimal
206  );
207  }
210  { return nlp_->num_f_evals(); }
213  { return nlp_->num_c_evals(); }
215  size_type ns() const
216  { return nlp_->ns(); }
219  { return nlp_->space_c_breve(); }
222  { return nlp_->space_h_breve(); }
224  const Vector& hl_breve() const
225  { return nlp_->hl_breve(); }
227  const Vector& hu_breve() const
228  { return nlp_->hu_breve(); }
231  { nlp_->set_c_breve(c_breve); }
234  { return nlp_->get_c_breve(); }
237  { return nlp_->c_breve(); }
239  const Vector& c_breve() const
240  { return nlp_->c_breve(); }
243  { nlp_->set_h_breve(h_breve); }
246  { return nlp_->get_h_breve(); }
249  { return nlp_->h_breve(); }
251  const Vector& h_breve() const
252  { return nlp_->h_breve(); }
254  const Permutation& P_var() const
255  { return nlp_->P_var(); }
257  const Permutation& P_equ() const
258  { return nlp_->P_equ(); }
260  void calc_c_breve(const Vector& x, bool newx ) const
261  { nlp_->calc_c_breve(x,newx); }
263  void calc_h_breve(const Vector& x, bool newx ) const
264  { nlp_->calc_h_breve(x,newx); }
265 
267 
268 protected:
269 
270  /* protected members Overridden from NLP */
272 
274  void imp_calc_f(
275  const Vector& x
276  ,bool newx
277  ,const ZeroOrderInfo& zero_order_info
278  ) const;
280  void imp_calc_c(
281  const Vector& x
282  ,bool newx
283  ,const ZeroOrderInfo& zero_order_info
284  ) const;
286  void imp_calc_c_breve(
287  const Vector& x
288  ,bool newx
289  ,const ZeroOrderInfo& zero_order_info_breve
290  ) const;
292  void imp_calc_h_breve(
293  const Vector& x
294  ,bool newx
295  ,const ZeroOrderInfo& zero_order_info_breve
296  ) const;
297 
299 
300  /* protected members Overridden from NLPObjGrad */
302 
304  void imp_calc_Gf(
305  const Vector& x,
306  bool newx,
307  const ObjGradInfo& obj_grad_info
308  ) const;
309 
311 
312 private:
313 
321 
322  value_type CalculateBarrierTerm(const Vector& x) const;
323 
324 }; // end class NLPBarrier
325 
326 } // end namespace NLPInterfacePack
327 
328 #endif // BARRIER_NLP_H
NLP interface class that adds gradient information for the objective function {abstract}.
AbstractLinAlgPack::size_type size_type
value_type barrier_term() const
Get the barrier term. Must be called after calc_f().
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
void imp_calc_c(const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info) const
void report_final_solution(const Vector &x, const Vector *lambda, const Vector *nu, bool is_optimal)
void calc_h_breve(const Vector &x, bool newx) const
void calc_f(const Vector &x, bool newx=true) const
Overloaded to include barrier term.
AbstractLinAlgPack::Vector Vector
void InitializeFromNLP(Teuchos::RCP< NLP > original_nlp)
const ZeroOrderInfo zero_order_info() const
Return pointer to set quantities.
const Teuchos::RCP< Vector > grad_objective_term() const
Get the value of the gradient of the true objective term. Must be called after calc_Gf().
const ObjGradInfo obj_grad_info() const
Return objective gradient and zero order information.
void imp_calc_c_breve(const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info_breve) const
Simple wrapper that provides an objective fn with the barrier term included.
void mu(const value_type mu)
Set the barrier parameter.
Teuchos::RCP< VectorMutable > grad_objective_term_
Teuchos::RCP< VectorMutable > grad_barrier_term_temp_
Teuchos::RCP< VectorMutable > grad_barrier_term_
const ZeroOrderInfo zero_order_info_breve() const
Return pointer to set hat quantities.
void set_h_breve(VectorMutable *h_breve)
value_type CalculateBarrierTerm(const Vector &x) const
void get_init_lagrange_mult(VectorMutable *lambda, VectorMutable *nu) const
void set_c_breve(VectorMutable *c_breve)
void imp_calc_h_breve(const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info_breve) const
value_type objective_term() const
Get the true objective term value. Must be called after calc_f().
void calc_c(const Vector &x, bool newx=true) const
void force_xinit_in_bounds(bool force_xinit_in_bounds)
void imp_calc_Gf(const Vector &x, bool newx, const ObjGradInfo &obj_grad_info) const
AbstractLinAlgPack::value_type value_type
Abstract interface for mutable coordinate vectors {abstract}.
const Teuchos::RCP< Vector > grad_barrier_term() const
Get the value of the gradient of the barrier term. Must be called after calc_Gf() ...
void imp_calc_f(const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info) const
void calc_c_breve(const Vector &x, bool newx) const
void calc_Gf(const Vector &x, bool newx=true) const
Overloaded to include barrier term.