18 #include "Teuchos_GlobalMPISession.hpp"
25 int main(
int argc,
char *argv[]) {
27 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
30 int iprint = argc - 1;
31 ROL::Ptr<std::ostream> outStream;
34 outStream = ROL::makePtrFromRef(std::cout);
36 outStream = ROL::makePtrFromRef(bhs);
44 std::string filename =
"input_ex03.xml";
46 auto parlist = ROL::getParametersFromXmlFile( filename );
47 parlist->sublist(
"General").set(
"Inexact Hessian-Times-A-Vector",
true);
49 parlist->sublist(
"General").set(
"Inexact Hessian-Times-A-Vector",
false);
53 parlist->sublist(
"Step").set(
"Type",
"Fletcher");
58 ROL::Ptr<ROL::Vector<RealT> > x0;
59 std::vector<ROL::Ptr<ROL::Vector<RealT> > > z;
60 ROL::Ptr<ROL::OptimizationProblem<RealT> > problem;
61 ROL::GetTestProblem<RealT>(problem,x0,z,prob);
72 ROL::Ptr<ROL::Vector<RealT> > e = x0->clone();
79 solver.
solve(*outStream);
83 for (
int i = 0; i < static_cast<int>(z.size()); ++i) {
91 err = std::min(err,e->norm());
94 *outStream << std::endl <<
"Norm of Error: " << err << std::endl;
98 errorFlag += ((err < std::max(1.e-6*z[0]->norm(),1.e-8) || (state->gnorm < 1.e-6)) ? 0 : 1);
103 catch (std::logic_error& err) {
104 *outStream << err.what() << std::endl;
109 std::cout <<
"End Result: TEST FAILED" << std::endl;
111 std::cout <<
"End Result: TEST PASSED" << std::endl;
ETestOptProblem
Enumeration of test optimization problems.
Contains definitions of test objective functions.
Defines a no-output stream class ROL::NullStream and a function makeStreamPtr which either wraps a re...
std::string ETestOptProblemToString(ETestOptProblem to)
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.
ROL::Ptr< const AlgorithmState< Real > > getAlgorithmState(void) const
Return the AlgorithmState.