ROL
ROL_SimpleEqConstrained.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Rapid Optimization Library (ROL) Package
4 //
5 // Copyright 2014 NTESS and the ROL contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
17 #ifndef ROL_SIMPLEEQCONSTRAINED_HPP
18 #define ROL_SIMPLEEQCONSTRAINED_HPP
19 
20 #include "ROL_TestProblem.hpp"
21 #include "ROL_StdVector.hpp"
22 #include "Teuchos_SerialDenseVector.hpp"
23 #include "Teuchos_SerialDenseSolver.hpp"
24 
25 namespace ROL {
26 namespace ZOO {
27 
31  template< class Real, class XPrim=StdVector<Real>, class XDual=StdVector<Real> >
33 
34  typedef std::vector<Real> vector;
35  typedef Vector<Real> V;
36 
37  typedef typename vector::size_type uint;
38 
39 
40  private:
41 
42  template<class VectorType>
43  ROL::Ptr<const vector> getVector( const V& x ) {
44 
45  return dynamic_cast<const VectorType&>(x).getVector();
46  }
47 
48  template<class VectorType>
49  ROL::Ptr<vector> getVector( V& x ) {
50 
51  return dynamic_cast<VectorType&>(x).getVector();
52  }
53 
54  public:
56 
57  Real value( const Vector<Real> &x, Real &tol ) {
58 
59 
60  ROL::Ptr<const vector> xp = getVector<XPrim>(x);
61 
62  uint n = xp->size();
63  ROL_TEST_FOR_EXCEPTION( (n != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, objective value): "
64  "Primal vector x must be of length 5.");
65 
66  Real x1 = (*xp)[0];
67  Real x2 = (*xp)[1];
68  Real x3 = (*xp)[2];
69  Real x4 = (*xp)[3];
70  Real x5 = (*xp)[4];
71 
72  Real arg = x1*x2*x3*x4*x5;
73  Real val = -0.5*pow(pow(x1,3)+pow(x2,3)+1.0,2);
74  if (std::abs(arg) < 1e5) val += exp(x1*x2*x3*x4*x5);
75  else if (arg > 1e5) val += 1e10;
76  //Real val = exp(x1*x2*x3*x4*x5) - 0.5 * pow( (pow(x1,3)+pow(x2,3)+1.0), 2);
77 
78  return val;
79  }
80 
81  void gradient( Vector<Real> &g, const Vector<Real> &x, Real &tol ) {
82 
83 
84  ROL::Ptr<const vector> xp = getVector<XPrim>(x);
85  ROL::Ptr<vector> gp = getVector<XDual>(g);
86 
87  uint n = xp->size();
88  ROL_TEST_FOR_EXCEPTION( (n != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, objective gradient): "
89  " Primal vector x must be of length 5.");
90 
91  n = gp->size();
92  ROL_TEST_FOR_EXCEPTION( (n != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, objective gradient): "
93  "Gradient vector g must be of length 5.");
94 
95  Real x1 = (*xp)[0];
96  Real x2 = (*xp)[1];
97  Real x3 = (*xp)[2];
98  Real x4 = (*xp)[3];
99  Real x5 = (*xp)[4];
100 
101  Real expxi = exp(x1*x2*x3*x4*x5);
102 
103  (*gp)[0] = x2*x3*x4*x5 * expxi - 3*pow(x1,2) * (pow(x1,3) + pow(x2,3) + 1);
104  (*gp)[1] = x1*x3*x4*x5 * expxi - 3*pow(x2,2) * (pow(x1,3) + pow(x2,3) + 1);
105  (*gp)[2] = x1*x2*x4*x5 * expxi;
106  (*gp)[3] = x1*x2*x3*x5 * expxi;
107  (*gp)[4] = x1*x2*x3*x4 * expxi;
108  }
109 
110  void hessVec( Vector<Real> &hv, const Vector<Real> &v, const Vector<Real> &x, Real &tol ) {
111 
112 
113  ROL::Ptr<const vector> xp = getVector<XPrim>(x);
114  ROL::Ptr<const vector> vp = getVector<XPrim>(v);
115  ROL::Ptr<vector> hvp = getVector<XDual>(hv);
116 
117  uint n = xp->size();
118  ROL_TEST_FOR_EXCEPTION( (n != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, objective hessVec): "
119  "Primal vector x must be of length 5.");
120 
121  n = vp->size();
122  ROL_TEST_FOR_EXCEPTION( (n != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, objective hessVec): "
123  "Input vector v must be of length 5.");
124 
125  n = hvp->size();
126  ROL_TEST_FOR_EXCEPTION( (n != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, objective hessVec): "
127  "Output vector hv must be of length 5.");
128 
129  Real x1 = (*xp)[0];
130  Real x2 = (*xp)[1];
131  Real x3 = (*xp)[2];
132  Real x4 = (*xp)[3];
133  Real x5 = (*xp)[4];
134 
135  Real v1 = (*vp)[0];
136  Real v2 = (*vp)[1];
137  Real v3 = (*vp)[2];
138  Real v4 = (*vp)[3];
139  Real v5 = (*vp)[4];
140 
141  Real expxi = exp(x1*x2*x3*x4*x5);
142 
143  (*hvp)[0] = ( pow(x2,2)*pow(x3,2)*pow(x4,2)*pow(x5,2)*expxi-9.0*pow(x1,4)-6.0*(pow(x1,3)+pow(x2,3)+1.0)*x1 ) * v1 +
144  ( x3*x4*x5*expxi+x2*pow(x3,2)*pow(x4,2)*pow(x5,2)*x1*expxi-9.0*pow(x2,2)*pow(x1,2) ) * v2 +
145  ( x2*x4*x5*expxi+pow(x2,2)*x3*pow(x4,2)*pow(x5,2)*x1*expxi ) * v3 +
146  ( x2*x3*x5*expxi+pow(x2,2)*pow(x3,2)*x4*pow(x5,2)*x1*expxi ) * v4 +
147  ( x2*x3*x4*expxi+pow(x2,2)*pow(x3,2)*pow(x4,2)*x5*x1*expxi ) * v5;
148 
149  (*hvp)[1] = ( x3*x4*x5*expxi+x2*pow(x3,2)*pow(x4,2)*pow(x5,2)*x1*expxi-9.0*pow(x2,2)*pow(x1,2) ) * v1 +
150  ( pow(x1,2)*pow(x3,2)*pow(x4,2)*pow(x5,2)*expxi-9.0*pow(x2,4)-6.0*(pow(x1,3)+pow(x2,3)+1.0)*x2 ) * v2 +
151  ( x1*x4*x5*expxi+pow(x1,2)*x3*pow(x4,2)*pow(x5,2)*x2*expxi ) * v3 +
152  ( x1*x3*x5*expxi+pow(x1,2)*pow(x3,2)*x4*pow(x5,2)*x2*expxi ) * v4 +
153  ( x1*x3*x4*expxi+pow(x1,2)*pow(x3,2)*pow(x4,2)*x5*x2*expxi ) * v5;
154 
155  (*hvp)[2] = ( x2*x4*x5*expxi+pow(x2,2)*x3*pow(x4,2)*pow(x5,2)*x1*expxi ) * v1 +
156  ( x1*x4*x5*expxi+pow(x1,2)*x3*pow(x4,2)*pow(x5,2)*x2*expxi ) * v2 +
157  ( pow(x1,2)*pow(x2,2)*pow(x4,2)*pow(x5,2)*expxi ) * v3 +
158  ( x1*x2*x5*expxi+pow(x1,2)*pow(x2,2)*x4*pow(x5,2)*x3*expxi ) * v4 +
159  ( x1*x2*x4*expxi+pow(x1,2)*pow(x2,2)*pow(x4,2)*x5*x3*expxi ) * v5;
160 
161  (*hvp)[3] = ( x2*x3*x5*expxi+pow(x2,2)*pow(x3,2)*x4*pow(x5,2)*x1*expxi ) * v1 +
162  ( x1*x3*x5*expxi+pow(x1,2)*pow(x3,2)*x4*pow(x5,2)*x2*expxi ) * v2 +
163  ( x1*x2*x5*expxi+pow(x1,2)*pow(x2,2)*x4*pow(x5,2)*x3*expxi ) * v3 +
164  ( pow(x1,2)*pow(x2,2)*pow(x3,2)*pow(x5,2)*expxi ) * v4 +
165  ( x1*x2*x3*expxi+pow(x1,2)*pow(x2,2)*pow(x3,2)*x5*x4*expxi ) * v5;
166 
167  (*hvp)[4] = ( x2*x3*x4*expxi+pow(x2,2)*pow(x3,2)*pow(x4,2)*x5*x1*expxi ) * v1 +
168  ( x1*x3*x4*expxi+pow(x1,2)*pow(x3,2)*pow(x4,2)*x5*x2*expxi ) * v2 +
169  ( x1*x2*x4*expxi+pow(x1,2)*pow(x2,2)*pow(x4,2)*x5*x3*expxi ) * v3 +
170  ( x1*x2*x3*expxi+pow(x1,2)*pow(x2,2)*pow(x3,2)*x5*x4*expxi ) * v4 +
171  ( pow(x1,2)*pow(x2,2)*pow(x3,2)*pow(x4,2)*expxi ) * v5;
172  }
173 
174  };
175 
176 
182  template<class Real, class XPrim=StdVector<Real>, class XDual=StdVector<Real>, class CPrim=StdVector<Real>, class CDual=StdVector<Real> >
184 
185  typedef std::vector<Real> vector;
186  typedef Vector<Real> V;
187 
188  typedef typename vector::size_type uint;
189 
190  private:
191  template<class VectorType>
192  ROL::Ptr<const vector> getVector( const V& x ) {
193 
194  return dynamic_cast<const VectorType&>(x).getVector();
195  }
196 
197  template<class VectorType>
198  ROL::Ptr<vector> getVector( V& x ) {
199 
200  return dynamic_cast<VectorType&>(x).getVector();
201  }
202 
203  public:
205 
206  void value( Vector<Real> &c, const Vector<Real> &x, Real &tol ) {
207 
208 
209  ROL::Ptr<const vector> xp = getVector<XPrim>(x);
210  ROL::Ptr<vector> cp = getVector<CPrim>(c);
211 
212  uint n = xp->size();
213  ROL_TEST_FOR_EXCEPTION( (n != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, constraint value): "
214  "Primal vector x must be of length 5.");
215 
216  uint m = cp->size();
217  ROL_TEST_FOR_EXCEPTION( (m != 3), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, constraint value): "
218  "Constraint vector c must be of length 3.");
219 
220  Real x1 = (*xp)[0];
221  Real x2 = (*xp)[1];
222  Real x3 = (*xp)[2];
223  Real x4 = (*xp)[3];
224  Real x5 = (*xp)[4];
225 
226  (*cp)[0] = x1*x1+x2*x2+x3*x3+x4*x4+x5*x5 - 10.0;
227  (*cp)[1] = x2*x3 - 5.0*x4*x5;
228  (*cp)[2] = x1*x1*x1 + x2*x2*x2 + 1.0;
229  }
230 
231  void applyJacobian( Vector<Real> &jv, const Vector<Real> &v, const Vector<Real> &x, Real &tol ) {
232 
233 
234  ROL::Ptr<const vector> xp = getVector<XPrim>(x);
235  ROL::Ptr<const vector> vp = getVector<XPrim>(v);
236  ROL::Ptr<vector> jvp = getVector<CPrim>(jv);
237 
238  uint n = xp->size();
239  ROL_TEST_FOR_EXCEPTION( (n != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, constraint applyJacobian): "
240  "Primal vector x must be of length 5.");
241 
242  uint d = vp->size();
243  ROL_TEST_FOR_EXCEPTION( (d != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, constraint applyJacobian): "
244  "Input vector v must be of length 5.");
245  d = jvp->size();
246  ROL_TEST_FOR_EXCEPTION( (d != 3), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, constraint applyJacobian): "
247  "Output vector jv must be of length 3.");
248 
249  Real x1 = (*xp)[0];
250  Real x2 = (*xp)[1];
251  Real x3 = (*xp)[2];
252  Real x4 = (*xp)[3];
253  Real x5 = (*xp)[4];
254 
255  Real v1 = (*vp)[0];
256  Real v2 = (*vp)[1];
257  Real v3 = (*vp)[2];
258  Real v4 = (*vp)[3];
259  Real v5 = (*vp)[4];
260 
261  (*jvp)[0] = 2.0*(x1*v1+x2*v2+x3*v3+x4*v4+x5*v5);
262  (*jvp)[1] = x3*v2+x2*v3-5.0*x5*v4-5.0*x4*v5;
263  (*jvp)[2] = 3.0*x1*x1*v1+3.0*x2*x2*v2;
264 
265  } //applyJacobian
266 
267  void applyAdjointJacobian( Vector<Real> &ajv, const Vector<Real> &v, const Vector<Real> &x, Real &tol ) {
268 
269 
270  ROL::Ptr<const vector> xp = getVector<XPrim>(x);
271  ROL::Ptr<const vector> vp = getVector<CDual>(v);
272  ROL::Ptr<vector> ajvp = getVector<XDual>(ajv);
273 
274  uint n = xp->size();
275  ROL_TEST_FOR_EXCEPTION( (n != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, constraint applyAdjointJacobian): "
276  "Primal vector x must be of length 5.");
277 
278  uint d = vp->size();
279  ROL_TEST_FOR_EXCEPTION( (d != 3), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, constraint applyAdjointJacobian): "
280  "Input vector v must be of length 3.");
281 
282  d = ajvp->size();
283  ROL_TEST_FOR_EXCEPTION( (d != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, constraint applyAdjointJacobian): "
284  "Output vector ajv must be of length 5.");
285 
286  Real x1 = (*xp)[0];
287  Real x2 = (*xp)[1];
288  Real x3 = (*xp)[2];
289  Real x4 = (*xp)[3];
290  Real x5 = (*xp)[4];
291 
292  Real v1 = (*vp)[0];
293  Real v2 = (*vp)[1];
294  Real v3 = (*vp)[2];
295 
296  (*ajvp)[0] = 2.0*x1*v1+3.0*x1*x1*v3;
297  (*ajvp)[1] = 2.0*x2*v1+x3*v2+3.0*x2*x2*v3;
298  (*ajvp)[2] = 2.0*x3*v1+x2*v2;
299  (*ajvp)[3] = 2.0*x4*v1-5.0*x5*v2;
300  (*ajvp)[4] = 2.0*x5*v1-5.0*x4*v2;
301 
302  } //applyAdjointJacobian
303 
304  void applyAdjointHessian( Vector<Real> &ahuv, const Vector<Real> &u, const Vector<Real> &v, const Vector<Real> &x, Real &tol ) {
305 
306  ROL::Ptr<const vector> xp = getVector<XPrim>(x);
307  ROL::Ptr<const vector> up = getVector<CDual>(u);
308  ROL::Ptr<const vector> vp = getVector<XPrim>(v);
309  ROL::Ptr<vector> ahuvp = getVector<XDual>(ahuv);
310 
311  uint n = xp->size();
312  ROL_TEST_FOR_EXCEPTION( (n != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, constraint applyAdjointHessian): "
313  "Primal vector x must be of length 5.");
314 
315  n = vp->size();
316  ROL_TEST_FOR_EXCEPTION( (n != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, constraint applyAdjointHessian): "
317  "Direction vector v must be of length 5.");
318 
319  n = ahuvp->size();
320  ROL_TEST_FOR_EXCEPTION( (n != 5), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, constraint applyAdjointHessian): "
321  "Output vector ahuv must be of length 5.");
322  uint d = up->size();
323  ROL_TEST_FOR_EXCEPTION( (d != 3), std::invalid_argument, ">>> ERROR (ROL_SimpleEqConstrained, constraint applyAdjointHessian): "
324  "Dual constraint vector u must be of length 3.");
325 
326  Real x1 = (*xp)[0];
327  Real x2 = (*xp)[1];
328 
329  Real v1 = (*vp)[0];
330  Real v2 = (*vp)[1];
331  Real v3 = (*vp)[2];
332  Real v4 = (*vp)[3];
333  Real v5 = (*vp)[4];
334 
335  Real u1 = (*up)[0];
336  Real u2 = (*up)[1];
337  Real u3 = (*up)[2];
338 
339  (*ahuvp)[0] = 2.0*u1*v1 + 6.0*u3*x1*v1;
340  (*ahuvp)[1] = 2.0*u1*v2 + u2*v3 + 6.0*u3*x2*v2;
341  (*ahuvp)[2] = 2.0*u1*v3 + u2*v2;
342  (*ahuvp)[3] = 2.0*u1*v4 - 5.0*u2*v5;
343  (*ahuvp)[4] = 2.0*u1*v5 - 5.0*u2*v4;
344 
345  } //applyAdjointHessian
346 
347  /*std::vector<Real> solveAugmentedSystem(Vector<Real> &v1, Vector<Real> &v2, const Vector<Real> &b1, const Vector<Real> &b2, const Vector<Real> &x, Real &tol) {
348  ROL::Ptr<std::vector<Real> > v1p =
349  ROL::constPtrCast<std::vector<Real> >((dynamic_cast<XPrim&>(v1)).getVector());
350  ROL::Ptr<std::vector<Real> > v2p =
351  ROL::constPtrCast<std::vector<Real> >((dynamic_cast<CDual&>(v2)).getVector());
352  ROL::Ptr<const std::vector<Real> > b1p =
353  (dynamic_cast<XDual>(const_cast<Vector<Real> &&>(b1))).getVector();
354  ROL::Ptr<const std::vector<Real> > b2p =
355  (dynamic_cast<CPrim>(const_cast<Vector<Real> &&>(b2))).getVector();
356  ROL::Ptr<const std::vector<Real> > xp =
357  (dynamic_cast<XPrim>(const_cast<Vector<Real> &&>(x))).getVector();
358 
359  Real x1 = (*xp)[0];
360  Real x2 = (*xp)[1];
361  Real x3 = (*xp)[2];
362  Real x4 = (*xp)[3];
363  Real x5 = (*xp)[4];
364 
365  int i = 0;
366 
367  // Assemble augmented system.
368  Teuchos::SerialDenseMatrix<int, Real> augmat(8,8);
369  for (i=0; i<5; i++) {
370  augmat(i,i) = 1.0;
371  }
372  augmat(5,0) = 2.0*x1; augmat(5,1) = 2.0*x2; augmat(5,2) = 2.0*x3; augmat(5,3) = 2.0*x4; augmat(5,4) = 2.0*x5;
373  augmat(6,1) = x3; augmat(6,2) = x2; augmat(6,3) = -5.0*x5; augmat(6,4) = -5.0*x4;
374  augmat(7,0) = 3.0*x1*x1; augmat(7,1) = 3.0*x2*x2;
375  augmat(0,5) = 2.0*x1; augmat(1,5) = 2.0*x2; augmat(2,5) = 2.0*x3; augmat(3,5) = 2.0*x4; augmat(4,5) = 2.0*x5;
376  augmat(1,6) = x3; augmat(2,6) = x2; augmat(3,6) = -5.0*x5; augmat(4,6) = -5.0*x4;
377  augmat(0,7) = 3.0*x1*x1; augmat(1,7) = 3.0*x2*x2;
378  Teuchos::SerialDenseVector<int, Real> lhs(8);
379  Teuchos::SerialDenseVector<int, Real> rhs(8);
380  for (i=0; i<5; i++) {
381  rhs(i) = (*b1p)[i];
382  }
383  for (i=5; i<8; i++) {
384  rhs(i) = (*b2p)[i-5];
385  }
386 
387  // Solve augmented system.
388  Teuchos::SerialDenseSolver<int, Real> augsolver;
389  augsolver.setMatrix(&augmat, false);
390  augsolver.setVectors(&lhs, false), Teuchos::&rhs, false;
391  augsolver.solve();
392 
393  // Retrieve solution.
394  for (i=0; i<5; i++) {
395  (*v1p)[i] = lhs(i);
396  }
397  for (i=0; i<3; i++) {
398  (*v2p)[i] = lhs(i+5);
399  }
400 
401  return std::vector<Real>(0);
402 
403  }*/ //solveAugmentedSystem
404 
405  };
406 
407 
408  template<class Real, class XPrim=StdVector<Real>, class XDual=StdVector<Real>, class CPrim=StdVector<Real>, class CDual=StdVector<Real> >
409  class getSimpleEqConstrained : public TestProblem<Real> {
410  typedef std::vector<Real> vector;
411  typedef typename vector::size_type uint;
412  public:
414 
415  Ptr<Objective<Real>> getObjective(void) const {
416  // Instantiate objective function.
417  return ROL::makePtr<Objective_SimpleEqConstrained<Real,XPrim,XDual>>();
418  }
419 
420  Ptr<Vector<Real>> getInitialGuess(void) const {
421  uint n = 5;
422  // Get initial guess.
423  Ptr<vector> x0p = makePtr<vector>(n,0);
424  (*x0p)[0] = -1.8;
425  (*x0p)[1] = 1.7;
426  (*x0p)[2] = 1.9;
427  (*x0p)[3] = -0.8;
428  (*x0p)[4] = -0.8;
429  return makePtr<XPrim>(x0p);
430  }
431 
432  Ptr<Vector<Real>> getSolution(const int i = 0) const {
433  uint n = 5;
434  // Get solution.
435  Ptr<vector> solp = makePtr<vector>(n,0);
436  (*solp)[0] = -1.717143570394391e+00;
437  (*solp)[1] = 1.595709690183565e+00;
438  (*solp)[2] = 1.827245752927178e+00;
439  (*solp)[3] = -7.636430781841294e-01;
440  (*solp)[4] = -7.636430781841294e-01;
441  return makePtr<XPrim>(solp);
442  }
443 
444  Ptr<Constraint<Real>> getEqualityConstraint(void) const {
445  // Instantiate constraints.
446  return ROL::makePtr<EqualityConstraint_SimpleEqConstrained<Real,XPrim,XDual,CPrim,CDual>>();
447  }
448 
449  Ptr<Vector<Real>> getEqualityMultiplier(void) const {
450  Ptr<vector> lp = makePtr<vector>(3,0);
451  return makePtr<CDual>(lp);
452  }
453  };
454 
455 } // End ZOO Namespace
456 } // End ROL Namespace
457 
458 #endif
Provides the interface to evaluate objective functions.
typename PV< Real >::size_type size_type
Equality constraints c_i(x) = 0, where: c1(x) = x1^2+x2^2+x3^2+x4^2+x5^2 - 10 c2(x) = x2*x3-5*x4*x5 c...
void value(Vector< Real > &c, const Vector< Real > &x, Real &tol)
Evaluate the constraint operator at .
Ptr< Constraint< Real > > getEqualityConstraint(void) const
void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply the constraint Jacobian at , , to vector .
Ptr< Vector< Real > > getEqualityMultiplier(void) const
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
void applyAdjointJacobian(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply the adjoint of the the constraint Jacobian at , , to vector .
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
ROL::Ptr< const vector > getVector(const V &x)
Contains definitions of test objective functions.
Ptr< Objective< Real > > getObjective(void) const
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
Ptr< Vector< Real > > getSolution(const int i=0) const
void applyAdjointHessian(Vector< Real > &ahuv, const Vector< Real > &u, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply the derivative of the adjoint of the constraint Jacobian at to vector in direction ...
Real value(const Vector< Real > &x, Real &tol)
Compute value.
Ptr< Vector< Real > > getInitialGuess(void) const
Defines the general constraint operator interface.
Objective function: f(x) = exp(x1*x2*x3*x4*x5) + 0.5*(x1^3+x2^3+1)^2.