MOOCHO (Single Doxygen Collection) Version of the Day
NLPInterfacePack_ExampleNLPDirect.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 EXAMPLE_NLP_FIRST_ORDER_DIRECT_H
00030 #define EXAMPLE_NLP_FIRST_ORDER_DIRECT_H
00031 
00032 #include "NLPInterfacePack_ExampleNLPObjGrad.hpp"
00033 #include "NLPInterfacePack_NLPDirect.hpp"
00034 #include "AbstractLinAlgPack_VectorMutable.hpp"
00035 #include "AbstractLinAlgPack_VectorSpace.hpp"
00036 #include "AbstractLinAlgPack_VectorSpaceBlocked.hpp"
00037 
00038 namespace NLPInterfacePack {
00039 
00090 class ExampleNLPDirect
00091   : virtual public NLPDirect
00092   , virtual public ExampleNLPObjGrad
00093 {
00094 public:
00095 
00109   ExampleNLPDirect(
00110     const VectorSpace::space_ptr_t&  vec_space
00111     ,value_type                      xo
00112     ,bool                            has_bounds
00113     ,bool                            dep_bounded
00114     );
00115 
00118 
00120   void initialize(bool test_setup);
00122   bool is_initialized() const;
00123 
00125 
00128 
00130   Range1D var_dep() const;
00132   Range1D var_indep() const;
00134   const mat_fcty_ptr_t factory_D() const;
00136   void calc_point(
00137     const Vector     &x
00138     ,value_type      *f
00139     ,VectorMutable   *c
00140     ,bool            recalc_c
00141     ,VectorMutable   *Gf
00142     ,VectorMutable   *py
00143     ,VectorMutable   *rGf
00144     ,MatrixOp        *GcU
00145     ,MatrixOp        *D
00146     ,MatrixOp        *Uz
00147     ) const;
00149   void calc_semi_newton_step(
00150     const Vector    &x
00151     ,VectorMutable  *c
00152     ,bool           recalc_c
00153     ,VectorMutable  *py
00154     ) const;
00155 
00157 
00158 private:
00159 
00160   // /////////////////////////////////////////
00161   // Private data members
00162 
00163   mat_fcty_ptr_t   factory_D_;         // Matrix space object for D
00164 
00165   bool             initialized_;            // flag for if initialized has been called.
00166 
00167   // /////////////////////////////////////////
00168   // Private member functions
00169 
00171   void assert_is_initialized() const;
00172 
00173 };  // end class ExampleNLPDirect
00174 
00175 // ///////////////////////////////////////////////
00176 // Inline member functions
00177 
00178 inline
00179 void ExampleNLPDirect::assert_is_initialized() const
00180 {
00181   typedef NLPInterfacePack::NLP NLP;
00182   if( !is_initialized() )
00183     throw NLP::UnInitialized("ExampleNLPDirect::assert_is_initialized() : Error, "
00184       "ExampleNLPDirect::initialize() has not been called yet." );
00185 }
00186 
00187 } // end namespace NLPInterfacePack
00188 
00189 #endif  // EXAMPLE_NLP_FIRST_ORDER_DIRECT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines