56 #include "Teuchos_GlobalMPISession.hpp"
65 int main(
int argc,
char *argv[]) {
68 using ROL::ParameterList;
70 typedef std::vector<RealT> vector;
75 Teuchos::GlobalMPISession mpiSession(&argc, &argv,0);
77 int iprint = argc - 1;
78 ROL::Ptr<std::ostream> outStream;
81 outStream = ROL::makePtrFromRef(std::cout);
83 outStream = ROL::makePtrFromRef(bhs);
91 std::string paramfile =
"parameters.xml";
92 auto parlist = ROL::getParametersFromXmlFile(paramfile);
95 ROL::Ptr<ROL::Step<RealT>>
96 step = ROL::makePtr<ROL::TrustRegionStep<RealT>>(*parlist);
97 ROL::Ptr<ROL::StatusTest<RealT>>
98 status = ROL::makePtr<ROL::StatusTest<RealT>>(*parlist);
101 ROL::Ptr<vector> x_ptr = ROL::makePtr<vector>(
dim,1.0);
102 ROL::Ptr<vector> k_ptr = ROL::makePtr<vector>(
dim);
104 for(
int i=0;i<
dim;++i) {
105 (*k_ptr)[i] = 1.0 + i;
108 ROL::Ptr<V> xs = ROL::makePtr<SV>(x_ptr);
109 ROL::Ptr<V> ks = ROL::makePtr<SV>(k_ptr);
113 ROL::Ptr<V> kpf = ROL::makePtr<ROL::ProfiledVector<int,RealT>>(ks);
118 algo.
run(xpf, obj,
true, *outStream);
124 catch (std::logic_error& err) {
125 *outStream << err.what() <<
"\n";
130 std::cout <<
"End Result: TEST FAILED\n";
132 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...
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 ...
basic_nullstream< char, char_traits< char >> nullstream
int main(int argc, char *argv[])