71 Real
value(
const std::vector<Real> &x, Real &tol ) {
72 const Real one(1), two(2);
73 return std::pow(x[0]-one,two) + std::pow(x[1]-x[2],two) + std::pow(x[3]-x[4],two);
76 void gradient( std::vector<Real> &g,
const std::vector<Real> &x, Real &tol ) {
77 const Real one(1), two(2);
78 g[0] = two*(x[0]-one);
79 g[1] = two*(x[1]-x[2]);
80 g[2] = two*(x[2]-x[1]);
81 g[3] = two*(x[3]-x[4]);
82 g[4] = two*(x[4]-x[3]);
85 void hessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
88 hv[1] = two*v[1] - two*v[2];
89 hv[2] = two*v[2] - two*v[1];
90 hv[3] = two*v[3] - two*v[4];
91 hv[4] = two*v[4] - two*v[3];
100 void value( std::vector<Real> &c,
const std::vector<Real> &x, Real &tol ) {
101 const Real c2(2), c3(3), c5(5);
102 c[0] = x[0]+x[1]+x[2]+x[3]+x[4]-c5;
103 c[1] = x[2]-c2*(x[3]+x[4])+c3;
107 const std::vector<Real> &x, Real &tol) {
109 jv[0] = v[0]+v[1]+v[2]+v[3]+v[4];
110 jv[1] = v[2]-c2*(v[3]+v[4]);
114 const std::vector<Real> &x, Real &tol ) {
118 ajv[2] = v[0] + v[1];
119 ajv[3] = v[0] - c2*v[1];
120 ajv[4] = v[0] - c2*v[1];
124 const std::vector<Real> &v,
const std::vector<Real> &x,
126 ahuv.assign(ahuv.size(),
static_cast<Real
>(0));
138 return ROL::makePtr<Objective_HS48<Real>>();
143 ROL::Ptr<std::vector<Real>> xp = ROL::makePtr<std::vector<Real>>(n,0.0);
144 (*xp)[0] =
static_cast<Real
>(3);
145 (*xp)[1] =
static_cast<Real
>(5);
146 (*xp)[2] =
static_cast<Real
>(-3);
147 (*xp)[3] =
static_cast<Real
>(2);
148 (*xp)[4] =
static_cast<Real
>(-2);
149 return ROL::makePtr<StdVector<Real>>(xp);
154 return ROL::makePtr<StdVector<Real>>(n,1.0);
158 return ROL::makePtr<Constraint_HS48<Real>>();
163 return ROL::makePtr<StdVector<Real>>(n,0.0);
void applyAdjointJacobian(std::vector< Real > &ajv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
Ptr< Objective< Real > > getObjective(void) const
Contains definitions of custom data types in ROL.
void applyJacobian(std::vector< Real > &jv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
Defines the equality constraint operator interface for StdVectors.
void gradient(std::vector< Real > &g, const std::vector< Real > &x, Real &tol)
Real value(const std::vector< Real > &x, Real &tol)
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.
Contains definitions of test objective functions.
Ptr< Vector< Real > > getEqualityMultiplier(void) const
Ptr< Vector< Real > > getSolution(const int i=0) const
Ptr< Constraint< Real > > getEqualityConstraint(void) const
void applyAdjointHessian(std::vector< Real > &ahuv, const std::vector< Real > &u, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
void value(std::vector< Real > &c, const std::vector< Real > &x, Real &tol)
W. Hock and K. Schittkowski 48th test function.
Ptr< Vector< Real > > getInitialGuess(void) const