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);
97 ROL::Ptr<vector> x_ptr = ROL::makePtr<vector>(dim,1.0);
98 ROL::Ptr<vector> k_ptr = ROL::makePtr<vector>(dim);
100 for(
int i=0;i<dim;++i) {
101 (*k_ptr)[i] = 1.0 + i;
104 ROL::Ptr<V> xs = ROL::makePtr<SV>(x_ptr);
105 ROL::Ptr<V> ks = ROL::makePtr<SV>(k_ptr);
109 ROL::Ptr<V> kpf = ROL::makePtr<ROL::ProfiledVector<int,RealT>>(ks);
114 algo.
run(xpf, obj,
true, *outStream);
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";
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[])