70 #include "Teuchos_GlobalMPISession.hpp"
76 int main(
int argc,
char *argv[]) {
83 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
86 int iprint = argc - 1;
87 ROL::Ptr<std::ostream> outStream;
90 outStream = ROL::makePtrFromRef(std::cout);
92 outStream = ROL::makePtrFromRef(bhs);
96 oldFormatState.copyfmt(std::cout);
111 auto k_ptr = ROL::makePtr<VectorT>(y_dim);
120 auto obj_ptr = ROL::makePtr<ObjectiveT>(k_ptr);
121 auto con_ptr = ROL::makePtr<ConstraintT>();
123 VectorT v(x_dim), g(x_dim), hv(x_dim), u(x_dim);
131 RealT tol = std::sqrt(ROL::ROL_EPSILON<RealT>());
133 auto result_1 = obj.checkGradient(x,v,
true,*outStream,7,4);
135 bool gradient_passed =
false;
137 for(
auto& row : result_1 ) {
139 gradient_passed =
true;
144 errorFlag += (!gradient_passed);
146 auto result_2 = obj.checkHessVec(x,hv,v,
true,*outStream,7,4);
148 bool hessVec_passed =
false;
150 for(
auto& row : result_2 ) {
152 hessVec_passed =
true;
157 errorFlag += (!hessVec_passed) << 1;
159 auto result_3 = obj.checkHessSym(x,hv,v,u,
true,*outStream);
160 auto hessSym_passed = (result_3[2] < tol);
162 errorFlag += (!hessSym_passed) << 2;
165 catch (std::logic_error& err) {
166 *outStream << err.what() <<
"\n";
171 std::cout <<
"End Result: TEST FAILED\n";
173 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.