22 #include "Teuchos_GlobalMPISession.hpp"
31 int main(
int argc,
char *argv[]) {
34 using ROL::ParameterList;
36 typedef std::vector<RealT> vector;
41 Teuchos::GlobalMPISession mpiSession(&argc, &argv,0);
43 int iprint = argc - 1;
44 ROL::Ptr<std::ostream> outStream;
47 outStream = ROL::makePtrFromRef(std::cout);
49 outStream = ROL::makePtrFromRef(bhs);
57 std::string paramfile =
"parameters.xml";
58 auto parlist = ROL::getParametersFromXmlFile(paramfile);
61 ROL::Ptr<ROL::Step<RealT>>
62 step = ROL::makePtr<ROL::TrustRegionStep<RealT>>(*parlist);
63 ROL::Ptr<ROL::StatusTest<RealT>>
64 status = ROL::makePtr<ROL::StatusTest<RealT>>(*parlist);
67 ROL::Ptr<vector> x_ptr = ROL::makePtr<vector>(
dim,1.0);
68 ROL::Ptr<vector> k_ptr = ROL::makePtr<vector>(
dim);
70 for(
int i=0;i<
dim;++i) {
71 (*k_ptr)[i] = 1.0 + i;
74 ROL::Ptr<V> xs = ROL::makePtr<SV>(x_ptr);
75 ROL::Ptr<V> ks = ROL::makePtr<SV>(k_ptr);
79 ROL::Ptr<V> kpf = ROL::makePtr<ROL::ProfiledVector<int,RealT>>(ks);
84 algo.
run(xpf, obj,
true, *outStream);
90 catch (std::logic_error& err) {
91 *outStream << err.what() <<
"\n";
96 std::cout <<
"End Result: TEST FAILED\n";
98 std::cout <<
"End Result: TEST PASSED\n";
virtual std::vector< std::string > run(Vector< Real > &x, Objective< Real > &obj, bool print=false, std::ostream &outStream=std::cout, bool printVectors=false, std::ostream &vectorStream=std::cout)
Run algorithm on unconstrained problems (Type-U). This is the primary Type-U interface.
Defines the linear algebra or vector space interface.
Defines a no-output stream class ROL::NullStream and a function makeStreamPtr which either wraps a re...
basic_nullstream< char, std::char_traits< char >> nullstream
Provides the ROL::Vector interface for scalar values, to be used, for example, with scalar constraint...
Provides an interface to run optimization algorithms.
void printVectorFunctionCalls(const ProfiledVector< Ordinal, Real > &x, std::ostream &outStream=std::cout)
Contains definitions for the Zakharov function as evaluated using only the ROL::Vector interface...
By keeping a pointer to this in a derived Vector class, a tally of all methods is kept for profiling ...
int main(int argc, char *argv[])