49 #include "Teuchos_GlobalMPISession.hpp"
56 int main(
int argc,
char *argv[]) {
61 typedef std::vector<RealT> vec;
63 typedef ROL::Ptr<ROL::Vector<RealT> > ROL::PtrV;
65 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
67 int iprint = argc - 1;
68 ROL::Ptr<std::ostream> outStream;
71 outStream = ROL::makePtrFromRef(std::cout);
73 outStream = ROL::makePtrFromRef(bhs);
82 ROL::Ptr<vec> xopt_ptr = ROL::makePtr<vec>(xopt_dim,1.0);
84 ROL::Ptr<vec> li_ptr = ROL::makePtr<vec>(ci_dim,0.0);
86 ROL::PtrV xopt = ROL::makePtr<SV>(xopt_ptr);
87 ROL::PtrV li = ROL::makePtr<SV>(li_ptr);
93 ROL::Ptr<ROL::Objective<RealT> > obj_hs29 = ROL::makePtr<Objective_HS29<RealT>>();
94 ROL::Ptr<ROL::InequalityConstraint<RealT> > incon_hs29 = ROL::makePtr<InequalityConstraint_HS29<RealT>>();
97 std::string stepname =
"Interior Point";
103 parlist->sublist(
"General").set(
"Print Verbosity",1);
105 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Initial Barrier Penalty",mu);
106 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Minimium Barrier Penalty",1e-8);
107 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Barrier Penalty Reduction Factor",factor);
108 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Subproblem Iteration Limit",30);
110 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Optimality System Solver").set(
"Nominal Relative Tolerance",1.e-4);
111 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Optimality System Solver").set(
"Fix Tolerance",
true);
112 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Tangential Subproblem Solver").set(
"Iteration Limit",20);
113 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Tangential Subproblem Solver").set(
"Relative Tolerance",1e-2);
114 parlist->sublist(
"Step").sublist(
"Composite Step").set(
"Output Level",0);
116 parlist->sublist(
"Status Test").set(
"Gradient Tolerance",1.e-12);
117 parlist->sublist(
"Status Test").set(
"Constraint Tolerance",1.e-8);
118 parlist->sublist(
"Status Test").set(
"Step Tolerance",1.e-8);
119 parlist->sublist(
"Status Test").set(
"Iteration Limit",100);
124 ROL::Ptr<ROL::Algorithm<RealT> > algo;
125 algo = ROL::makePtr<ROL::Algorithm<RealT>>(stepname,*parlist);
127 algo->run(problem,
true,*outStream);
131 *outStream << std::endl << std::setw(20) <<
"Computed Minimizer" << std::endl;
132 for(
int i=0;i<xopt_dim;++i ) {
133 *outStream << std::setw(20) << (*xopt_ptr)[i] << std::endl;
136 *outStream <<
"Exact minimizers: x* = (a,b,c), (a,-b,-c), (-a,b,-c), (-a,-b,c)" << std::endl;
137 *outStream <<
"Where a=4, b=" << 2*std::sqrt(2) <<
", and c=2" << std::endl;
140 catch (std::logic_error& err) {
141 *outStream << err.what() <<
"\n";
146 std::cout <<
"End Result: TEST FAILED\n";
148 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[])