49 #include "Teuchos_GlobalMPISession.hpp"
57 int main(
int argc,
char *argv[]) {
62 typedef std::vector<RealT> vec;
64 typedef ROL::Ptr<ROL::Vector<RealT> > ROL::PtrV;
69 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
71 int iprint = argc - 1;
72 ROL::Ptr<std::ostream> outStream;
75 outStream = ROL::makePtrFromRef(std::cout);
77 outStream = ROL::makePtrFromRef(bhs);
88 ROL::Ptr<vec> x_exact_ptr = ROL::makePtr<vec>(xopt_dim,0.0);
89 (*x_exact_ptr)[xopt_dim-1] = 1.0;
91 ROL::Ptr<vec> xopt_ptr = ROL::makePtr<vec>(xopt_dim,0.0);
93 ROL::Ptr<vec> le_ptr = ROL::makePtr<vec>(ce_dim,0.0);
94 ROL::Ptr<vec> li_ptr = ROL::makePtr<vec>(ci_dim,0.0);
101 ROL::PtrV xopt = ROL::makePtr<SV>(xopt_ptr);
102 ROL::PtrV le = ROL::makePtr<SV>(le_ptr);
103 ROL::PtrV li = ROL::makePtr<SV>(li_ptr);
109 ROL::Ptr<ROL::Objective<RealT> > obj_hs32 = ROL::makePtr<Objective_HS32<RealT>>();
110 ROL::Ptr<ROL::EqualityConstraint<RealT> > eqcon_hs32 = ROL::makePtr<EqualityConstraint_HS32<RealT>>();
111 ROL::Ptr<ROL::InequalityConstraint<RealT> > incon_hs32 = ROL::makePtr<InequalityConstraint_HS32<RealT>>();
114 std::string stepname =
"Interior Point";
120 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Initial Barrier Penalty",mu);
121 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Minimium Barrier Penalty",1e-8);
122 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Barrier Penalty Reduction Factor",factor);
123 parlist->sublist(
"Step").sublist(
"Interior Point").set(
"Subproblem Iteration Limit",30);
125 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Optimality System Solver").set(
"Nominal Relative Tolerance",1.e-4);
126 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Optimality System Solver").set(
"Fix Tolerance",
true);
127 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Tangential Subproblem Solver").set(
"Iteration Limit",20);
128 parlist->sublist(
"Step").sublist(
"Composite Step").sublist(
"Tangential Subproblem Solver").set(
"Relative Tolerance",1e-2);
129 parlist->sublist(
"Step").sublist(
"Composite Step").set(
"Output Level",0);
131 parlist->sublist(
"Status Test").set(
"Gradient Tolerance",1.e-12);
132 parlist->sublist(
"Status Test").set(
"Constraint Tolerance",1.e-8);
133 parlist->sublist(
"Status Test").set(
"Step Tolerance",1.e-8);
134 parlist->sublist(
"Status Test").set(
"Iteration Limit",100);
139 ROL::Ptr<ROL::Algorithm<RealT> > algo;
140 algo = ROL::makePtr<ROL::Algorithm<RealT>>(stepname,*parlist);
142 algo->run(problem,
true,*outStream);
144 *outStream << std::endl << std::setw(20) <<
"Computed Minimizer" << std::setw(20) <<
"Exact Minimizer" << std::endl;
145 for(
int i=0;i<xopt_dim;++i ) {
146 *outStream << std::setw(20) << (*xopt_ptr)[i] << std::setw(20) << (*x_exact_ptr)[i] << std::endl;
149 catch (std::logic_error err) {
150 *outStream << err.what() <<
"\n";
155 std::cout <<
"End Result: TEST FAILED\n";
157 std::cout <<
"End Result: TEST PASSED\n";
Provides the ROL::Vector interface for scalar values, to be used, for example, with scalar constraint...
Contains definitions for W. Hock and K. Schittkowski 32nd test problem which contains both inequality...
basic_nullstream< char, char_traits< char >> nullstream
int main(int argc, char *argv[])