ROL
ROL_GetTestProblems.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 
15 #ifndef ROL_TESTOBJECTIVES_HPP
16 #define ROL_TESTOBJECTIVES_HPP
17 
18 
19 #include "ROL_Rosenbrock.hpp"
20 #include "ROL_FreudensteinRoth.hpp"
21 #include "ROL_Beale.hpp"
22 #include "ROL_Powell.hpp"
23 #include "ROL_SumOfSquares.hpp"
24 #include "ROL_LeastSquares.hpp"
25 #include "ROL_PoissonControl.hpp"
26 #include "ROL_PoissonInversion.hpp"
27 #include "ROL_Zakharov.hpp"
28 #include "ROL_HS1.hpp"
29 #include "ROL_HS2.hpp"
30 #include "ROL_HS3.hpp"
31 #include "ROL_HS4.hpp"
32 #include "ROL_HS5.hpp"
33 #include "ROL_HS9.hpp"
34 #include "ROL_HS14.hpp"
35 #include "ROL_HS21.hpp"
36 #include "ROL_HS24.hpp"
37 #include "ROL_HS25.hpp"
38 #include "ROL_HS28.hpp"
39 #include "ROL_HS29.hpp"
40 #include "ROL_HS32.hpp"
41 #include "ROL_HS38.hpp"
42 #include "ROL_HS39.hpp"
43 #include "ROL_HS41.hpp"
44 #include "ROL_HS42.hpp"
45 #include "ROL_HS45.hpp"
46 #include "ROL_HS48.hpp"
47 #include "ROL_HS49.hpp"
48 #include "ROL_HS50.hpp"
49 #include "ROL_HS51.hpp"
50 #include "ROL_HS52.hpp"
51 #include "ROL_HS53.hpp"
52 #include "ROL_HS55.hpp"
53 #include "ROL_HS63.hpp"
54 #include "ROL_BVP.hpp"
55 #include "ROL_ParaboloidCircle.hpp"
57 #include "ROL_CantileverBeam.hpp"
58 #include "ROL_Cubic.hpp"
59 #include "ROL_Quartic.hpp"
60 #include "ROL_CylinderHead.hpp"
61 #include "ROL_Cantilever.hpp"
62 #include "ROL_Minimax1.hpp"
63 #include "ROL_Minimax2.hpp"
64 #include "ROL_Minimax3.hpp"
65 
66 
67 namespace ROL {
68 
167  };
168 
169  inline std::string ETestOptProblemToString(ETestOptProblem to) {
170  std::string retString;
171  switch(to) {
172  case TESTOPTPROBLEM_ROSENBROCK: retString = "Rosenbrock's Function"; break;
173  case TESTOPTPROBLEM_FREUDENSTEINANDROTH: retString = "Freudenstein and Roth's Function"; break;
174  case TESTOPTPROBLEM_BEALE: retString = "Beale's Function"; break;
175  case TESTOPTPROBLEM_POWELL: retString = "Powell's Badly Scaled Function"; break;
176  case TESTOPTPROBLEM_SUMOFSQUARES: retString = "Sum of Squares Function"; break;
177  case TESTOPTPROBLEM_LEASTSQUARES: retString = "Least Squares Function"; break;
178  case TESTOPTPROBLEM_POISSONCONTROL: retString = "Poisson Optimal Control"; break;
179  case TESTOPTPROBLEM_POISSONINVERSION: retString = "Poisson Inversion Problem"; break;
180  case TESTOPTPROBLEM_ZAKHAROV: retString = "Zakharov's Function"; break;
181  case TESTOPTPROBLEM_HS1: retString = "Hock and Schittkowski Test Problem #1"; break;
182  case TESTOPTPROBLEM_HS2: retString = "Hock and Schittkowski Test Problem #2"; break;
183  case TESTOPTPROBLEM_HS3: retString = "Hock and Schittkowski Test Problem #3"; break;
184  case TESTOPTPROBLEM_HS4: retString = "Hock and Schittkowski Test Problem #4"; break;
185  case TESTOPTPROBLEM_HS5: retString = "Hock and Schittkowski Test Problem #5"; break;
186  case TESTOPTPROBLEM_HS9: retString = "Hock and Schittkowski Test Problem #9"; break;
187  case TESTOPTPROBLEM_HS14: retString = "Hock and Schittkowski Test Problem #14"; break;
188  case TESTOPTPROBLEM_HS21: retString = "Hock and Schittkowski Test Problem #21"; break;
189  case TESTOPTPROBLEM_HS24: retString = "Hock and Schittkowski Test Problem #24"; break;
190  case TESTOPTPROBLEM_HS25: retString = "Hock and Schittkowski Test Problem #25"; break;
191  case TESTOPTPROBLEM_HS28: retString = "Hock and Schittkowski Test Problem #28"; break;
192  case TESTOPTPROBLEM_HS29: retString = "Hock and Schittkowski Test Problem #29"; break;
193  case TESTOPTPROBLEM_HS32: retString = "Hock and Schittkowski Test Problem #32"; break;
194  case TESTOPTPROBLEM_HS38: retString = "Hock and Schittkowski Test Problem #38"; break;
195  case TESTOPTPROBLEM_HS39: retString = "Hock and Schittkowski Test Problem #39"; break;
196  case TESTOPTPROBLEM_HS41: retString = "Hock and Schittkowski Test Problem #41"; break;
197  case TESTOPTPROBLEM_HS42: retString = "Hock and Schittkowski Test Problem #42"; break;
198  case TESTOPTPROBLEM_HS45: retString = "Hock and Schittkowski Test Problem #45"; break;
199  case TESTOPTPROBLEM_HS48: retString = "Hock and Schittkowski Test Problem #48"; break;
200  case TESTOPTPROBLEM_HS49: retString = "Hock and Schittkowski Test Problem #49"; break;
201  case TESTOPTPROBLEM_HS50: retString = "Hock and Schittkowski Test Problem #50"; break;
202  case TESTOPTPROBLEM_HS51: retString = "Hock and Schittkowski Test Problem #51"; break;
203  case TESTOPTPROBLEM_HS52: retString = "Hock and Schittkowski Test Problem #52"; break;
204  case TESTOPTPROBLEM_HS53: retString = "Hock and Schittkowski Test Problem #53"; break;
205  case TESTOPTPROBLEM_HS55: retString = "Hock and Schittkowski Test Problem #55"; break;
206  case TESTOPTPROBLEM_HS63: retString = "Hock and Schittkowski Test Problem #63"; break;
207  case TESTOPTPROBLEM_BVP: retString = "Boundary Value Problem"; break;
208  case TESTOPTPROBLEM_PARABOLOIDCIRCLE: retString = "Paraboloid Circle"; break;
209  case TESTOPTPROBLEM_SIMPLEEQCONSTRAINED: retString = "Simple Equality Constrained"; break;
210  case TESTOPTPROBLEM_CANTILEVERBEAM: retString = "Cantilever Beam"; break;
211  case TESTOPTPROBLEM_CUBIC: retString = "Cubic"; break;
212  case TESTOPTPROBLEM_QUARTIC: retString = "Quartic"; break;
213  case TESTOPTPROBLEM_CYLINDERHEAD: retString = "Cylinder Head"; break;
214  case TESTOPTPROBLEM_CANTILEVER: retString = "Cantilever"; break;
215  case TESTOPTPROBLEM_MINIMAX1: retString = "Minimax #1"; break;
216  case TESTOPTPROBLEM_MINIMAX2: retString = "Minimax #2"; break;
217  case TESTOPTPROBLEM_MINIMAX3: retString = "Minimax #3"; break;
218  case TESTOPTPROBLEM_LAST: retString = "Last Type (Dummy)"; break;
219  default: retString = "INVALID ETestOptProblem";
220  }
221  return retString;
222  }
223 
230  return( (to == TESTOPTPROBLEM_ROSENBROCK) ||
232  (to == TESTOPTPROBLEM_BEALE) ||
233  (to == TESTOPTPROBLEM_POWELL) ||
234  (to == TESTOPTPROBLEM_SUMOFSQUARES) ||
235  (to == TESTOPTPROBLEM_LEASTSQUARES) ||
238  (to == TESTOPTPROBLEM_ZAKHAROV) ||
239  (to == TESTOPTPROBLEM_HS1) ||
240  (to == TESTOPTPROBLEM_HS2) ||
241  (to == TESTOPTPROBLEM_HS3) ||
242  (to == TESTOPTPROBLEM_HS4) ||
243  (to == TESTOPTPROBLEM_HS5) ||
244  (to == TESTOPTPROBLEM_HS9) ||
245  (to == TESTOPTPROBLEM_HS14) ||
246  (to == TESTOPTPROBLEM_HS21) ||
247  (to == TESTOPTPROBLEM_HS24) ||
248  (to == TESTOPTPROBLEM_HS25) ||
249  (to == TESTOPTPROBLEM_HS28) ||
250  (to == TESTOPTPROBLEM_HS29) ||
251  (to == TESTOPTPROBLEM_HS32) ||
252  (to == TESTOPTPROBLEM_HS38) ||
253  (to == TESTOPTPROBLEM_HS39) ||
254  (to == TESTOPTPROBLEM_HS41) ||
255  (to == TESTOPTPROBLEM_HS42) ||
256  (to == TESTOPTPROBLEM_HS45) ||
257  (to == TESTOPTPROBLEM_HS48) ||
258  (to == TESTOPTPROBLEM_HS49) ||
259  (to == TESTOPTPROBLEM_HS50) ||
260  (to == TESTOPTPROBLEM_HS51) ||
261  (to == TESTOPTPROBLEM_HS52) ||
262  (to == TESTOPTPROBLEM_HS53) ||
263  (to == TESTOPTPROBLEM_HS55) ||
264  (to == TESTOPTPROBLEM_HS63) ||
265  (to == TESTOPTPROBLEM_BVP) ||
269  (to == TESTOPTPROBLEM_CUBIC) ||
270  (to == TESTOPTPROBLEM_QUARTIC) ||
271  (to == TESTOPTPROBLEM_CYLINDERHEAD) ||
272  (to == TESTOPTPROBLEM_CANTILEVER) ||
273  (to == TESTOPTPROBLEM_MINIMAX1) ||
274  (to == TESTOPTPROBLEM_MINIMAX2) ||
275  (to == TESTOPTPROBLEM_MINIMAX3) );
276  }
277 
279  return type = static_cast<ETestOptProblem>(type+1);
280  }
281 
283  ETestOptProblem oldval = type;
284  ++type;
285  return oldval;
286  }
287 
289  return type = static_cast<ETestOptProblem>(type-1);
290  }
291 
293  ETestOptProblem oldval = type;
294  --type;
295  return oldval;
296  }
297 
298  inline ETestOptProblem StringToETestOptProblem(std::string s) {
299  s = removeStringFormat(s);
301  if ( !s.compare(removeStringFormat(ETestOptProblemToString(to))) ) {
302  return to;
303  }
304  }
306  }
307 
308  template<class Real>
310  Ptr<Vector<Real> > &x0,
311  std::vector<Ptr<Vector<Real> > > &x,
312  const ETestOptProblem test ) {
313  Ptr<TestProblem<Real>> tp;
314  switch (test) {
315  case TESTOPTPROBLEM_ROSENBROCK: tp = makePtr<ZOO::getRosenbrock<Real>>(); break;
316  case TESTOPTPROBLEM_FREUDENSTEINANDROTH: tp = makePtr<ZOO::getFreudensteinRoth<Real>>(); break;
317  case TESTOPTPROBLEM_BEALE: tp = makePtr<ZOO::getBeale<Real>>(); break;
318  case TESTOPTPROBLEM_POWELL: tp = makePtr<ZOO::getPowell<Real>>(); break;
319  case TESTOPTPROBLEM_SUMOFSQUARES: tp = makePtr<ZOO::getSumOfSquares<Real>>(); break;
320  case TESTOPTPROBLEM_LEASTSQUARES: tp = makePtr<ZOO::getLeastSquares<Real>>(); break;
321  case TESTOPTPROBLEM_POISSONCONTROL: tp = makePtr<ZOO::getPoissonControl<Real>>(); break;
322  case TESTOPTPROBLEM_POISSONINVERSION: tp = makePtr<ZOO::getPoissonInversion<Real>>(); break;
323  case TESTOPTPROBLEM_ZAKHAROV: tp = makePtr<ZOO::getZakharov<Real>>(); break;
324  case TESTOPTPROBLEM_HS1: tp = makePtr<ZOO::getHS1<Real>>(); break;
325  case TESTOPTPROBLEM_HS2: tp = makePtr<ZOO::getHS2<Real>>(); break;
326  case TESTOPTPROBLEM_HS3: tp = makePtr<ZOO::getHS3<Real>>(); break;
327  case TESTOPTPROBLEM_HS4: tp = makePtr<ZOO::getHS4<Real>>(); break;
328  case TESTOPTPROBLEM_HS5: tp = makePtr<ZOO::getHS5<Real>>(); break;
329  case TESTOPTPROBLEM_HS9: tp = makePtr<ZOO::getHS9<Real>>(); break;
330  case TESTOPTPROBLEM_HS14: tp = makePtr<ZOO::getHS14<Real>>(); break;
331  case TESTOPTPROBLEM_HS21: tp = makePtr<ZOO::getHS21<Real>>(); break;
332  case TESTOPTPROBLEM_HS24: tp = makePtr<ZOO::getHS24<Real>>(); break;
333  case TESTOPTPROBLEM_HS25: tp = makePtr<ZOO::getHS25<Real>>(); break;
334  case TESTOPTPROBLEM_HS28: tp = makePtr<ZOO::getHS28<Real>>(); break;
335  case TESTOPTPROBLEM_HS29: tp = makePtr<ZOO::getHS29<Real>>(); break;
336  case TESTOPTPROBLEM_HS32: tp = makePtr<ZOO::getHS32<Real>>(); break;
337  case TESTOPTPROBLEM_HS38: tp = makePtr<ZOO::getHS38<Real>>(); break;
338  case TESTOPTPROBLEM_HS39: tp = makePtr<ZOO::getHS39<Real>>(); break;
339  case TESTOPTPROBLEM_HS41: tp = makePtr<ZOO::getHS41<Real>>(); break;
340  case TESTOPTPROBLEM_HS42: tp = makePtr<ZOO::getHS42<Real>>(); break;
341  case TESTOPTPROBLEM_HS45: tp = makePtr<ZOO::getHS45<Real>>(); break;
342  case TESTOPTPROBLEM_HS48: tp = makePtr<ZOO::getHS48<Real>>(); break;
343  case TESTOPTPROBLEM_HS49: tp = makePtr<ZOO::getHS49<Real>>(); break;
344  case TESTOPTPROBLEM_HS50: tp = makePtr<ZOO::getHS50<Real>>(); break;
345  case TESTOPTPROBLEM_HS51: tp = makePtr<ZOO::getHS51<Real>>(); break;
346  case TESTOPTPROBLEM_HS52: tp = makePtr<ZOO::getHS52<Real>>(); break;
347  case TESTOPTPROBLEM_HS53: tp = makePtr<ZOO::getHS53<Real>>(); break;
348  case TESTOPTPROBLEM_HS55: tp = makePtr<ZOO::getHS55<Real>>(); break;
349  case TESTOPTPROBLEM_HS63: tp = makePtr<ZOO::getHS63<Real>>(); break;
350  case TESTOPTPROBLEM_BVP: tp = makePtr<ZOO::getBVP<Real>>(); break;
351  case TESTOPTPROBLEM_PARABOLOIDCIRCLE: tp = makePtr<ZOO::getParaboloidCircle<Real>>(); break;
352  case TESTOPTPROBLEM_SIMPLEEQCONSTRAINED: tp = makePtr<ZOO::getSimpleEqConstrained<Real>>(); break;
353  case TESTOPTPROBLEM_CANTILEVERBEAM: tp = makePtr<ZOO::getCantileverBeam<Real>>(); break;
354  case TESTOPTPROBLEM_CUBIC: tp = makePtr<ZOO::getCubic<Real>>(2); break;
355  case TESTOPTPROBLEM_QUARTIC: tp = makePtr<ZOO::getQuartic<Real>>(); break;
356  case TESTOPTPROBLEM_CYLINDERHEAD: tp = makePtr<ZOO::getCylinderHead<Real>>(); break;
357  case TESTOPTPROBLEM_CANTILEVER: tp = makePtr<ZOO::getCantilever<Real>>(); break;
358  case TESTOPTPROBLEM_MINIMAX1: tp = makePtr<ZOO::getMinimax1<Real>>(); break;
359  case TESTOPTPROBLEM_MINIMAX2: tp = makePtr<ZOO::getMinimax2<Real>>(); break;
360  case TESTOPTPROBLEM_MINIMAX3: tp = makePtr<ZOO::getMinimax3<Real>>(); break;
361  case TESTOPTPROBLEM_LAST: break;
362  }
363  tp->get(problem,x0,x);
364  }
365 } // namespace ROL
366 
367 #endif
ETestOptProblem
Enumeration of test optimization problems.
Contains definitions for W. Hock and K. Schittkowski 38th test function.
Contains definitions for W. Hock and K. Schittkowski 9th test function.
Contains definitions for W. Hock and K. Schittkowski 32nd test problem which contains only inequality...
Contains definitions for W. Hock and K. Schittkowski 48th test function.
EPolyProjAlgo & operator++(EPolyProjAlgo &type)
Contains definitions for a cubic test problem.
std::string removeStringFormat(std::string s)
Definition: ROL_Types.hpp:215
Contains definitions for W. Hock and K. Schittkowski 55th test function.
Contains definitions for Poisson optimal control.
Contains definitions for W. Hock and K. Schittkowski 52nd test function.
Contains definitions for W. Hock and K. Schittkowski 41th test function.
Contains definitions for the cylinder head test problem.
Contains definitions for W. Hock and K. Schittkowski 25th test function.
int isValidTestOptProblem(ETestOptProblem to)
Verifies validity of a TestOptProblem enum.
Contains definitions for Beale&#39;s function.
Contains definitions for Rosenbrock&#39;s function.
Contains definitions for W. Hock and K. Schittkowski 53th test function.
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
void GetTestProblem(Ptr< OptimizationProblem< Real > > &problem, Ptr< Vector< Real > > &x0, std::vector< Ptr< Vector< Real > > > &x, const ETestOptProblem test)
Contains definitions for Cantilevered Beam example in G. N. Vanderplaats, Numerical Optimization Tech...
Contains definitions for W. Hock and K. Schittkowski 4th test function.
Contains definitions for W. Hock and K. Schittkowski 14th test function.
Contains definitions for Poisson material inversion.
Contains definitions for W. Hock and K. Schittkowski 39th test function.
Contains definitions for Freudenstein and Roth&#39;s function.
Contains definitions for a quartic test problem.
EPolyProjAlgo & operator--(EPolyProjAlgo &type)
Contains definitions for the cylinder head test problem.
std::string ETestOptProblemToString(ETestOptProblem to)
Contains definitions for W. Hock and K. Schittkowski 63rd test function.
Contains definitions for least squares function.
Contains definitions for Powell&#39;s badly scaled function.
Contains definitions for the Zakharov function as evaluated using only the ROL::Vector interface...
Contains definitions for W. Hock and K. Schittkowski 51th test function.
Contains definitions for the equality constrained NLP from Nocedal/Wright, 2nd edition, page 574, example 18.2; note the typo in reversing the initial guess and the solution.
Contains definitions for W. Hock and K. Schittkowski 24th test problem which contains bound and inequ...
Contains definitions for the discrete boundary value problem (More, Garbow, Hillstrom, 1981).
Contains definitions for W. Hock and K. Schittkowski 1st test function.
Contains definitions for W. Hock and K. Schittkowski 49th test function.
Contains definitions for W. Hock and K. Schittkowski 32nd test problem which contains both inequality...
Contains definitions for W. Hock and K. Schittkowski 21th test problem which contains bound and inequ...
Contains definitions for W. Hock and K. Schittkowski 3rd test function.
Contains definitions for W. Hock and K. Schittkowski 50th test function.
Contains definitions for W. Hock and K. Schittkowski 28th test function.
Contains definitions for W. Hock and K. Schittkowski 5th test function.
Contains definitions for W. Hock and K. Schittkowski 45th test function.
ETestOptProblem StringToETestOptProblem(std::string s)
Contains definitions for W. Hock and K. Schittkowski 2nd test function.
Contains definitions for W. Hock and K. Schittkowski 42th test function.
Contains definitions for sum of squares function.
Contains definitions for the equality constrained NLP: