74 Real
value(
const std::vector<Real> &x, Real &tol ) {
75 const Real c1(1), c2(2), c3(3), c4(4);
76 return std::pow(x[0]-c1,c2) + std::pow(x[1]-c2,c2)
77 + std::pow(x[2]-c3,c2) + std::pow(x[3]-c4,c2);
80 void gradient( std::vector<Real> &g,
const std::vector<Real> &x, Real &tol ) {
81 const Real c1(1), c2(2), c3(3), c4(4);
88 void hessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
102 void value( std::vector<Real> &c,
const std::vector<Real> &x, Real &tol ) {
108 const std::vector<Real> &x, Real &tol) {
113 const std::vector<Real> &x, Real &tol ) {
115 ajv[1] =
static_cast<Real
>(0);
116 ajv[2] =
static_cast<Real
>(0);
117 ajv[3] =
static_cast<Real
>(0);
121 const std::vector<Real> &v,
const std::vector<Real> &x,
123 ahuv.assign(ahuv.size(),
static_cast<Real
>(0));
132 void value( std::vector<Real> &c,
const std::vector<Real> &x, Real &tol ) {
134 c[0] = std::pow(x[2],c2) + std::pow(x[3],c2) - c2;
138 const std::vector<Real> &x, Real &tol) {
140 jv[0] = c2*x[2]*v[2] + c2*x[3]*v[3];
144 const std::vector<Real> &x, Real &tol ) {
146 ajv[0] =
static_cast<Real
>(0);
147 ajv[1] =
static_cast<Real
>(0);
148 ajv[2] = c2*x[2]*v[0];
149 ajv[3] = c2*x[3]*v[0];
153 const std::vector<Real> &v,
const std::vector<Real> &x,
156 ahuv[0] =
static_cast<Real
>(0);
157 ahuv[1] =
static_cast<Real
>(0);
158 ahuv[2] = c2*v[2]*u[0];
159 ahuv[3] = c2*v[3]*u[0];
169 return ROL::makePtr<Objective_HS42<Real>>();
174 return ROL::makePtr<StdVector<Real>>(n,1.0);
179 ROL::Ptr<std::vector<Real> > xp = ROL::makePtr<std::vector<Real>>(n,0.0);
180 (*xp)[0] =
static_cast<Real
>(2);
181 (*xp)[1] =
static_cast<Real
>(2);
182 (*xp)[2] =
static_cast<Real
>(0.6*std::sqrt(2));
183 (*xp)[3] =
static_cast<Real
>(0.8*std::sqrt(2));
184 return ROL::makePtr<StdVector<Real>>(xp);
188 std::vector<Ptr<Constraint<Real>>> cvec(2);
189 cvec[0] = makePtr<Constraint_HS42a<Real>>();
190 cvec[1] = makePtr<Constraint_HS42b<Real>>();
191 return ROL::makePtr<Constraint_Partitioned<Real>>(cvec);
195 std::vector<Ptr<Vector<Real>>> lvec(2);
196 lvec[0] = makePtr<StdVector<Real>>(makePtr<std::vector<Real>>(1,0.0));
197 lvec[1] = makePtr<StdVector<Real>>(makePtr<std::vector<Real>>(1,0.0));
198 return ROL::makePtr<PartitionedVector<Real>>(lvec);
Real value(const std::vector< Real > &x, Real &tol)
W. Hock and K. Schittkowski 42th test function.
Ptr< Vector< Real > > getSolution(const int i=0) const
void applyJacobian(std::vector< Real > &jv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
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)
Ptr< Constraint< Real > > getEqualityConstraint(void) const
Defines the equality constraint operator interface for StdVectors.
void applyAdjointHessian(std::vector< Real > &ahuv, const std::vector< Real > &u, const std::vector< Real > &v, 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)
Specializes the ROL::Objective interface for objective functions that operate on ROL::StdVector's.
void value(std::vector< Real > &c, const std::vector< Real > &x, Real &tol)
Contains definitions of test objective functions.
Ptr< Vector< Real > > getEqualityMultiplier(void) const
void hessVec(std::vector< Real > &hv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
Ptr< Vector< Real > > getInitialGuess(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)
void applyAdjointJacobian(std::vector< Real > &ajv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
Ptr< Objective< Real > > getObjective(void) const
void gradient(std::vector< Real > &g, const std::vector< Real > &x, Real &tol)