/usr/include/trilinos/NLPInterfacePack_NLPBarrier.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | // @HEADER
// ***********************************************************************
//
// Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
// Copyright (2003) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
// Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
//
// ***********************************************************************
// @HEADER
#ifndef BARRIER_NLP_H
#define BARRIER_NLP_H
#include "NLPInterfacePack_NLPObjGrad.hpp"
namespace NLPInterfacePack {
/** \brief Simple wrapper that provides an objective fn with the barrier term
* included.
*
*/
class NLPBarrier : public NLPObjGrad
{
public:
/** @name Public Methods */
//@{
/// Set the barrier parameter.
void mu(const value_type mu);
/// Get the barrier term. Must be called after <tt>calc_f()</tt>.
value_type barrier_term() const;
/// Get the true objective term value. Must be called after <tt>calc_f()</tt>.
value_type objective_term() const;
/// Get the value of the gradient of the barrier term. Must be called after <tt>calc_Gf()</tt>
const Teuchos::RCP<Vector> grad_barrier_term() const;
/// Get the value of the gradient of the true objective term. Must be called after <tt>calc_Gf()</tt>.
const Teuchos::RCP<Vector> grad_objective_term() const;
//@}
/** @name Constructors / initializers */
//@{
/** \brief Constructor.
*/
NLPBarrier();
/** \brief . */
void InitializeFromNLP(
Teuchos::RCP<NLP> original_nlp
);
//@}
/** @name Overridden public members from NLPObjGrad */
//@{
/** \brief . */
void initialize(bool test_setup)
{ nlp_->initialize(test_setup); }
/** \brief . */
bool is_initialized() const
{ return nlp_->is_initialized(); }
/** \brief . */
void set_Gf(VectorMutable* Gf)
{ nlp_->set_Gf(Gf); }
/** \brief . */
VectorMutable* get_Gf()
{ return nlp_->get_Gf(); }
/** \brief . */
VectorMutable& Gf()
{ return nlp_->Gf(); }
/** \brief . */
const Vector& Gf() const
{ return nlp_->Gf(); }
/// Overloaded to include barrier term
void calc_Gf(const Vector& x, bool newx = true) const;
/** \brief . */
size_type num_Gf_evals() const
{ return nlp_->num_Gf_evals(); }
//@}
/** @name Overridden public members from NLP */
//@{
/** \brief . */
void force_xinit_in_bounds(bool force_xinit_in_bounds)
{ nlp_->force_xinit_in_bounds(force_xinit_in_bounds); }
/** \brief . */
bool force_xinit_in_bounds() const
{ return nlp_->force_xinit_in_bounds(); }
/** \brief . */
size_type n() const
{ return nlp_->n(); }
/** \brief . */
size_type m() const
{ return nlp_->m(); }
/** \brief . */
vec_space_ptr_t space_x() const
{ return nlp_->space_x(); }
/** \brief . */
vec_space_ptr_t space_c() const
{ return nlp_->space_c(); }
/** \brief . */
size_type num_bounded_x() const
{ return nlp_->num_bounded_x(); }
/** \brief . */
const Vector& xl() const
{ return nlp_->xl(); }
/** \brief . */
const Vector& xu() const
{ return nlp_->xu(); }
/** \brief . */
value_type max_var_bounds_viol() const
{ return nlp_->max_var_bounds_viol(); }
/** \brief . */
const Vector& xinit() const
{ return nlp_->xinit(); }
/** \brief . */
void get_init_lagrange_mult(
VectorMutable* lambda
,VectorMutable* nu
) const
{ nlp_->get_init_lagrange_mult(lambda, nu); }
/** \brief . */
void set_f(value_type* f)
{ nlp_->set_f(f); }
/** \brief . */
value_type* get_f()
{ return nlp_->get_f(); }
/** \brief . */
value_type& f()
{ return nlp_->f(); }
/** \brief . */
const value_type& f() const
{ return nlp_->f(); }
/** \brief . */
void set_c(VectorMutable* c)
{ nlp_->set_c(c); }
/** \brief . */
VectorMutable* get_c()
{ return nlp_->get_c(); }
/** \brief . */
VectorMutable& c()
{ return nlp_->c(); }
/** \brief . */
const Vector& c() const
{ return nlp_->c(); }
/** \brief . */
void scale_f( value_type scale_f )
{ nlp_->scale_f(); }
/** \brief . */
value_type scale_f() const
{ return nlp_->scale_f(); }
/// Overloaded to include barrier term
void calc_f(const Vector& x, bool newx = true) const;
/** \brief . */
void calc_c(const Vector& x, bool newx = true) const
{ nlp_->calc_c(x, newx); }
/** \brief . */
void report_final_solution(
const Vector& x
,const Vector* lambda
,const Vector* nu
,bool is_optimal
)
{ nlp_->report_final_solution(
x, lambda, nu, is_optimal
);
}
/** \brief . */
size_type num_f_evals() const
{ return nlp_->num_f_evals(); }
/** \brief . */
size_type num_c_evals() const
{ return nlp_->num_c_evals(); }
/** \brief . */
size_type ns() const
{ return nlp_->ns(); }
/** \brief . */
vec_space_ptr_t space_c_breve() const
{ return nlp_->space_c_breve(); }
/** \brief . */
vec_space_ptr_t space_h_breve() const
{ return nlp_->space_h_breve(); }
/** \brief . */
const Vector& hl_breve() const
{ return nlp_->hl_breve(); }
/** \brief . */
const Vector& hu_breve() const
{ return nlp_->hu_breve(); }
/** \brief . */
void set_c_breve(VectorMutable* c_breve)
{ nlp_->set_c_breve(c_breve); }
/** \brief . */
VectorMutable* get_c_breve()
{ return nlp_->get_c_breve(); }
/** \brief . */
VectorMutable& c_breve()
{ return nlp_->c_breve(); }
/** \brief . */
const Vector& c_breve() const
{ return nlp_->c_breve(); }
/** \brief . */
void set_h_breve(VectorMutable* h_breve)
{ nlp_->set_h_breve(h_breve); }
/** \brief . */
VectorMutable* get_h_breve()
{ return nlp_->get_h_breve(); }
/** \brief . */
VectorMutable& h_breve()
{ return nlp_->h_breve(); }
/** \brief . */
const Vector& h_breve() const
{ return nlp_->h_breve(); }
/** \brief . */
const Permutation& P_var() const
{ return nlp_->P_var(); }
/** \brief . */
const Permutation& P_equ() const
{ return nlp_->P_equ(); }
/** \brief . */
void calc_c_breve(const Vector& x, bool newx ) const
{ nlp_->calc_c_breve(x,newx); }
/** \brief . */
void calc_h_breve(const Vector& x, bool newx ) const
{ nlp_->calc_h_breve(x,newx); }
//@}
protected:
/* protected members Overridden from NLP */
//@{
/** \brief . */
void imp_calc_f(
const Vector& x
,bool newx
,const ZeroOrderInfo& zero_order_info
) const;
/** \brief . */
void imp_calc_c(
const Vector& x
,bool newx
,const ZeroOrderInfo& zero_order_info
) const;
/** \brief . */
void imp_calc_c_breve(
const Vector& x
,bool newx
,const ZeroOrderInfo& zero_order_info_breve
) const;
/** \brief . */
void imp_calc_h_breve(
const Vector& x
,bool newx
,const ZeroOrderInfo& zero_order_info_breve
) const;
//@}
/* protected members Overridden from NLPObjGrad */
//@{
/** \brief . */
void imp_calc_Gf(
const Vector& x,
bool newx,
const ObjGradInfo& obj_grad_info
) const;
//@}
private:
Teuchos::RCP<NLPObjGrad> nlp_;
value_type mu_;
mutable value_type barrier_term_;
mutable value_type objective_term_;
mutable Teuchos::RCP<VectorMutable> grad_barrier_term_;
mutable Teuchos::RCP<VectorMutable> grad_barrier_term_temp_;
mutable Teuchos::RCP<VectorMutable> grad_objective_term_;
value_type CalculateBarrierTerm(const Vector& x) const;
}; // end class NLPBarrier
} // end namespace NLPInterfacePack
#endif // BARRIER_NLP_H
|