71 Real
value(
const std::vector<Real> &x, Real &tol ) {
72 const Real c1(1), c2(2), c4(4), c6(6);
73 return std::pow(x[0]-x[1],c2) + std::pow(x[2]-c1,c2)
74 + std::pow(x[3]-c1,c4) + std::pow(x[4]-c1,c6);
77 void gradient( std::vector<Real> &g,
const std::vector<Real> &x, Real &tol ) {
78 const Real c1(1), c2(2), c3(3), c4(4), c5(5), c6(6);
79 g[0] = c2*(x[0]-x[1]);
80 g[1] = c2*(x[1]-x[0]);
82 g[3] = c4*std::pow(x[3]-c1,c3);
83 g[4] = c6*std::pow(x[4]-c1,c5);
86 void hessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
87 const Real c1(1), c2(2), c3(3), c4(4), c5(5), c6(6);
88 hv[0] = c2*v[0] - c2*v[1];
89 hv[1] = c2*v[1] - c2*v[0];
91 hv[3] = c4*c3*std::pow(x[3]-c1,c2)*v[3];
92 hv[4] = c6*c5*std::pow(x[4]-c1,c4)*v[4];
101 void value( std::vector<Real> &c,
const std::vector<Real> &x, Real &tol ) {
102 const Real c4(4), c5(5), c6(6), c7(7);
103 c[0] = x[0]+x[1]+x[2]+c4*x[3]-c7;
104 c[1] = x[2]+c5*x[4]-c6;
108 const std::vector<Real> &x, Real &tol) {
109 const Real c4(4), c5(5);
110 jv[0] = v[0]+v[1]+v[2]+c4*v[3];
111 jv[1] = v[2]+c5*v[4];
115 const std::vector<Real> &x, Real &tol ) {
116 const Real c4(4), c5(5);
119 ajv[2] = v[0] + v[1];
125 const std::vector<Real> &v,
const std::vector<Real> &x,
127 ahuv.assign(ahuv.size(),
static_cast<Real
>(0));
139 return ROL::makePtr<Objective_HS49<Real>>();
144 ROL::Ptr<std::vector<Real>> xp = ROL::makePtr<std::vector<Real>>(n,0.0);
145 (*xp)[0] =
static_cast<Real
>(10);
146 (*xp)[1] =
static_cast<Real
>(7);
147 (*xp)[2] =
static_cast<Real
>(2);
148 (*xp)[3] =
static_cast<Real
>(-3);
149 (*xp)[4] =
static_cast<Real
>(0.8);
150 return ROL::makePtr<StdVector<Real>>(xp);
155 return ROL::makePtr<StdVector<Real>>(n,1.0);
159 return ROL::makePtr<Constraint_HS49<Real>>();
164 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