55 #include "Teuchos_oblackholestream.hpp" 56 #include "Teuchos_GlobalMPISession.hpp" 62 int main(
int argc,
char *argv[]) {
64 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
67 int iprint = argc - 1;
68 Teuchos::RCP<std::ostream> outStream;
69 Teuchos::oblackholestream bhs;
71 outStream = Teuchos::rcp(&std::cout,
false);
73 outStream = Teuchos::rcp(&bhs,
false);
85 Teuchos::ParameterList parlist;
86 parlist.sublist(
"Step").sublist(
"Line Search").sublist(
"Descent Method").set(
"Type",
"Newton-Krylov");
87 parlist.sublist(
"Status Test").set(
"Gradient Tolerance",1.e-12);
88 parlist.sublist(
"Status Test").set(
"Step Tolerance",1.e-14);
89 parlist.sublist(
"Status Test").set(
"Iteration Limit",100);
95 Teuchos::RCP<std::vector<RealT> > x_rcp = Teuchos::rcp(
new std::vector<RealT> (dim, 0.0) );
97 for (
int i=0; i<dim/2; i++) {
99 (*x_rcp)[2*i+1] = 1.0;
104 algo.
run(x, obj,
true, *outStream);
107 Teuchos::RCP<std::vector<RealT> > xtrue_rcp = Teuchos::rcp(
new std::vector<RealT> (dim, 1.0) );
114 *outStream << std::scientific <<
"\n Absolute Error: " << abserr;
115 *outStream << std::scientific <<
"\n Relative Error: " << relerr <<
"\n";
120 catch (std::logic_error err) {
121 *outStream << err.what() <<
"\n";
126 std::cout <<
"End Result: TEST FAILED\n";
128 std::cout <<
"End Result: TEST PASSED\n";
void axpy(const Real alpha, const Vector< Real > &x)
Compute where .
Rosenbrock's function.
Contains definitions for Rosenbrock's function.
int main(int argc, char *argv[])
Real norm() const
Returns where .
Provides the std::vector implementation of the ROL::Vector interface.
Provides an interface to run optimization algorithms.
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.
static const double ROL_EPSILON
Platform-dependent machine epsilon.