16 #include "Teuchos_GlobalMPISession.hpp"
25 int main(
int argc,
char *argv[]) {
27 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
30 int iprint = argc - 1;
31 ROL::Ptr<std::ostream> outStream;
34 outStream = ROL::makePtrFromRef(std::cout);
36 outStream = ROL::makePtrFromRef(bhs);
39 ROL::Ptr<ROL::Vector<RealT> > x0;
40 std::vector<ROL::Ptr<ROL::Vector<RealT> > > x;
41 ROL::Ptr<ROL::OptimizationProblem<RealT> > problem;
43 ROL::Ptr<ROL::Objective<RealT> > obj = problem->getObjective();
44 ROL::Ptr<ROL::BoundConstraint<RealT> > bnd = problem->getBoundConstraint();
52 step.
compute(*x0,*x[0],*obj,*bnd,algo_state);
55 *outStream << exc.what() << std::endl;
59 step.
update(*x0,*x[0],*obj,*bnd,algo_state);
62 *outStream << exc.what() << std::endl;
69 *outStream << exc.what() << std::endl;
76 *outStream << exc.what() << std::endl;
80 step.
print(algo_state,
true);
83 *outStream << exc.what() << std::endl;
86 errorFlag = (thrown==5) ? 0 : 1;
88 catch (std::logic_error& err) {
89 *outStream << err.what() << std::endl;
94 std::cout <<
"End Result: TEST FAILED" << std::endl;
96 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.