14 #include "Teuchos_GlobalMPISession.hpp"
21 int main(
int argc,
char *argv[]) {
26 typedef std::vector<RealT> vec;
28 typedef ROL::Ptr<ROL::Vector<RealT> > ROL::PtrV;
30 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
32 int iprint = argc - 1;
33 ROL::Ptr<std::ostream> outStream;
36 outStream = ROL::makePtrFromRef(std::cout);
38 outStream = ROL::makePtrFromRef(bhs);
47 ROL::Ptr<vec> xopt_ptr = ROL::makePtr<vec>(xopt_dim,1.0);
49 ROL::Ptr<vec> li_ptr = ROL::makePtr<vec>(ci_dim,0.0);
51 ROL::PtrV xopt = ROL::makePtr<SV>(xopt_ptr);
52 ROL::PtrV li = ROL::makePtr<SV>(li_ptr);
58 ROL::Ptr<ROL::Objective<RealT> > obj_hs29 = ROL::makePtr<Objective_HS29<RealT>>();
59 ROL::Ptr<ROL::InequalityConstraint<RealT> > incon_hs29 = ROL::makePtr<InequalityConstraint_HS29<RealT>>();
62 std::string stepname =
"Interior Point";
68 parlist->sublist(
"General").set(
"Print Verbosity",1);
70 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Initial Barrier Penalty",mu);
71 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Minimium Barrier Penalty",1e-8);
72 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Barrier Penalty Reduction Factor",factor);
73 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Subproblem Iteration Limit",30);
75 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Optimality System Solver").set(
"Nominal Relative Tolerance",1.e-4);
76 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Optimality System Solver").set(
"Fix Tolerance",
true);
77 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Tangential Subproblem Solver").set(
"Iteration Limit",20);
78 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Tangential Subproblem Solver").set(
"Relative Tolerance",1e-2);
79 parlist->sublist(
"Step").sublist(
"Composite Step").set(
"Output Level",0);
81 parlist->sublist(
"Status Test").set(
"Gradient Tolerance",1.e-12);
82 parlist->sublist(
"Status Test").set(
"Constraint Tolerance",1.e-8);
83 parlist->sublist(
"Status Test").set(
"Step Tolerance",1.e-8);
84 parlist->sublist(
"Status Test").set(
"Iteration Limit",100);
89 ROL::Ptr<ROL::Algorithm<RealT> > algo;
90 algo = ROL::makePtr<ROL::Algorithm<RealT>>(stepname,*parlist);
92 algo->run(problem,
true,*outStream);
96 *outStream << std::endl << std::setw(20) <<
"Computed Minimizer" << std::endl;
97 for(
int i=0;i<xopt_dim;++i ) {
98 *outStream << std::setw(20) << (*xopt_ptr)[i] << std::endl;
101 *outStream <<
"Exact minimizers: x* = (a,b,c), (a,-b,-c), (-a,b,-c), (-a,-b,c)" << std::endl;
102 *outStream <<
"Where a=4, b=" << 2*std::sqrt(2) <<
", and c=2" << std::endl;
105 catch (std::logic_error& err) {
106 *outStream << err.what() <<
"\n";
111 std::cout <<
"End Result: TEST FAILED\n";
113 std::cout <<
"End Result: TEST PASSED\n";
Contains definitions for W. Hock and K. Schittkowski 32nd test problem which contains only inequality...
Provides the ROL::Vector interface for scalar values, to be used, for example, with scalar constraint...
basic_nullstream< char, char_traits< char >> nullstream
int main(int argc, char *argv[])