57 #include "ROL_ParameterList.hpp"
60 #include "Teuchos_GlobalMPISession.hpp"
68 int main(
int argc,
char **argv)
70 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
73 int iprint = argc - 1;
74 ROL::Ptr<std::ostream> outStream;
77 outStream = ROL::makePtrFromRef(std::cout);
79 outStream = ROL::makePtrFromRef(bhs);
92 std::string paramfile =
"parameters.xml";
93 auto parlist = ROL::getParametersFromXmlFile(paramfile);
96 ROL::Ptr<ROL::Step<RealT>>
97 step = ROL::makePtr<ROL::LineSearchStep<RealT>>(*parlist);
98 ROL::Ptr<ROL::StatusTest<RealT>>
99 status = ROL::makePtr<ROL::StatusTest<RealT>>(*parlist);
103 ROL::Ptr<std::vector<RealT> > x_ptr = ROL::makePtr<std::vector<RealT>>(
dim, 0.0);
105 for (
int i=0; i<
dim; i++) {
112 algo.
run(x, obj,
true, *outStream);
115 ROL::Ptr<std::vector<RealT> > xtrue_ptr = ROL::makePtr<std::vector<RealT>>(
dim, 0.0);
122 *outStream << std::scientific <<
"\n Absolute Error: " << abserr;
123 if ( abserr > sqrt(ROL_EPSILON<RealT>()) ) {
127 catch (std::logic_error& err) {
128 *outStream << err.what() <<
"\n";
133 std::cout <<
"End Result: TEST FAILED\n";
135 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...
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.
basic_nullstream< char, char_traits< char >> nullstream
int main(int argc, char *argv[])