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() );
88 Teuchos::RCP<ROL::Vector<RealT> > x0, z;
89 Teuchos::RCP<ROL::Objective<RealT> > obj = Teuchos::null;
90 ROL::getTestObjectives<RealT>(obj,x0,z,objFunc);
91 Teuchos::RCP<ROL::Vector<RealT> > x = x0->clone();
94 int dim = x0->dimension();
95 parlist->sublist(
"General").sublist(
"Krylov").set(
"Iteration Limit", 5*dim);
98 Teuchos::RCP<ROL::Vector<RealT> > e = x0->clone();
103 parlist->sublist(
"Step").sublist(
"Trust Region").set(
"Subproblem Solver",
ETrustRegionToString(tr));
110 algo.
run(*x, *obj,
true, *outStream);
115 *outStream << std::endl <<
"Norm of Error: " << e->norm() << std::endl;
119 catch (std::logic_error err) {
120 *outStream << err.what() << std::endl;
125 std::cout <<
"End Result: TEST FAILED" << std::endl;
127 std::cout <<
"End Result: TEST PASSED" << std::endl;
Contains definitions of test objective functions.
Provides an interface to run optimization algorithms.
ETestObjectives
Enumeration of test objective functions.
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.
ETrustRegion
Enumeration of trust-region solver types.
std::string ETrustRegionToString(ETrustRegion tr)
int main(int argc, char *argv[])