50 #include "Teuchos_GlobalMPISession.hpp"
59 int main(
int argc,
char *argv[]) {
61 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
64 int iprint = argc - 1;
65 ROL::Ptr<std::ostream> outStream;
68 outStream = ROL::makePtrFromRef(std::cout);
70 outStream = ROL::makePtrFromRef(bhs);
73 ROL::Ptr<ROL::Vector<RealT> > x0;
74 std::vector<ROL::Ptr<ROL::Vector<RealT> > > x;
75 ROL::Ptr<ROL::OptimizationProblem<RealT> > problem;
77 ROL::Ptr<ROL::Objective<RealT> > obj = problem->getObjective();
78 ROL::Ptr<ROL::BoundConstraint<RealT> > bnd = problem->getBoundConstraint();
86 step.
compute(*x0,*x[0],*obj,*bnd,algo_state);
89 *outStream << exc.what() << std::endl;
93 step.
update(*x0,*x[0],*obj,*bnd,algo_state);
96 *outStream << exc.what() << std::endl;
103 *outStream << exc.what() << std::endl;
110 *outStream << exc.what() << std::endl;
114 step.
print(algo_state,
true);
117 *outStream << exc.what() << std::endl;
120 errorFlag = (thrown==5) ? 0 : 1;
122 catch (std::logic_error err) {
123 *outStream << err.what() << std::endl;
128 std::cout <<
"End Result: TEST FAILED" << std::endl;
130 std::cout <<
"End Result: TEST PASSED" << std::endl;
virtual void update(Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Update step, if successful.
virtual std::string printHeader(void) const
Print iterate header.
Provides the interface to compute optimization steps.
Contains definitions of test objective functions.
virtual std::string print(AlgorithmState< Real > &algo_state, bool printHeader=false) const
Print iterate status.
State for algorithm class. Will be used for restarts.
virtual void compute(Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Compute step.
basic_nullstream< char, char_traits< char >> nullstream
int main(int argc, char *argv[])
virtual std::string printName(void) const
Print step name.