37 Real
value(
const std::vector<Real> &x, Real &tol ) {
38 const Real one(1), two(2);
39 return std::pow(x[0]-one,two) + std::pow(x[1]-x[2],two) + std::pow(x[3]-x[4],two);
42 void gradient( std::vector<Real> &g,
const std::vector<Real> &x, Real &tol ) {
43 const Real one(1), two(2);
44 g[0] = two*(x[0]-one);
45 g[1] = two*(x[1]-x[2]);
46 g[2] = two*(x[2]-x[1]);
47 g[3] = two*(x[3]-x[4]);
48 g[4] = two*(x[4]-x[3]);
51 void hessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
54 hv[1] = two*v[1] - two*v[2];
55 hv[2] = two*v[2] - two*v[1];
56 hv[3] = two*v[3] - two*v[4];
57 hv[4] = two*v[4] - two*v[3];
66 void value( std::vector<Real> &c,
const std::vector<Real> &x, Real &tol ) {
67 const Real c2(2), c3(3), c5(5);
68 c[0] = x[0]+x[1]+x[2]+x[3]+x[4]-c5;
69 c[1] = x[2]-c2*(x[3]+x[4])+c3;
73 const std::vector<Real> &x, Real &tol) {
75 jv[0] = v[0]+v[1]+v[2]+v[3]+v[4];
76 jv[1] = v[2]-c2*(v[3]+v[4]);
80 const std::vector<Real> &x, Real &tol ) {
85 ajv[3] = v[0] - c2*v[1];
86 ajv[4] = v[0] - c2*v[1];
90 const std::vector<Real> &v,
const std::vector<Real> &x,
92 ahuv.assign(ahuv.size(),
static_cast<Real
>(0));
104 return ROL::makePtr<Objective_HS48<Real>>();
109 ROL::Ptr<std::vector<Real>> xp = ROL::makePtr<std::vector<Real>>(n,0.0);
110 (*xp)[0] =
static_cast<Real
>(3);
111 (*xp)[1] =
static_cast<Real
>(5);
112 (*xp)[2] =
static_cast<Real
>(-3);
113 (*xp)[3] =
static_cast<Real
>(2);
114 (*xp)[4] =
static_cast<Real
>(-2);
115 return ROL::makePtr<StdVector<Real>>(xp);
120 return ROL::makePtr<StdVector<Real>>(n,1.0);
124 return ROL::makePtr<Constraint_HS48<Real>>();
129 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