NLPInterfacePack_NLPFirstDerivTester.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_FIRST_DERIVATIVES_TESTER_H
00030 #define NLP_FIRST_DERIVATIVES_TESTER_H
00031 
00032 #include <iosfwd>
00033 
00034 #include "NLPInterfacePack_Types.hpp"
00035 #include "NLPInterfacePack_CalcFiniteDiffProd.hpp"
00036 #include "Teuchos_StandardCompositionMacros.hpp"
00037 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00038 
00039 namespace NLPInterfacePack {
00040 
00120 class NLPFirstDerivTester {
00121 public:
00122 
00124   enum ETestingMethod {
00125     FD_COMPUTE_ALL
00126     ,FD_DIRECTIONAL
00127   };
00128 
00130   STANDARD_COMPOSITION_MEMBERS( CalcFiniteDiffProd, calc_fd_prod )
00132   STANDARD_MEMBER_COMPOSITION_MEMBERS( ETestingMethod, fd_testing_method )
00134   STANDARD_MEMBER_COMPOSITION_MEMBERS( size_type, num_fd_directions )
00136   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, warning_tol )
00138   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, error_tol )
00139 
00141   NLPFirstDerivTester(
00142     const calc_fd_prod_ptr_t  &calc_fd_prod      = Teuchos::rcp(new CalcFiniteDiffProd())
00143     ,ETestingMethod           fd_testing_method  = FD_DIRECTIONAL
00144     ,size_type                num_fd_directions  = 1
00145     ,value_type               warning_tol        = 1e-8
00146     ,value_type               error_tol          = 1e-3
00147     );
00148 
00177   bool finite_diff_check(
00178     NLP               *nlp
00179     ,const Vector     &xo
00180     ,const Vector     *xl
00181     ,const Vector     *xu
00182     ,const MatrixOp   *Gc
00183     ,const Vector     *Gf
00184     ,bool             print_all_warnings
00185     ,std::ostream     *out
00186     ) const;
00187 
00188 private:
00189 
00191   bool fd_check_all(
00192     NLP               *nlp
00193     ,const Vector     &xo
00194     ,const Vector     *xl
00195     ,const Vector     *xu
00196     ,const MatrixOp   *Gc
00197     ,const Vector     *Gf
00198     ,bool             print_all_warnings
00199     ,std::ostream     *out
00200     ) const;
00201 
00203   bool fd_directional_check(
00204     NLP               *nlp
00205     ,const Vector     &xo
00206     ,const Vector     *xl
00207     ,const Vector     *xu
00208     ,const MatrixOp   *Gc
00209     ,const Vector     *Gf
00210     ,bool             print_all_warnings
00211     ,std::ostream     *out
00212     ) const;
00213 };
00214 
00215 } // end namespace NLPInterfacePack
00216 
00217 #endif  // NLP_FIRST_DERIVATIVES_TESTER_H

Generated on Thu Sep 18 12:35:19 2008 for MOOCHO (Single Doxygen Collection) by doxygen 1.3.9.1