OptiPack_UnconstrainedOptMeritFunc1D_decl.hpp

00001 /*
00002 // @HEADER
00003 // ***********************************************************************
00004 // 
00005 //    OptiPack: Collection of simple Thyra-based Optimization ANAs
00006 //                 Copyright (2009) Sandia Corporation
00007 // 
00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 // license for use of this work by or on behalf of the U.S. Government.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 // 
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 // 
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA
00025 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00026 // 
00027 // ***********************************************************************
00028 // @HEADER
00029 */
00030 
00031 #ifndef OPTIPACK_UNCONSTRAINED_OPT_MERIT_FUNC_1D_DECL_HPP
00032 #define OPTIPACK_UNCONSTRAINED_OPT_MERIT_FUNC_1D_DECL_HPP
00033 
00034 
00035 #include "OptiPack_Types.hpp"
00036 #include "GlobiPack_MeritFunc1DBase.hpp"
00037 #include "OptiPack_LineSearchPointEvaluatorBase.hpp"
00038 #include "Thyra_OperatorVectorTypes.hpp"
00039 
00040 
00041 namespace OptiPack {
00042 
00043 
00052 template<typename Scalar>
00053 class UnconstrainedOptMeritFunc1D
00054   : public GlobiPack::MeritFunc1DBase<typename ScalarTraits<Scalar>::magnitudeType>
00055 {
00056 public:
00057 
00059   typedef typename ScalarTraits<Scalar>::magnitudeType ScalarMag;
00060 
00063 
00065   UnconstrainedOptMeritFunc1D();
00066 
00068   void setModel(
00069     const RCP<const Thyra::ModelEvaluator<Scalar> > &model,
00070     const int paramIndex,
00071     const int responseIndex
00072     );
00073 
00100   void setEvaluationQuantities(
00101     const RCP<const LineSearchPointEvaluatorBase<Scalar> > &pointEvaluator,
00102     const RCP<Thyra::VectorBase<Scalar> > &p,
00103     const RCP<Thyra::VectorBase<Scalar> > &g_vec,
00104     const RCP<Thyra::VectorBase<Scalar> > &g_grad_vec
00105     );
00106 
00108 
00111   
00113   virtual bool supportsDerivEvals() const;
00115   virtual void eval( const ScalarMag &alpha, const Ptr<ScalarMag> &phi,
00116     const Ptr<ScalarMag> &Dphi ) const;
00117 
00119 
00120 private:
00121 
00122   // //////////////////////
00123   // Private data members
00124 
00125   RCP<const Thyra::ModelEvaluator<Scalar> > model_;
00126   int paramIndex_;
00127   int responseIndex_;
00128 
00129   RCP<const LineSearchPointEvaluatorBase<Scalar> > pointEvaluator_;
00130   RCP<Thyra::VectorBase<Scalar> > p_;
00131   RCP<Thyra::VectorBase<Scalar> > g_vec_;
00132   RCP<Thyra::VectorBase<Scalar> > g_grad_vec_;
00133 
00134 };
00135 
00136 
00141 template<typename Scalar>
00142 const RCP<UnconstrainedOptMeritFunc1D<Scalar> >
00143 unconstrainedOptMeritFunc1D(
00144   const RCP<const Thyra::ModelEvaluator<Scalar> > &model,
00145   const int paramIndex,
00146   const int responseIndex
00147   )
00148 {
00149   const RCP<UnconstrainedOptMeritFunc1D<Scalar> > meritFunc = 
00150     Teuchos::rcp(new UnconstrainedOptMeritFunc1D<Scalar>);
00151   meritFunc->setModel(model, paramIndex, responseIndex);
00152   return meritFunc;
00153 }
00154 
00155 
00156 } // namespace OptiPack
00157 
00158 
00159 #endif // OPTIPACK_UNCONSTRAINED_OPT_MERIT_FUNC_1D_DECL_HPP

Generated on Tue Jul 13 09:37:12 2010 for OptiPack by  doxygen 1.4.7