36 #include "Teuchos_GlobalMPISession.hpp"
42 int main(
int argc,
char *argv[]) {
49 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
52 int iprint = argc - 1;
53 ROL::Ptr<std::ostream> outStream;
56 outStream = ROL::makePtrFromRef(std::cout);
58 outStream = ROL::makePtrFromRef(bhs);
62 oldFormatState.copyfmt(std::cout);
77 auto k_ptr = ROL::makePtr<VectorT>(y_dim);
86 auto obj_ptr = ROL::makePtr<ObjectiveT>(k_ptr);
87 auto con_ptr = ROL::makePtr<ConstraintT>();
89 VectorT v(x_dim), g(x_dim), hv(x_dim), u(x_dim);
97 RealT tol = std::sqrt(ROL::ROL_EPSILON<RealT>());
99 auto result_1 = obj.checkGradient(x,v,
true,*outStream,7,4);
101 bool gradient_passed =
false;
103 for(
auto& row : result_1 ) {
105 gradient_passed =
true;
110 errorFlag += (!gradient_passed);
112 auto result_2 = obj.checkHessVec(x,hv,v,
true,*outStream,7,4);
114 bool hessVec_passed =
false;
116 for(
auto& row : result_2 ) {
118 hessVec_passed =
true;
123 errorFlag += (!hessVec_passed) << 1;
125 auto result_3 = obj.checkHessSym(x,hv,v,u,
true,*outStream);
126 auto hessSym_passed = (result_3[2] < tol);
128 errorFlag += (!hessSym_passed) << 2;
131 catch (std::logic_error& err) {
132 *outStream << err.what() <<
"\n";
137 std::cout <<
"End Result: TEST FAILED\n";
139 std::cout <<
"End Result: TEST PASSED\n";
Equality constraints c_i(x) = 0, where: c1(x) = x1^2+x2^2+x3^2+x4^2+x5^2 - 10 c2(x) = x2*x3-5*x4*x5 c...
void RandomizeVector(Vector< Real > &x, const Real &lower=0.0, const Real &upper=1.0)
Fill a ROL::Vector with uniformly-distributed random numbers in the interval [lower,upper].
Defines a no-output stream class ROL::NullStream and a function makeStreamPtr which either wraps a re...
std::vector< RealT > VectorT
Provides the ROL::Vector interface for scalar values, to be used, for example, with scalar constraint...
Contains definitions for the Zakharov function as evaluated using only the ROL::Vector interface...
Contains definitions for the equality constrained NLP from Nocedal/Wright, 2nd edition, page 574, example 18.2; note the typo in reversing the initial guess and the solution.
basic_nullstream< char, char_traits< char >> nullstream
int main(int argc, char *argv[])
Defines an objective of the form f(g(x)) where.