NLPInterfacePack_NLPFirstOrder.hpp

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_FIRST_ORDER_INFO_H
00030 #define NLP_FIRST_ORDER_INFO_H
00031 
00032 #include "NLPInterfacePack_NLPObjGrad.hpp"
00033 #include "Teuchos_AbstractFactory.hpp"
00034 
00035 namespace NLPInterfacePack {
00076 class NLPFirstOrder : virtual public NLPObjGrad {
00077 public:
00078 
00080   typedef Teuchos::RCP<
00081     const Teuchos::AbstractFactory<MatrixOp> >        mat_fcty_ptr_t;
00083   typedef Teuchos::RCP<BasisSystem>           basis_sys_ptr_t;
00084 
00087 
00089   NLPFirstOrder();
00090 
00092 
00095 
00109   void initialize(bool test_setup);
00110 
00112 
00115   
00121   virtual const mat_fcty_ptr_t factory_Gc() const = 0;
00122 
00124 
00127 
00135   virtual const basis_sys_ptr_t basis_sys() const;
00136 
00138 
00141 
00156   virtual void set_Gc(MatrixOp* Gc);
00163   virtual MatrixOp* get_Gc();
00171   virtual MatrixOp& Gc();
00179   virtual const MatrixOp& Gc() const;
00180 
00182 
00185   
00199   void unset_quantities();
00200 
00202 
00205 
00229   virtual void calc_Gc(const Vector& x, bool newx = true) const;
00230 
00232 
00235 
00241   virtual size_type num_Gc_evals() const;
00242 
00244 
00247   struct FirstOrderInfo {
00249     FirstOrderInfo()
00250       : Gc(NULL), Gf(NULL), f(NULL), c(NULL)
00251     {}
00253     FirstOrderInfo( MatrixOp* Gc_in, const ObjGradInfo& obj_grad )
00254       : Gc(Gc_in), Gf(obj_grad.Gf), f(obj_grad.f), c(obj_grad.c)
00255     {}
00257     MatrixOp*           Gc;
00259     VectorMutable*      Gf;
00261     value_type*         f;
00263     VectorMutable*      c;
00264   }; // end struct FirstOrderInfo
00265 
00266 protected:
00267 
00269   const FirstOrderInfo first_order_info() const;
00270 
00273 
00296   virtual void imp_calc_Gc(const Vector& x, bool newx, const FirstOrderInfo& first_order_info) const = 0;
00297 
00299 
00300 private:
00301 
00302 #ifdef DOXYGEN_COMPILE
00303   AbstractLinAlgPack::BasisSystem                            *basis_sys;
00304   Teuchos::AbstractFactory<AbstractLinAlgPack::MatrixOp>  *factory_Gc;
00305 #endif
00306   mutable MatrixOp      *Gc_;
00307   mutable size_type     num_Gc_evals_;
00308 
00309 };  // end class NLPFirstOrder
00310 
00311 // /////////////////////
00312 // Inline members
00313 
00314 inline
00315 const NLPFirstOrder::FirstOrderInfo NLPFirstOrder::first_order_info() const
00316 {
00317   return FirstOrderInfo(Gc_,obj_grad_info());
00318 }
00319 
00320 } // end namespace NLPInterfacePack 
00321 
00322 #endif // NLP_FIRST_ORDER_INFO_H

Generated on Tue Jul 13 09:29:13 2010 for NLPInterfacePack: C++ Interfaces and Implementation for Non-Linear Programs by  doxygen 1.4.7