72 Real
value(
const std::vector<Real> &x, Real &tol ) {
73 const Real c2(2), c4(4);
74 return x[0] + c2*x[1] + c4*x[4] + std::exp(x[0]*x[3]);
77 void gradient( std::vector<Real> &g,
const std::vector<Real> &x, Real &tol ) {
78 const Real c0(0), c1(1), c2(2), c4(4);
79 Real exp03 = std::exp(x[0]*x[3]);
80 g[0] = c1 + x[3]*exp03;
88 void hessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
89 const Real c0(0), c1(1);
90 Real exp03 = std::exp(x[0]*x[3]);
91 hv[0] = x[3]*x[3]*exp03*v[0] + (c1 + x[3]*x[0])*exp03*v[3];
94 hv[3] = (c1 + x[0]*x[3])*exp03*v[0] + x[0]*x[0]*exp03*v[3];
103 void value( std::vector<Real> &c,
const std::vector<Real> &x, Real &tol ) {
104 const Real c1(1), c2(2), c3(3), c5(5), c6(6);
105 c[0] = x[0] + c2*x[1] + c5*x[4] - c6;
106 c[1] = x[0] + x[1] + x[2] - c3;
107 c[2] = x[3] + x[4] + x[5] - c2;
108 c[3] = x[0] + x[3] - c1;
109 c[4] = x[1] + x[4] - c2;
110 c[5] = x[2] + x[5] - c2;
114 const std::vector<Real> &x, Real &tol) {
115 const Real c2(2), c5(5);
116 jv[0] = v[0] + c2*v[1] + c5*v[4];
117 jv[1] = v[0] + v[1] + v[2];
118 jv[2] = v[3] + v[4] + v[5];
125 const std::vector<Real> &x, Real &tol ) {
126 const Real c2(2), c5(5);
127 ajv[0] = v[0] + v[1] + v[3];
128 ajv[1] = c2*v[0] + v[1] + v[4];
129 ajv[2] = v[1] + v[5];
130 ajv[3] = v[2] + v[3];
131 ajv[4] = c5*v[0] + v[2] + v[4];
132 ajv[5] = v[2] + v[5];
136 const std::vector<Real> &v,
const std::vector<Real> &x,
138 ahuv.assign(ahuv.size(),
static_cast<Real
>(0));
148 return ROL::makePtr<Objective_HS55<Real>>();
153 ROL::Ptr<std::vector<Real>> xp = ROL::makePtr<std::vector<Real>>(n);
154 (*xp)[0] =
static_cast<Real
>(1.0);
155 (*xp)[1] =
static_cast<Real
>(2.0);
156 (*xp)[2] =
static_cast<Real
>(0.0);
157 (*xp)[3] =
static_cast<Real
>(0.0);
158 (*xp)[4] =
static_cast<Real
>(0.0);
159 (*xp)[5] =
static_cast<Real
>(2.0);
160 return ROL::makePtr<StdVector<Real>>(xp);
165 ROL::Ptr<std::vector<Real>> xp = ROL::makePtr<std::vector<Real>>(n);
166 (*xp)[0] =
static_cast<Real
>(0.0);
167 (*xp)[1] =
static_cast<Real
>(4.0/3.0);
168 (*xp)[2] =
static_cast<Real
>(5.0/3.0);
169 (*xp)[3] =
static_cast<Real
>(1.0);
170 (*xp)[4] =
static_cast<Real
>(2.0/3.0);
171 (*xp)[5] =
static_cast<Real
>(1.0/3.0);
172 return ROL::makePtr<StdVector<Real>>(xp);
176 return ROL::makePtr<Constraint_HS55<Real>>();
181 return ROL::makePtr<StdVector<Real>>(n,0.0);
186 Ptr<Vector<Real>> l = makePtr<StdVector<Real>>(n,0.0);
187 ROL::Ptr<std::vector<Real>> up = ROL::makePtr<std::vector<Real>>(n,ROL_INF<Real>());
188 (*up)[0] =
static_cast<Real
>(1);
189 (*up)[3] =
static_cast<Real
>(1);
190 Ptr<Vector<Real>> u = makePtr<StdVector<Real>>(up);
191 return makePtr<Bounds<Real>>(l,u);
Contains definitions of custom data types in ROL.
Real value(const std::vector< Real > &x, Real &tol)
void applyAdjointJacobian(std::vector< Real > &ajv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
Ptr< BoundConstraint< Real > > getBoundConstraint(void) const
Defines the equality constraint operator interface for StdVectors.
void applyJacobian(std::vector< Real > &jv, 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.
Ptr< Vector< Real > > getEqualityMultiplier(void) const
Ptr< Vector< Real > > getInitialGuess(void) const
Contains definitions of test objective functions.
W. Hock and K. Schittkowski 55th test function.
void gradient(std::vector< Real > &g, const std::vector< Real > &x, Real &tol)
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)
Ptr< Vector< Real > > getSolution(const int i=0) const
Ptr< Objective< Real > > getObjective(void) const
Ptr< Constraint< Real > > getEqualityConstraint(void) const