68 namespace rcp = MemMngPack;
78 *out <<
"\n*********************************"
79 <<
"\n*** test_nlp_first_order(...) ***"
80 <<
"\n*********************************\n";
86 *out <<
"\nTesting the vector spaces ...\n";
88 VectorSpaceTester vec_space_tester;
90 VectorSpaceTesterSetOptions
91 opt_setter(&vec_space_tester);
92 opt_setter.set_options(*options);
96 *out <<
"\nTesting nlp->space_x() ...\n";
97 result = vec_space_tester.check_vector_space(*nlp->
space_x(),
out);
100 *out <<
"nlp->space_x() checks out!\n";
102 *out <<
"nlp->space_x() check failed!\n";
108 *out <<
"\nTesting nlp->space_c() ...\n";
109 result = vec_space_tester.check_vector_space(*nlp->
space_c(),
out);
112 *out <<
"nlp->space_c() checks out!\n";
114 *out <<
"nlp->space_c() check failed!\n";
124 nlp_tester_opt_setter(&nlp_tester);
127 const bool print_all_warnings = nlp_tester.print_all();
130 nlp, nlp->
xinit(), print_all_warnings,
out );
138 VectorSpace::vec_mut_ptr_t
140 Gf = nlp->
space_x()->create_member();
141 NLPFirstOrder::mat_fcty_ptr_t::element_type::obj_ptr_t
146 *out <<
"\nCalling nlp->calc_Gc(...) at nlp->xinit() ...\n";
149 if(nlp_tester.print_all()) {
150 *out <<
"\nGc =\n" << *Gc;
155 *out <<
"\nCalling nlp->calc_Gf(...) at nlp->xinit() ...\n";
158 if(nlp_tester.print_all())
159 *out <<
"\nGf =\n" << *Gf;
165 options_setter( &calc_fd_prod );
169 nlp_first_derivatives_tester(
Teuchos::rcp(&calc_fd_prod,
false));
172 nlp_tester_opt_setter(&nlp_first_derivatives_tester);
180 ,print_all_warnings,
out
Extracts options from a text stream and then allows convenient access to them.
AbstractLinAlgPack::size_type size_type
virtual void calc_Gc(const Vector &x, bool newx=true) const
Update the matrix for Gc at the point x and put it in the stored reference.
void initialize(bool test_setup)
Initialize the NLP for its first use.
bool test_interface(NLP *nlp, const Vector &xo, bool print_all_warnings, std::ostream *out)
Test the NLP interface as the given base point xo.
virtual vec_space_ptr_t space_x() const =0
Vector space object for unknown variables x (dimension n).
void set_options(const OptionsFromStream &options)
Overridden from SetOptionsFromStream and calls setOption(...).
Set options for NLPTester from an OptionsFromStream object.
bool test_nlp_first_order(NLPFirstOrder *nlp, OptionsFromStreamPack::OptionsFromStream *options, std::ostream *out)
Test an NLPFirstOrder object.
Set options for CalcFiniteDiffProd from an OptionsFromStream object.
Teuchos::AbstractFactory< AbstractLinAlgPack::MatrixOp > * factory_Gc
Testing class for base NLP interface.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Strategy interface for computing the product of the derivatives of the functions of an NLP along give...
virtual size_type n() const
Return the number of variables.
virtual vec_space_ptr_t space_c() const =0
Vector space object for general equality constraints c(x) (dimension m).
virtual const Vector & xl() const =0
Returns the lower bounds on the variables x.
bool finite_diff_check(NLP *nlp, const Vector &xo, const Vector *xl, const Vector *xu, const MatrixOp *Gc, const Vector *Gf, bool print_all_warnings, std::ostream *out) const
This function takes an NLP object and its computed derivatives and function values and validates the ...
virtual size_type num_bounded_x() const =0
Returns the number of variables in x(i) for which xl(i)> -infinite_bound() or xu(i) < +infinite_bound...
virtual const Vector & xu() const =0
Returns a reference to the vector of upper bounds on the variables x.
Set options for NLPFirstDerivTester from an OptionsFromStream object.
NLP first order information interface class {abstract}.
virtual obj_ptr_t create() const =0
bool update_success(bool result_check, bool *success)
Helper function for updating a flag for if an operation returned false.
Concrete class that tests the derivatives using finite differences.
virtual const Vector & xinit() const =0
Returns a reference to the vector of the initial guess for the solution x.
virtual size_type m() const
Return the number of general equality constraints.
virtual void set_Gf(VectorMutable *Gf)
Set a pointer to a vector to be updated when this->calc_Gf() is called.
virtual void calc_Gf(const Vector &x, bool newx=true) const
Update the vector for Gf at the point x and put it in the stored reference.
virtual void set_Gc(MatrixOp *Gc)
Set a pointer to a matrix object to be updated when this->calc_Gc() is called.