72 Real
value(
const std::vector<Real> &x, Real &tol ) {
73 const Real c1(1), c2(2);
74 return std::pow(x[0]-x[1],c2) + std::pow(x[1]+x[2]-c2,c2)
75 + std::pow(x[3]-c1,c2) + std::pow(x[4]-c1,c2);
78 void gradient( std::vector<Real> &g,
const std::vector<Real> &x, Real &tol ) {
79 const Real c1(1), c2(2);
80 g[0] = c2*(x[0]-x[1]);
81 g[1] = c2*(x[1]-x[0]) + c2*(x[1]+x[2]-c2);
82 g[2] = c2*(x[1]+x[2]-c2);
87 void hessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
89 hv[0] = c2*(v[0]-v[1]);
90 hv[1] = c2*(v[1]-v[0]) + c2*(v[1]+v[2]);
91 hv[2] = c2*(v[1]+v[2]);
100 void value( std::vector<Real> &c,
const std::vector<Real> &x, Real &tol ) {
101 const Real c2(2), c3(3);
102 c[0] = x[0] + c3*x[1];
103 c[1] = x[2] + x[3] - c2*x[4];
108 const std::vector<Real> &x, Real &tol) {
109 const Real c2(2), c3(3);
110 jv[0] = v[0] + c3*v[1];
111 jv[1] = v[2] + v[3] - c2*v[4];
116 const std::vector<Real> &x, Real &tol ) {
117 const Real c2(2), c3(3);
119 ajv[1] = c3*v[0] + v[2];
122 ajv[4] = -c2*v[1] - v[2];
126 const std::vector<Real> &v,
const std::vector<Real> &x,
128 ahuv.assign(ahuv.size(),
static_cast<Real
>(0));
138 return ROL::makePtr<Objective_HS53<Real>>();
143 return ROL::makePtr<StdVector<Real>>(n,2.0);
148 ROL::Ptr<std::vector<Real>> xp = ROL::makePtr<std::vector<Real>>(n);
149 (*xp)[0] =
static_cast<Real
>(-33.0/43.0);
150 (*xp)[1] =
static_cast<Real
>( 11.0/43.0);
151 (*xp)[2] =
static_cast<Real
>( 27.0/43.0);
152 (*xp)[3] =
static_cast<Real
>( -5.0/43.0);
153 (*xp)[4] =
static_cast<Real
>( 11.0/43.0);
154 return ROL::makePtr<StdVector<Real>>(xp);
158 return ROL::makePtr<Constraint_HS53<Real>>();
163 return ROL::makePtr<StdVector<Real>>(n,0.0);
168 Ptr<Vector<Real>> l = makePtr<StdVector<Real>>(n,-10.0);
169 Ptr<Vector<Real>> u = makePtr<StdVector<Real>>(n, 10.0);
170 return makePtr<Bounds<Real>>(l,u);
Real value(const std::vector< Real > &x, Real &tol)
Ptr< Vector< Real > > getInitialGuess(void) const
W. Hock and K. Schittkowski 53th test function.
Contains definitions of custom data types in ROL.
Defines the equality constraint operator interface for StdVectors.
void applyAdjointHessian(std::vector< Real > &ahuv, const std::vector< Real > &u, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
Ptr< Constraint< Real > > getEqualityConstraint(void) const
void applyAdjointJacobian(std::vector< Real > &ajv, 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)
Specializes the ROL::Objective interface for objective functions that operate on ROL::StdVector's.
Ptr< Objective< Real > > getObjective(void) const
Ptr< Vector< Real > > getEqualityMultiplier(void) const
Contains definitions of test objective functions.
void value(std::vector< Real > &c, const std::vector< Real > &x, Real &tol)
Ptr< Vector< Real > > getSolution(const int i=0) const
Ptr< BoundConstraint< Real > > getBoundConstraint(void) const
void hessVec(std::vector< Real > &hv, 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)