19 #ifndef ROL_FREUDENSTEINROTH_HPP
20 #define ROL_FREUDENSTEINROTH_HPP
36 Ptr<const std::vector<Real> > ex
39 Real f1 = -13.0 + (*ex)[0] + ((5.0-(*ex)[1])*(*ex)[1] - 2.0)*(*ex)[1];
40 Real f2 = -29.0 + (*ex)[0] + (((*ex)[1]+1.0)*(*ex)[1] - 14.0)*(*ex)[1];
46 Ptr<std::vector<Real> > eg
48 Ptr<const std::vector<Real> > ex
51 Real f1 = -13.0 + (*ex)[0] + ((5.0-(*ex)[1])*(*ex)[1] - 2.0)*(*ex)[1];
52 Real f2 = -29.0 + (*ex)[0] + (((*ex)[1]+1.0)*(*ex)[1] - 14.0)*(*ex)[1];
55 Real f12 = 10.0*(*ex)[1] - 3.0*(*ex)[1]*(*ex)[1] - 2.0;
57 Real f22 = 3.0*(*ex)[1]*(*ex)[1] + 2.0*(*ex)[1] - 14.0;
59 (*eg)[0] = 2.0*(f11*f1 + f21*f2);
60 (*eg)[1] = 2.0*(f12*f1 + f22*f2);
64 Ptr<std::vector<Real> > ehv
66 Ptr<const std::vector<Real> > ev
68 Ptr<const std::vector<Real> > ex
71 Real f1 = -13.0 + (*ex)[0] + ((5.0-(*ex)[1])*(*ex)[1] - 2.0)*(*ex)[1];
72 Real f2 = -29.0 + (*ex)[0] + (((*ex)[1]+1.0)*(*ex)[1] - 14.0)*(*ex)[1];
75 Real f12 = 10.0*(*ex)[1] - 3.0*(*ex)[1]*(*ex)[1] - 2.0;
77 Real f22 = 3.0*(*ex)[1]*(*ex)[1] + 2.0*(*ex)[1] - 14.0;
79 Real f122 = 10.0 - 6.0*(*ex)[1];
80 Real f222 = 6.0*(*ex)[1] + 2.0;
82 Real h11 = 2.0*(f11*f11) + 2.0*(f21*f21);
83 Real h12 = 2.0*(f12*f11) + 2.0*(f22*f21);
84 Real h22 = 2.0*(f122*f1 + f12*f12) + 2.0*(f222*f2 + f22*f22);
86 (*ehv)[0] = h11*(*ev)[0] + h12*(*ev)[1];
87 (*ehv)[1] = h12*(*ev)[0] + h22*(*ev)[1];
91 Ptr<std::vector<Real> > ehv
93 Ptr<const std::vector<Real> > ev
95 Ptr<const std::vector<Real> > ex
98 Real f1 = -13.0 + (*ex)[0] + ((5.0-(*ex)[1])*(*ex)[1] - 2.0)*(*ex)[1];
99 Real f2 = -29.0 + (*ex)[0] + (((*ex)[1]+1.0)*(*ex)[1] - 14.0)*(*ex)[1];
102 Real f12 = 10.0*(*ex)[1] - 3.0*(*ex)[1]*(*ex)[1] - 2.0;
104 Real f22 = 3.0*(*ex)[1]*(*ex)[1] + 2.0*(*ex)[1] - 14.0;
106 Real f122 = 10.0 - 6.0*(*ex)[1];
107 Real f222 = 6.0*(*ex)[1] + 2.0;
109 Real h11 = 2.0*(f11*f11) + 2.0*(f21*f21);
110 Real h12 = 2.0*(f12*f11) + 2.0*(f22*f21);
111 Real h22 = 2.0*(f122*f1 + f12*f12) + 2.0*(f222*f2 + f22*f22);
113 (*ehv)[0] = (1.0/(h11*h22-h12*h12))*( h22*(*ev)[0] - h12*(*ev)[1]);
114 (*ehv)[1] = (1.0/(h11*h22-h12*h12))*(-h12*(*ev)[0] + h11*(*ev)[1]);
125 return makePtr<Objective_FreudensteinRoth<Real>>();
132 Ptr<std::vector<Real> > x0p = makePtr<std::vector<Real>>(n,0.0);
133 (*x0p)[0] = 0.5; (*x0p)[1] = -2.0;
134 return makePtr<StdVector<Real>>(x0p);
141 Ptr<std::vector<Real> > xp = makePtr<std::vector<Real>>(n,0.0);
143 (*xp)[0] = 5.0; (*xp)[1] = 4.0;
146 (*xp)[0] = 11.412779; (*xp)[1] = -0.896805;
151 return makePtr<StdVector<Real>>(xp);
Provides the interface to evaluate objective functions.
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
int getNumSolutions(void) const
Ptr< Vector< Real > > getInitialGuess(void) const
Ptr< Vector< Real > > getSolution(const int i=0) const
Defines the linear algebra or vector space interface.
getFreudensteinRoth(void)
Objective_FreudensteinRoth()
Contains definitions of test objective functions.
Ptr< Objective< Real > > getObjective(void) const
Freudenstein and Roth's function.
void invHessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply inverse Hessian approximation to vector.
Real value(const Vector< Real > &x, Real &tol)
Compute value.
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.