// @HEADER // ***************************************************************************** // NOX: An Object-Oriented Nonlinear Solver Package // // Copyright 2002 NTESS and the NOX contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef NOX_THYRA_ROSENBROCK_MODEL_EVALUATOR_HPP #define NOX_THYRA_ROSENBROCK_MODEL_EVALUATOR_HPP #include "Thyra_StateFuncModelEvaluatorBase.hpp" #include "Epetra_Map.h" #include "Epetra_Vector.h" #include "Epetra_Comm.h" #include "Epetra_CrsGraph.h" /** \brief ModelEvaluator for the Roesenbrock problem This example is the "%Rosenbrock function" from Jorge J. More', Burton S. Garbow, and Kenneth E. Hillstrom, Testing Unconstrained Optimization Software, ACM TOMS, Vol. 7, No. 1, March 1981, pp. 14-41. It comes originally from H. H. %Rosenbrock, An Automatic Method for Finding the Greatest or Least Value of a Function, J. Comput. 3(1960):175-184. The function is defined as \f[ F(x) = \left[ \begin{array}{c} 10 (x[2] - x[1]^2) \\ 1 - x[1] \end{array} \right] \f] The initial guess is given by \f[ x_0 = \left[ \begin{array}{c} -1.2\\ 1 \end{array} \right] \f] The solution is \f[ x_* = \left[ \begin{array}{c} 1\\ 1 \end{array} \right] \f] */ class RosenbrockModelEvaluator : public Thyra::StateFuncModelEvaluatorBase { public: RosenbrockModelEvaluator(const Teuchos::RCP& comm); /** \name Public functions overridden from ModelEvaulator. */ //@{ Teuchos::RCP > get_x_space() const; Teuchos::RCP > get_f_space() const; Thyra::ModelEvaluatorBase::InArgs getNominalValues() const; Teuchos::RCP > create_W_op() const; Teuchos::RCP > get_W_factory() const; Thyra::ModelEvaluatorBase::InArgs createInArgs() const; //@} void set_W_factory(const Teuchos::RCP >& W_factory); Teuchos::RCP get_analytic_solution() const; private: /** \name Private functions overridden from ModelEvaulatorDefaultBase. */ //@{ Thyra::ModelEvaluatorBase::OutArgs createOutArgsImpl() const; void evalModelImpl( const Thyra::ModelEvaluatorBase::InArgs &inArgs, const Thyra::ModelEvaluatorBase::OutArgs &outArgs ) const; //@} private: double d_; Teuchos::RCP epetra_comm_; Teuchos::RCP > x_space_; Teuchos::RCP map_x_; Teuchos::RCP > f_space_; Teuchos::RCP f_epetra_map_; Teuchos::RCP x0_; Teuchos::RCP x_analytic_; Teuchos::RCP W_graph_; Teuchos::RCP > W_factory_; mutable Thyra::ModelEvaluatorBase::InArgs nominal_values_; }; #endif