51 #include "Teuchos_GlobalMPISession.hpp"
52 #include "Teuchos_XMLParameterListHelpers.hpp"
58 int main(
int argc,
char *argv[]) {
60 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
63 int iprint = argc - 1;
64 ROL::Ptr<std::ostream> outStream;
67 outStream = ROL::makePtrFromRef(std::cout);
69 outStream = ROL::makePtrFromRef(bhs);
76 std::string filename =
"input.xml";
77 auto parlist = ROL::getParametersFromXmlFile( filename );
78 parlist->sublist(
"Step").sublist(
"Trust Region").set(
"Initial Radius",10.0);
81 ROL::Ptr<ROL::Vector<RealT>> x0;
82 std::vector<ROL::Ptr<ROL::Vector<RealT>>> z;
83 ROL::Ptr<ROL::ZOO::getCubic<RealT>> cubic;
84 ROL::Ptr<ROL::OptimizationProblem<RealT>> problem;
85 for (
int i = 0; i < 3; ++i) {
86 cubic = ROL::makePtr<ROL::ZOO::getCubic<RealT>>(i);
87 cubic->get(problem,x0,z);
90 problem->check(*outStream);
94 solver.
solve(*outStream);
97 ROL::Ptr<ROL::Vector<RealT>> e = x0->clone();
100 for (
int i = 0; i < static_cast<int>(z.size()); ++i) {
107 err = std::min(err,e->norm());
110 *outStream << std::endl <<
"Norm of Error: " << err << std::endl;
111 RealT tol =
static_cast<RealT>(1e-3)*std::max(z[0]->norm(),
static_cast<RealT>(1));
112 errorFlag += ((err < tol) ? 0 : 1);
115 catch (std::logic_error& err) {
116 *outStream << err.what() << std::endl;
121 std::cout <<
"End Result: TEST FAILED" << std::endl;
123 std::cout <<
"End Result: TEST PASSED" << std::endl;
Contains definitions of test objective functions.
Defines a no-output stream class ROL::NullStream and a function makeStreamPtr which either wraps a re...
Provides a simplified interface for solving a wide range of optimization problems.
basic_nullstream< char, char_traits< char >> nullstream
int main(int argc, char *argv[])
int solve(const ROL::Ptr< StatusTest< Real > > &status=ROL::nullPtr, const bool combineStatus=true)
Solve optimization problem with no iteration output.