25 #include "ROL_Sacado_Objective.hpp"
30 #include "ROL_ParameterList.hpp"
33 #include "Teuchos_GlobalMPISession.hpp"
41 int main(
int argc,
char **argv)
43 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
46 int iprint = argc - 1;
47 ROL::Ptr<std::ostream> outStream;
50 outStream = ROL::makePtrFromRef(std::cout);
52 outStream = ROL::makePtrFromRef(bhs);
60 Sacado_Objective<RealT,Zakharov> obj;
65 std::string paramfile =
"parameters.xml";
66 auto parlist = ROL::getParametersFromXmlFile(paramfile);
69 ROL::Ptr<ROL::Step<RealT>>
70 step = ROL::makePtr<ROL::LineSearchStep<RealT>>(*parlist);
71 ROL::Ptr<ROL::StatusTest<RealT>>
72 status = ROL::makePtr<ROL::StatusTest<RealT>>(*parlist);
76 ROL::Ptr<std::vector<RealT> > x_ptr = ROL::makePtr<std::vector<RealT>>(
dim, 0.0);
78 for (
int i=0; i<
dim; i++) {
85 algo.
run(x, obj,
true, *outStream);
88 ROL::Ptr<std::vector<RealT> > xtrue_ptr = ROL::makePtr<std::vector<RealT>>(
dim, 0.0);
94 *outStream << std::scientific <<
"\n Absolute Error: " << abserr << std::endl;
95 if ( abserr > sqrt(ROL_EPSILON<RealT>()) ) {
99 catch (std::logic_error& err) {
100 *outStream << err.what() <<
"\n";
105 std::cout <<
"End Result: TEST FAILED\n";
107 std::cout <<
"End Result: TEST PASSED\n";
void axpy(const Real alpha, const Vector< Real > &x)
Compute where .
virtual std::vector< std::string > run(Vector< Real > &x, Objective< Real > &obj, bool print=false, std::ostream &outStream=std::cout, bool printVectors=false, std::ostream &vectorStream=std::cout)
Run algorithm on unconstrained problems (Type-U). This is the primary Type-U interface.
Defines a no-output stream class ROL::NullStream and a function makeStreamPtr which either wraps a re...
basic_nullstream< char, std::char_traits< char >> nullstream
Real norm() const
Returns where .
Provides the ROL::Vector interface for scalar values, to be used, for example, with scalar constraint...
Provides an interface to run optimization algorithms.
int main(int argc, char *argv[])