37 Real
value(
const std::vector<Real> &x, Real &tol ) {
38 const Real c1(1), c2(2), c4(4), c6(6);
39 return std::pow(x[0]-x[1],c2) + std::pow(x[2]-c1,c2)
40 + std::pow(x[3]-c1,c4) + std::pow(x[4]-c1,c6);
43 void gradient( std::vector<Real> &g,
const std::vector<Real> &x, Real &tol ) {
44 const Real c1(1), c2(2), c3(3), c4(4), c5(5), c6(6);
45 g[0] = c2*(x[0]-x[1]);
46 g[1] = c2*(x[1]-x[0]);
48 g[3] = c4*std::pow(x[3]-c1,c3);
49 g[4] = c6*std::pow(x[4]-c1,c5);
52 void hessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
53 const Real c1(1), c2(2), c3(3), c4(4), c5(5), c6(6);
54 hv[0] = c2*v[0] - c2*v[1];
55 hv[1] = c2*v[1] - c2*v[0];
57 hv[3] = c4*c3*std::pow(x[3]-c1,c2)*v[3];
58 hv[4] = c6*c5*std::pow(x[4]-c1,c4)*v[4];
67 void value( std::vector<Real> &c,
const std::vector<Real> &x, Real &tol ) {
68 const Real c4(4), c5(5), c6(6), c7(7);
69 c[0] = x[0]+x[1]+x[2]+c4*x[3]-c7;
70 c[1] = x[2]+c5*x[4]-c6;
74 const std::vector<Real> &x, Real &tol) {
75 const Real c4(4), c5(5);
76 jv[0] = v[0]+v[1]+v[2]+c4*v[3];
81 const std::vector<Real> &x, Real &tol ) {
82 const Real c4(4), c5(5);
91 const std::vector<Real> &v,
const std::vector<Real> &x,
93 ahuv.assign(ahuv.size(),
static_cast<Real
>(0));
105 return ROL::makePtr<Objective_HS49<Real>>();
110 ROL::Ptr<std::vector<Real>> xp = ROL::makePtr<std::vector<Real>>(n,0.0);
111 (*xp)[0] =
static_cast<Real
>(10);
112 (*xp)[1] =
static_cast<Real
>(7);
113 (*xp)[2] =
static_cast<Real
>(2);
114 (*xp)[3] =
static_cast<Real
>(-3);
115 (*xp)[4] =
static_cast<Real
>(0.8);
116 return ROL::makePtr<StdVector<Real>>(xp);
121 return ROL::makePtr<StdVector<Real>>(n,1.0);
125 return ROL::makePtr<Constraint_HS49<Real>>();
130 return ROL::makePtr<StdVector<Real>>(n,0.0);
void gradient(std::vector< Real > &g, const std::vector< Real > &x, Real &tol)
Contains definitions of custom data types in ROL.
void applyAdjointHessian(std::vector< Real > &ahuv, const std::vector< Real > &u, const std::vector< Real > &v, 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)
void value(std::vector< Real > &c, const std::vector< Real > &x, Real &tol)
Defines the equality constraint operator interface for StdVectors.
Real value(const std::vector< Real > &x, Real &tol)
Ptr< Vector< Real > > getEqualityMultiplier(void) const
Specializes the ROL::Objective interface for objective functions that operate on ROL::StdVector's.
void applyJacobian(std::vector< Real > &jv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
Ptr< Constraint< Real > > getEqualityConstraint(void) const
Ptr< Vector< Real > > getInitialGuess(void) const
Contains definitions of test objective functions.
W. Hock and K. Schittkowski 49th test function.
Ptr< Vector< Real > > getSolution(const int i=0) const
void applyAdjointJacobian(std::vector< Real > &ajv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
Ptr< Objective< Real > > getObjective(void) const