51 #include "ROL_LineSearchStep.hpp"
52 #include "ROL_Algorithm.hpp"
53 #include "Teuchos_oblackholestream.hpp"
54 #include "Teuchos_GlobalMPISession.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);
82 Teuchos::ParameterList parlist;
84 parlist.set(
"Descent Type",
"Newton Krylov");
85 parlist.set(
"Linesearch Type",
"Cubic Interpolation");
86 parlist.set(
"Linesearch Curvature Condition",
"Wolfe");
88 parlist.set(
"Maximum Number of Function Evaluations", 20);
89 parlist.set(
"Sufficient Decrease Parameter", 1.e-4);
90 parlist.set(
"Curvature Conditions Parameter", 0.9);
91 parlist.set(
"Backtracking Rate", 0.5);
92 parlist.set(
"Initial Linesearch Parameter", 1.0);
93 parlist.set(
"User Defined Linesearch Parameter",
false);
95 parlist.set(
"Absolute Krylov Tolerance", 1.e-4);
96 parlist.set(
"Relative Krylov Tolerance", 1.e-2);
97 parlist.set(
"Maximum Number of Krylov Iterations", 10);
111 Teuchos::RCP<std::vector<RealT> > x_rcp = Teuchos::rcp(
new std::vector<RealT> (dim, 0.0) );
113 for (
int i=0; i<dim/2; i++) {
114 (*x_rcp)[2*i] = -1.2;
115 (*x_rcp)[2*i+1] = 1.0;
120 std::vector<std::string> output = algo.run(x, obj,
false);
121 for (
unsigned i = 0; i < output.size(); i++ ) {
122 std::cout << output[i];
126 Teuchos::RCP<std::vector<RealT> > xtrue_rcp = Teuchos::rcp(
new std::vector<RealT> (dim, 1.0) );
131 RealT abserr = x.norm();
132 RealT relerr = abserr/xtrue.norm();
133 *outStream << std::scientific <<
"\n Absolute Error: " << abserr;
134 *outStream << std::scientific <<
"\n Relative Error: " << relerr <<
"\n";
135 if ( relerr > sqrt(ROL::ROL_EPSILON) ) {
139 catch (std::logic_error err) {
140 *outStream << err.what() <<
"\n";
145 std::cout <<
"End Result: TEST FAILED\n";
147 std::cout <<
"End Result: TEST PASSED\n";
Contains definitions for Rosenbrock's function.
Provides the interface to compute optimization steps with line search.
Provides the std::vector implementation of the ROL::Vector interface.
Provides an interface to check status of optimization algorithms.