53 #include "Teuchos_GlobalMPISession.hpp"
60 int main(
int argc,
char *argv[]) {
62 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
65 int iprint = argc - 1;
66 ROL::Ptr<std::ostream> outStream;
69 outStream = ROL::makePtrFromRef(std::cout);
71 outStream = ROL::makePtrFromRef(bhs);
79 ROL::Ptr<ROL::Vector<RealT> > x0;
80 std::vector<ROL::Ptr<ROL::Vector<RealT> > > z;
81 ROL::Ptr<ROL::OptimizationProblem<RealT> > problem;
84 std::string filename =
"input.xml";
86 auto parlist = ROL::getParametersFromXmlFile( filename );
87 parlist->sublist(
"General").set(
"Inexact Hessian-Times-A-Vector",
true);
89 parlist->sublist(
"General").set(
"Inexact Hessian-Times-A-Vector",
false);
96 parlist->sublist(
"Step").set(
"Type",
"Interior Point");
97 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Initial Barrier Penalty",mu);
98 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Minimum Barrier Penalty",1e-8);
99 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Barrier Penalty Reduction Factor",factor);
100 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Subproblem Iteration Limit",30);
102 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Optimality System Solver").set(
"Nominal Relative Tolerance",1.e-4);
103 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Optimality System Solver").set(
"Fix Tolerance",
true);
104 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Tangential Subproblem Solver").set(
"Iteration Limit",20);
105 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Tangential Subproblem Solver").set(
"Relative Tolerance",1e-2);
106 parlist->sublist(
"Step").sublist(
"Composite Step").set(
"Output Level",0);
108 parlist->sublist(
"Status Test").set(
"Gradient Tolerance",1.e-12);
109 parlist->sublist(
"Status Test").set(
"Constraint Tolerance",1.e-8);
110 parlist->sublist(
"Status Test").set(
"Step Tolerance",1.e-8);
111 parlist->sublist(
"Status Test").set(
"Iteration Limit",100);
115 algo.
run(optProb,
true, *outStream);
118 ROL::Ptr<ROL::Vector<RealT> > e = x0->clone();
120 for (
int i = 0; i < static_cast<int>(z.size()); ++i) {
127 err = std::min(err,e->norm());
130 *outStream << std::endl <<
"Norm of Error: " << err << std::endl;
132 catch (std::logic_error err) {
133 *outStream << err.what() << std::endl;
138 std::cout <<
"End Result: TEST FAILED" << std::endl;
140 std::cout <<
"End Result: TEST PASSED" << std::endl;
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.
Contains definitions of test objective functions.
Defines a no-output stream class ROL::NullStream and a function makeStreamPtr which either wraps a re...
Provides an interface to run optimization algorithms.
basic_nullstream< char, char_traits< char >> nullstream
int main(int argc, char *argv[])