14 #include "Teuchos_GlobalMPISession.hpp"
17 #include "ROL_InteriorPointPrimalDualResidual.hpp"
27 int main(
int argc,
char *argv[]) {
29 typedef std::vector<RealT> vector;
40 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
42 int iprint = argc - 1;
43 ROL::Ptr<std::ostream> outStream;
46 outStream = ROL::makePtrFromRef(std::cout);
48 outStream = ROL::makePtrFromRef(bhs);
63 ROL::Ptr<vector> xo_ptr = ROL::makePtr<vector>(xo_dim,0.0);
64 ROL::Ptr<vector> xs_ptr = ROL::makePtr<vector>(ci_dim,0.0);
65 ROL::Ptr<vector> xe_ptr = ROL::makePtr<vector>(ce_dim,0.0);
66 ROL::Ptr<vector> xi_ptr = ROL::makePtr<vector>(ci_dim,0.0);
68 ROL::Ptr<V> xo = ROL::makePtr<SV>(xo_ptr);
69 ROL::Ptr<V> xs = ROL::makePtr<SV>(xs_ptr);
70 ROL::Ptr<V> xe = ROL::makePtr<SV>(xe_ptr);
71 ROL::Ptr<V> xi = ROL::makePtr<SV>(xi_ptr);
83 ROL::Ptr<vector> vo_ptr = ROL::makePtr<vector>(xo_dim,0.0);
84 ROL::Ptr<vector> vs_ptr = ROL::makePtr<vector>(ci_dim,0.0);
85 ROL::Ptr<vector> ve_ptr = ROL::makePtr<vector>(ce_dim,0.0);
86 ROL::Ptr<vector> vi_ptr = ROL::makePtr<vector>(ci_dim,0.0);
88 ROL::Ptr<V> vo = ROL::makePtr<SV>(vo_ptr);
89 ROL::Ptr<V> vs = ROL::makePtr<SV>(vs_ptr);
90 ROL::Ptr<V> ve = ROL::makePtr<SV>(ve_ptr);
91 ROL::Ptr<V> vi = ROL::makePtr<SV>(vi_ptr);
103 ROL::Ptr<vector> ro_ptr = ROL::makePtr<vector>(xo_dim,0.0);
104 ROL::Ptr<vector> rs_ptr = ROL::makePtr<vector>(ci_dim,0.0);
105 ROL::Ptr<vector> re_ptr = ROL::makePtr<vector>(ce_dim,0.0);
106 ROL::Ptr<vector> ri_ptr = ROL::makePtr<vector>(ci_dim,0.0);
108 ROL::Ptr<V> ro = ROL::makePtr<SV>(vo_ptr);
109 ROL::Ptr<V> rs = ROL::makePtr<SV>(vs_ptr);
110 ROL::Ptr<V> re = ROL::makePtr<SV>(ve_ptr);
111 ROL::Ptr<V> ri = ROL::makePtr<SV>(vi_ptr);
122 ROL::Ptr<ROL::Objective<RealT> > obj_hs32 =
123 ROL::makePtr<ROL::ZOO::Objective_HS32<RealT>>();
125 ROL::Ptr<ROL::EqualityConstraint<RealT> > eqcon_hs32 =
126 ROL::makePtr<ROL::ZOO::EqualityConstraint_HS32<RealT>>();
128 ROL::Ptr<ROL::EqualityConstraint<RealT> > incon_hs32 =
129 ROL::makePtr<ROL::ZOO::InequalityConstraint_HS32<RealT>>();
132 *outStream <<
"Performing finite difference check on Primal-Dual KKT system"
137 PrimalDualResidual<RealT> con(obj_hs32,eqcon_hs32,incon_hs32, *x);
139 con.checkApplyJacobian(*x,*v,*r,
true,*outStream);
143 catch (std::logic_error& err) {
144 *outStream << err.what() <<
"\n";
149 std::cout <<
"End Result: TEST FAILED\n";
151 std::cout <<
"End Result: TEST PASSED\n";
typename PV< Real >::size_type size_type
ROL::Ptr< Vector< Real > > CreatePartitionedVector(const ROL::Ptr< Vector< Real >> &a)
void RandomizeVector(Vector< Real > &x, const Real &lower=0.0, const Real &upper=1.0)
Fill a ROL::Vector with uniformly-distributed random numbers in the interval [lower,upper].
Defines the linear algebra or vector space interface.
basic_nullstream< char, std::char_traits< char >> nullstream
Express the Primal-Dual Interior Point gradient as an equality constraint.
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...
int main(int argc, char *argv[])