52 #include "Teuchos_oblackholestream.hpp" 53 #include "Teuchos_GlobalMPISession.hpp" 54 #include "Teuchos_XMLParameterListHelpers.hpp" 60 int main(
int argc,
char *argv[]) {
62 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
65 int iprint = argc - 1;
66 Teuchos::RCP<std::ostream> outStream;
67 Teuchos::oblackholestream bhs;
69 outStream = Teuchos::rcp(&std::cout,
false);
71 outStream = Teuchos::rcp(&bhs,
false);
79 std::string filename =
"input.xml";
80 Teuchos::RCP<Teuchos::ParameterList> parlist = Teuchos::rcp(
new Teuchos::ParameterList() );
81 Teuchos::updateParametersFromXmlFile( filename, parlist.ptr() );
82 parlist->sublist(
"General").set(
"Inexact Hessian-Times-A-Vector",
true);
84 parlist->sublist(
"General").set(
"Inexact Hessian-Times-A-Vector",
false);
90 Teuchos::RCP<ROL::Vector<RealT> > x0, z;
91 Teuchos::RCP<ROL::Objective<RealT> > obj;
93 Teuchos::RCP<ROL::Vector<RealT> > x = x0->clone();
96 int dim = x0->dimension();
97 parlist->sublist(
"General").sublist(
"Krylov").set(
"Iteration Limit", 2*dim);
100 Teuchos::RCP<ROL::Vector<RealT> > e = x->clone();
104 parlist->sublist(
"Step").sublist(
"Line Search").sublist(
"Descent Method").set(
"Type",
ROL::EDescentToString(desc));
108 parlist->sublist(
"Step").sublist(
"Line Search").sublist(
"Line-Search Method").set(
"Type",
ROL::ELineSearchToString(ls));
115 algo.
run(*x, *obj,
true, *outStream);
120 *outStream << std::endl <<
"Norm of Error: " << e->norm() << std::endl;
125 catch (std::logic_error err) {
126 *outStream << err.what() << std::endl;
131 std::cout <<
"End Result: TEST FAILED" << std::endl;
133 std::cout <<
"End Result: TEST PASSED" << std::endl;
Contains definitions of test objective functions.
ELineSearch
Enumeration of line-search types.
std::string EDescentToString(EDescent tr)
Provides an interface to run optimization algorithms.
std::string ELineSearchToString(ELineSearch ls)
std::string ETestObjectivesToString(ETestObjectives to)
virtual std::vector< std::string > run(Vector< Real > &x, Objective< Real > &obj, bool print=false, std::ostream &outStream=std::cout)
Run algorithm on unconstrained problems (Type-U). This is the primary Type-U interface.
int main(int argc, char *argv[])
EDescent
Enumeration of descent direction types.