77 Ptr<const std::vector<Real> > ex
82 Real h = 1.0/((Real)(
dim_) + 1.0);
84 f = 2.0*(*ex)[i] + h*h*std::pow((*ex)[i] + (Real)(i+1)*h + 1.0,3.0)/2.0;
85 if ( i < (dim_-1) ) { f -= (*ex)[i+1]; }
86 if ( i > 0 ) { f -= (*ex)[i-1]; }
93 Ptr<std::vector<Real> > eg
95 Ptr<const std::vector<Real> > ex
99 Real h = 1.0/((Real)(
dim_) + 1.0);
100 std::vector<Real> f(
dim_,0.0);
103 f[i] = 2.0*(*ex)[i] + h*h*std::pow((*ex)[i] + (Real)(i+1)*h + 1.0,3.0)/2.0;
104 if ( i < (dim_-1) ) { f[i] -= (*ex)[i+1]; }
105 if ( i > 0) { f[i] -= (*ex)[i-1]; }
109 df = (2.0 + 3.0*h*h*std::pow((*ex)[i] + (Real)(i+1)*h + 1.0,2.0)/2.0)*f[i];
110 if ( i < (dim_-1) ) { df -= f[i+1]; }
111 if ( i > 0 ) { df -= f[i-1]; }
117 Ptr<std::vector<Real> > ehv
119 Ptr<const std::vector<Real> > ev
121 Ptr<const std::vector<Real> > ex
125 Real h = 1.0/((Real)(
dim_) + 1.0);
126 Real f = 0.0, df = 0.0, dfn = 0.0, hf = 0.0;
128 f = 2.0*(*ex)[i] + h*h*std::pow((*ex)[i] + (Real)(i+1)*h + 1.0,3.0)/2.0;
129 df = 2.0 + 3.0/2.0 * h*h * std::pow((*ex)[i] + (Real)(i+1)*h + 1.0,2.0);
130 hf = 3.0 * h*h * ((*ex)[i] + (Real)(i+1)*h + 1.0);
131 if ( i < (dim_-2) ) {
132 (*ehv)[i] += 2.0*(*ev)[i+2];
134 if ( i < (dim_-1) ) {
136 dfn = 2.0 + 3.0/2.0 * h*h * std::pow((*ex)[i+1] + (Real)(i+2)*h + 1.0,2.0);
137 (*ehv)[i] -= 2.0*(df + dfn)*(*ev)[i+1];
138 (*ehv)[i] += 2.0*(*ev)[i];
142 dfn = 2.0 + 3.0/2.0 * h*h * std::pow((*ex)[i-1] + (Real)(i)*h + 1.0,2.0);
143 (*ehv)[i] -= 2.0*(df + dfn)*(*ev)[i-1];
144 (*ehv)[i] += 2.0*(*ev)[i];
147 (*ehv)[i] += 2.0*(*ev)[i-2];
149 (*ehv)[i] += 2.0*(hf*f + df*df)*(*ev)[i];
164 scale_ = makePtr<std::vector<Real>>(
n_,0.0);
175 (*scale_)[10] = 1.e2;
176 (*scale_)[11] = 1.e2;
177 (*scale_)[12] = 1.e2;
178 (*scale_)[13] = 1.e2;
179 (*scale_)[14] = 1.e2;
180 (*scale_)[15] = 1.e2;
181 (*scale_)[16] = 1.e4;
182 (*scale_)[17] = 1.e4;
183 (*scale_)[18] = 1.e4;
184 (*scale_)[19] = 1.e6;
188 return makePtr<Objective_BVP<Real>>();
193 Ptr<std::vector<Real> > x0p = makePtr<std::vector<Real>>(
n_,0.0);
194 Real h = 1.0/((Real)n_ + 1.0);
195 for (
int i = 0; i <
n_; i++ ) {
196 (*x0p)[i] = (Real)(i+1)*h*((Real)(i+1)*h - 1.0);
198 return makePtr<PrimalScaledStdVector<Real>>(x0p,
scale_);
203 Ptr<std::vector<Real> > xp = makePtr<std::vector<Real>>(
n_,0.0);
204 (*xp)[0] = 1.2321000000000001e-01;
205 (*xp)[1] = 2.1743122909175336e-01;
206 (*xp)[2] = 2.8625218549543746e-01;
207 (*xp)[3] = 3.3309751851140840e-01;
208 (*xp)[4] = 3.6117201714254760e-01;
209 (*xp)[5] = 3.7342787212179440e-01;
210 (*xp)[6] = 3.7255212003706123e-01;
211 (*xp)[7] = 3.6096984201471016e-01;
212 (*xp)[8] = 3.4085861052124522e-01;
213 (*xp)[9] = 3.1417024791439530e-01;
214 (*xp)[10] = 2.8265678244892922e-01;
215 (*xp)[11] = 2.4789833165179542e-01;
216 (*xp)[12] = 2.1133139591375166e-01;
217 (*xp)[13] = 1.7427666644258599e-01;
218 (*xp)[14] = 1.3796594229036069e-01;
219 (*xp)[15] = 1.0356813245768780e-01;
220 (*xp)[16] = 7.2214621084083663e-02;
221 (*xp)[17] = 4.5024529114833199e-02;
222 (*xp)[18] = 2.3130648161534966e-02;
223 (*xp)[19] = 7.7070870882527927e-03;
224 return makePtr<PrimalScaledStdVector<Real>>(xp,
scale_);
229 Ptr<std::vector<Real> > lp = makePtr<std::vector<Real>>();
230 Ptr<std::vector<Real> > up = makePtr<std::vector<Real>>();
231 std::vector<Real> val(
n_,0.0);
233 val[1] = -0.1*0.4520;
234 val[2] = -0.1*0.6588;
235 val[3] = -0.1*0.8514;
236 val[4] = -0.1*1.0288;
237 val[5] = -0.1*1.1985;
238 val[6] = -0.1*1.3322;
239 val[7] = -0.1*1.4553;
240 val[8] = -0.1*1.5571;
241 val[9] = -0.1*1.6354;
242 val[10] = -0.1*1.6881;
243 val[11] = -0.1*1.7127;
244 val[12] = -0.1*1.7060;
245 val[13] = -0.1*1.6650;
246 val[14] = -0.1*1.5856;
247 val[15] = -0.1*1.4636;
248 val[16] = -0.1*1.2938;
249 val[17] = -0.1*1.0702;
250 val[18] = -0.1*0.7858;
251 val[19] = -0.1*0.4323;
252 for (
int i = 0; i <
n_; i++ ) {
254 lp->push_back(std::max(-0.2*(Real)(n_),val[i]+0.1));
255 up->push_back(std::min( 0.2*(Real)(n_),val[i]+1.1));
258 lp->push_back(-0.2*(Real)(n_));
259 up->push_back( 0.2*(Real)(n_));
262 Ptr<Vector<Real> > l = makePtr<StdVector<Real>>(lp);
263 Ptr<Vector<Real> > u = makePtr<StdVector<Real>>(up);
264 return makePtr<Bounds<Real>>(l,u);
Provides the interface to evaluate objective functions.
Ptr< std::vector< Real > > scale_
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
typename PV< Real >::size_type size_type
Real value(const Vector< Real > &x, Real &tol)
Compute value.
Ptr< Vector< Real > > getInitialGuess(void) const
Ptr< Vector< Real > > getSolution(const int i=0) const
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
virtual void zero()
Set to zero vector.
Defines the linear algebra or vector space interface.
std::vector< Real >::size_type uint
Ptr< Objective< Real > > getObjective(void) const
Contains definitions of test objective functions.
Ptr< BoundConstraint< Real > > getBoundConstraint(void) const
The discrete boundary value problem.