40 Real
value(
const std::vector<Real> &x, Real &tol ) {
41 const Real c1(1), c2(2), c3(3), c4(4);
42 return std::pow(x[0]-c1,c2) + std::pow(x[1]-c2,c2)
43 + std::pow(x[2]-c3,c2) + std::pow(x[3]-c4,c2);
46 void gradient( std::vector<Real> &g,
const std::vector<Real> &x, Real &tol ) {
47 const Real c1(1), c2(2), c3(3), c4(4);
54 void hessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
68 void value( std::vector<Real> &c,
const std::vector<Real> &x, Real &tol ) {
74 const std::vector<Real> &x, Real &tol) {
79 const std::vector<Real> &x, Real &tol ) {
81 ajv[1] =
static_cast<Real
>(0);
82 ajv[2] =
static_cast<Real
>(0);
83 ajv[3] =
static_cast<Real
>(0);
87 const std::vector<Real> &v,
const std::vector<Real> &x,
89 ahuv.assign(ahuv.size(),
static_cast<Real
>(0));
98 void value( std::vector<Real> &c,
const std::vector<Real> &x, Real &tol ) {
100 c[0] = std::pow(x[2],c2) + std::pow(x[3],c2) - c2;
104 const std::vector<Real> &x, Real &tol) {
106 jv[0] = c2*x[2]*v[2] + c2*x[3]*v[3];
110 const std::vector<Real> &x, Real &tol ) {
112 ajv[0] =
static_cast<Real
>(0);
113 ajv[1] =
static_cast<Real
>(0);
114 ajv[2] = c2*x[2]*v[0];
115 ajv[3] = c2*x[3]*v[0];
119 const std::vector<Real> &v,
const std::vector<Real> &x,
122 ahuv[0] =
static_cast<Real
>(0);
123 ahuv[1] =
static_cast<Real
>(0);
124 ahuv[2] = c2*v[2]*u[0];
125 ahuv[3] = c2*v[3]*u[0];
135 return ROL::makePtr<Objective_HS42<Real>>();
140 return ROL::makePtr<StdVector<Real>>(n,1.0);
145 ROL::Ptr<std::vector<Real> > xp = ROL::makePtr<std::vector<Real>>(n,0.0);
146 (*xp)[0] =
static_cast<Real
>(2);
147 (*xp)[1] =
static_cast<Real
>(2);
148 (*xp)[2] =
static_cast<Real
>(0.6*std::sqrt(2));
149 (*xp)[3] =
static_cast<Real
>(0.8*std::sqrt(2));
150 return ROL::makePtr<StdVector<Real>>(xp);
154 std::vector<Ptr<Constraint<Real>>> cvec(2);
155 cvec[0] = makePtr<Constraint_HS42a<Real>>();
156 cvec[1] = makePtr<Constraint_HS42b<Real>>();
157 return ROL::makePtr<Constraint_Partitioned<Real>>(cvec);
161 std::vector<Ptr<Vector<Real>>> lvec(2);
162 lvec[0] = makePtr<StdVector<Real>>(makePtr<std::vector<Real>>(1,0.0));
163 lvec[1] = makePtr<StdVector<Real>>(makePtr<std::vector<Real>>(1,0.0));
164 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)