NLPInterfacePack_NLPObjGrad.hpp

Go to the documentation of this file.
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 NLP_OBJ_GRADIENT_H
00030 #define NLP_OBJ_GRADIENT_H
00031 
00032 #include "NLPInterfacePack_NLP.hpp"
00033 
00034 namespace NLPInterfacePack {
00066 class NLPObjGrad : virtual public NLP {
00067 public:
00068 
00071 
00073   NLPObjGrad();
00074 
00076 
00079 
00091   void initialize(bool test_setup);
00092 
00094 
00097 
00102   virtual bool supports_Gf() const;
00103 
00108   virtual bool supports_Gf_prod() const;
00109 
00111 
00114 
00130   virtual void set_Gf(VectorMutable* Gf);
00138   virtual VectorMutable* get_Gf();
00147   virtual VectorMutable& Gf();
00156   virtual const Vector& Gf() const;
00157 
00159 
00162   
00176   void unset_quantities();
00177 
00179 
00182 
00206   virtual void calc_Gf(const Vector& x, bool newx = true) const;
00207 
00231   virtual value_type calc_Gf_prod(const Vector& x, const Vector& d, bool newx = true) const;
00232 
00234 
00236 
00239 
00245   virtual size_type num_Gf_evals() const;
00246   
00248 
00251   
00254   struct ObjGradInfo {
00256     ObjGradInfo()
00257       : Gf(NULL), f(NULL), c(NULL)
00258     {}
00260     ObjGradInfo( VectorMutable* Gf_in, const ZeroOrderInfo& first_order_info_in )
00261       : Gf(Gf_in), f(first_order_info_in.f), c(first_order_info_in.c)
00262     {}
00264     VectorMutable*       Gf;
00266     value_type*          f;
00268     VectorMutable*       c;
00269   }; // end struct ObjGradInfo
00270 
00272 
00273 protected:
00274 
00276   const ObjGradInfo obj_grad_info() const;
00277 
00280 
00304   virtual void imp_calc_Gf(const Vector& x, bool newx, const ObjGradInfo& obj_grad_info) const = 0;
00305 
00307 
00308 private:
00309 
00310   mutable VectorMutable     *Gf_;
00311   mutable size_type         num_Gf_evals_;
00312 
00313 };  // end class NLPObjGrad
00314 
00315 // //////////////////
00316 // Inline members
00317 
00318 inline
00319 const NLPObjGrad::ObjGradInfo NLPObjGrad::obj_grad_info() const
00320 {
00321   return ObjGradInfo(Gf_,zero_order_info());
00322 }
00323 
00324 } // end namespace NLPInterfacePack 
00325 
00326 #endif // NLP_OBJ_GRADIENT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 10:11:01 2011 for MOOCHO (Single Doxygen Collection) by  doxygen 1.6.3