54 #include "Teuchos_oblackholestream.hpp"
55 #include "Teuchos_GlobalMPISession.hpp"
61 int main(
int argc,
char *argv[]) {
63 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
66 int iprint = argc - 1;
67 Teuchos::RCP<std::ostream> outStream;
68 Teuchos::oblackholestream bhs;
70 outStream = Teuchos::rcp(&std::cout,
false);
72 outStream = Teuchos::rcp(&bhs,
false);
83 Teuchos::ParameterList parlist;
85 parlist.set(
"Descent Type",
"Newton Krylov");
86 parlist.set(
"Linesearch Type",
"Cubic Interpolation");
87 parlist.set(
"Linesearch Curvature Condition",
"Wolfe");
89 parlist.set(
"Maximum Number of Function Evaluations", 20);
90 parlist.set(
"Sufficient Decrease Parameter", 1.e-4);
91 parlist.set(
"Curvature Conditions Parameter", 0.9);
92 parlist.set(
"Backtracking Rate", 0.5);
93 parlist.set(
"Initial Linesearch Parameter", 1.0);
94 parlist.set(
"User Defined Linesearch Parameter",
false);
96 parlist.set(
"Absolute Krylov Tolerance", 1.e-4);
97 parlist.set(
"Relative Krylov Tolerance", 1.e-2);
98 parlist.set(
"Maximum Number of Krylov Iterations", 10);
112 Teuchos::RCP<std::vector<RealT> > x_rcp = Teuchos::rcp(
new std::vector<RealT> (dim, 0.0) );
114 for (
int i=0; i<dim/2; i++) {
115 (*x_rcp)[2*i] = -1.2;
116 (*x_rcp)[2*i+1] = 1.0;
121 std::vector<std::string> output = algo.
run(x, obj,
false);
122 for (
unsigned i = 0; i < output.size(); i++ ) {
123 std::cout << output[i];
127 Teuchos::RCP<std::vector<RealT> > xtrue_rcp = Teuchos::rcp(
new std::vector<RealT> (dim, 1.0) );
134 *outStream << std::scientific <<
"\n Absolute Error: " << abserr;
135 *outStream << std::scientific <<
"\n Relative Error: " << relerr <<
"\n";
140 catch (std::logic_error err) {
141 *outStream << err.what() <<
"\n";
146 std::cout <<
"End Result: TEST FAILED\n";
148 std::cout <<
"End Result: TEST PASSED\n";
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Contains definitions for Rosenbrock's function.
int main(int argc, char *argv[])
Provides the interface to compute optimization steps with line search.
Real norm() const
Returns where .
Provides the std::vector implementation of the ROL::Vector interface.
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.
Provides an interface to check status of optimization algorithms.
static const double ROL_EPSILON
Platform-dependent machine epsilon.