37 Real
value(
const std::vector<Real> &x, Real &tol ) {
38 const Real c1(1), c2(2);
39 return std::pow(x[0]-x[1],c2) + std::pow(x[1]+x[2]-c2,c2)
40 + std::pow(x[3]-c1,c2) + std::pow(x[4]-c1,c2);
43 void gradient( std::vector<Real> &g,
const std::vector<Real> &x, Real &tol ) {
44 const Real c1(1), c2(2);
45 g[0] = c2*(x[0]-x[1]);
46 g[1] = c2*(x[1]-x[0]) + c2*(x[1]+x[2]-c2);
47 g[2] = c2*(x[1]+x[2]-c2);
52 void hessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
54 hv[0] = c2*v[0] - c2*v[1];
55 hv[1] = (c2+c2)*v[1] - c2*v[0] + c2*v[2];
56 hv[2] = c2*v[2] + c2*v[1];
67 void value( std::vector<Real> &c,
const std::vector<Real> &x, Real &tol ) {
68 const Real c2(2), c3(3), c4(4);
69 c[0] = x[0]+c3*x[1]-c4;
70 c[1] = x[2]+x[3]-c2*x[4];
75 const std::vector<Real> &x, Real &tol) {
76 const Real c2(2), c3(3);
78 jv[1] = v[2]+v[3]-c2*v[4];
83 const std::vector<Real> &x, Real &tol ) {
84 const Real c2(2), c3(3);
86 ajv[1] = c3*v[0] + v[2];
89 ajv[4] = -c2*v[1] - v[2];
93 const std::vector<Real> &v,
const std::vector<Real> &x,
95 ahuv.assign(ahuv.size(),
static_cast<Real
>(0));
107 return ROL::makePtr<Objective_HS51<Real>>();
112 ROL::Ptr<std::vector<Real>> xp = ROL::makePtr<std::vector<Real>>(n,0.0);
113 (*xp)[0] =
static_cast<Real
>(2.5);
114 (*xp)[1] =
static_cast<Real
>(0.5);
115 (*xp)[2] =
static_cast<Real
>(2);
116 (*xp)[3] =
static_cast<Real
>(-1);
117 (*xp)[4] =
static_cast<Real
>(0.5);
118 return ROL::makePtr<StdVector<Real>>(xp);
123 return ROL::makePtr<StdVector<Real>>(n,1.0);
127 return ROL::makePtr<Constraint_HS51<Real>>();
132 return ROL::makePtr<StdVector<Real>>(n,0.0);
void value(std::vector< Real > &c, const std::vector< Real > &x, Real &tol)
Ptr< Objective< Real > > getObjective(void) const
Ptr< Vector< Real > > getSolution(const int i=0) const
Contains definitions of custom data types in ROL.
W. Hock and K. Schittkowski 51th test function.
Defines the equality constraint operator interface for StdVectors.
Real value(const std::vector< Real > &x, Real &tol)
Ptr< Constraint< Real > > getEqualityConstraint(void) const
void hessVec(std::vector< Real > &hv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
Specializes the ROL::Objective interface for objective functions that operate on ROL::StdVector's.
void applyAdjointHessian(std::vector< Real > &ahuv, const std::vector< Real > &u, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
void gradient(std::vector< Real > &g, const std::vector< Real > &x, Real &tol)
Ptr< Vector< Real > > getInitialGuess(void) const
Contains definitions of test objective functions.
void applyAdjointJacobian(std::vector< Real > &ajv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
void applyJacobian(std::vector< Real > &jv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
Ptr< Vector< Real > > getEqualityMultiplier(void) const