ROL
ROL_GetTestProblems.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Rapid Optimization Library (ROL) Package
5 // Copyright (2014) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact lead developers:
38 // Drew Kouri (dpkouri@sandia.gov) and
39 // Denis Ridzal (dridzal@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
49 #ifndef ROL_TESTOBJECTIVES_HPP
50 #define ROL_TESTOBJECTIVES_HPP
51 
52 
53 #include "ROL_Rosenbrock.hpp"
54 #include "ROL_FreudensteinRoth.hpp"
55 #include "ROL_Beale.hpp"
56 #include "ROL_Powell.hpp"
57 #include "ROL_SumOfSquares.hpp"
58 #include "ROL_LeastSquares.hpp"
59 #include "ROL_PoissonControl.hpp"
60 #include "ROL_PoissonInversion.hpp"
61 #include "ROL_Zakharov.hpp"
62 #include "ROL_HS1.hpp"
63 #include "ROL_HS2.hpp"
64 #include "ROL_HS3.hpp"
65 #include "ROL_HS4.hpp"
66 #include "ROL_HS5.hpp"
67 #include "ROL_HS9.hpp"
68 #include "ROL_HS14.hpp"
69 #include "ROL_HS21.hpp"
70 #include "ROL_HS24.hpp"
71 #include "ROL_HS25.hpp"
72 #include "ROL_HS28.hpp"
73 #include "ROL_HS29.hpp"
74 #include "ROL_HS32.hpp"
75 #include "ROL_HS38.hpp"
76 #include "ROL_HS39.hpp"
77 #include "ROL_HS41.hpp"
78 #include "ROL_HS42.hpp"
79 #include "ROL_HS45.hpp"
80 #include "ROL_HS48.hpp"
81 #include "ROL_HS49.hpp"
82 #include "ROL_HS50.hpp"
83 #include "ROL_HS51.hpp"
84 #include "ROL_HS52.hpp"
85 #include "ROL_HS53.hpp"
86 #include "ROL_HS55.hpp"
87 #include "ROL_HS63.hpp"
88 #include "ROL_BVP.hpp"
89 #include "ROL_ParaboloidCircle.hpp"
91 #include "ROL_CantileverBeam.hpp"
92 #include "ROL_Cubic.hpp"
93 #include "ROL_Quartic.hpp"
94 #include "ROL_CylinderHead.hpp"
95 #include "ROL_Cantilever.hpp"
96 #include "ROL_Minimax1.hpp"
97 #include "ROL_Minimax2.hpp"
98 #include "ROL_Minimax3.hpp"
99 
100 
101 namespace ROL {
102 
201  };
202 
203  inline std::string ETestOptProblemToString(ETestOptProblem to) {
204  std::string retString;
205  switch(to) {
206  case TESTOPTPROBLEM_ROSENBROCK: retString = "Rosenbrock's Function"; break;
207  case TESTOPTPROBLEM_FREUDENSTEINANDROTH: retString = "Freudenstein and Roth's Function"; break;
208  case TESTOPTPROBLEM_BEALE: retString = "Beale's Function"; break;
209  case TESTOPTPROBLEM_POWELL: retString = "Powell's Badly Scaled Function"; break;
210  case TESTOPTPROBLEM_SUMOFSQUARES: retString = "Sum of Squares Function"; break;
211  case TESTOPTPROBLEM_LEASTSQUARES: retString = "Least Squares Function"; break;
212  case TESTOPTPROBLEM_POISSONCONTROL: retString = "Poisson Optimal Control"; break;
213  case TESTOPTPROBLEM_POISSONINVERSION: retString = "Poisson Inversion Problem"; break;
214  case TESTOPTPROBLEM_ZAKHAROV: retString = "Zakharov's Function"; break;
215  case TESTOPTPROBLEM_HS1: retString = "Hock and Schittkowski Test Problem #1"; break;
216  case TESTOPTPROBLEM_HS2: retString = "Hock and Schittkowski Test Problem #2"; break;
217  case TESTOPTPROBLEM_HS3: retString = "Hock and Schittkowski Test Problem #3"; break;
218  case TESTOPTPROBLEM_HS4: retString = "Hock and Schittkowski Test Problem #4"; break;
219  case TESTOPTPROBLEM_HS5: retString = "Hock and Schittkowski Test Problem #5"; break;
220  case TESTOPTPROBLEM_HS9: retString = "Hock and Schittkowski Test Problem #9"; break;
221  case TESTOPTPROBLEM_HS14: retString = "Hock and Schittkowski Test Problem #14"; break;
222  case TESTOPTPROBLEM_HS21: retString = "Hock and Schittkowski Test Problem #21"; break;
223  case TESTOPTPROBLEM_HS24: retString = "Hock and Schittkowski Test Problem #24"; break;
224  case TESTOPTPROBLEM_HS25: retString = "Hock and Schittkowski Test Problem #25"; break;
225  case TESTOPTPROBLEM_HS28: retString = "Hock and Schittkowski Test Problem #28"; break;
226  case TESTOPTPROBLEM_HS29: retString = "Hock and Schittkowski Test Problem #29"; break;
227  case TESTOPTPROBLEM_HS32: retString = "Hock and Schittkowski Test Problem #32"; break;
228  case TESTOPTPROBLEM_HS38: retString = "Hock and Schittkowski Test Problem #38"; break;
229  case TESTOPTPROBLEM_HS39: retString = "Hock and Schittkowski Test Problem #39"; break;
230  case TESTOPTPROBLEM_HS41: retString = "Hock and Schittkowski Test Problem #41"; break;
231  case TESTOPTPROBLEM_HS42: retString = "Hock and Schittkowski Test Problem #42"; break;
232  case TESTOPTPROBLEM_HS45: retString = "Hock and Schittkowski Test Problem #45"; break;
233  case TESTOPTPROBLEM_HS48: retString = "Hock and Schittkowski Test Problem #48"; break;
234  case TESTOPTPROBLEM_HS49: retString = "Hock and Schittkowski Test Problem #49"; break;
235  case TESTOPTPROBLEM_HS50: retString = "Hock and Schittkowski Test Problem #50"; break;
236  case TESTOPTPROBLEM_HS51: retString = "Hock and Schittkowski Test Problem #51"; break;
237  case TESTOPTPROBLEM_HS52: retString = "Hock and Schittkowski Test Problem #52"; break;
238  case TESTOPTPROBLEM_HS53: retString = "Hock and Schittkowski Test Problem #53"; break;
239  case TESTOPTPROBLEM_HS55: retString = "Hock and Schittkowski Test Problem #55"; break;
240  case TESTOPTPROBLEM_HS63: retString = "Hock and Schittkowski Test Problem #63"; break;
241  case TESTOPTPROBLEM_BVP: retString = "Boundary Value Problem"; break;
242  case TESTOPTPROBLEM_PARABOLOIDCIRCLE: retString = "Paraboloid Circle"; break;
243  case TESTOPTPROBLEM_SIMPLEEQCONSTRAINED: retString = "Simple Equality Constrained"; break;
244  case TESTOPTPROBLEM_CANTILEVERBEAM: retString = "Cantilever Beam"; break;
245  case TESTOPTPROBLEM_CUBIC: retString = "Cubic"; break;
246  case TESTOPTPROBLEM_QUARTIC: retString = "Quartic"; break;
247  case TESTOPTPROBLEM_CYLINDERHEAD: retString = "Cylinder Head"; break;
248  case TESTOPTPROBLEM_CANTILEVER: retString = "Cantilever"; break;
249  case TESTOPTPROBLEM_MINIMAX1: retString = "Minimax #1"; break;
250  case TESTOPTPROBLEM_MINIMAX2: retString = "Minimax #2"; break;
251  case TESTOPTPROBLEM_MINIMAX3: retString = "Minimax #3"; break;
252  case TESTOPTPROBLEM_LAST: retString = "Last Type (Dummy)"; break;
253  default: retString = "INVALID ETestOptProblem";
254  }
255  return retString;
256  }
257 
264  return( (to == TESTOPTPROBLEM_ROSENBROCK) ||
266  (to == TESTOPTPROBLEM_BEALE) ||
267  (to == TESTOPTPROBLEM_POWELL) ||
268  (to == TESTOPTPROBLEM_SUMOFSQUARES) ||
269  (to == TESTOPTPROBLEM_LEASTSQUARES) ||
272  (to == TESTOPTPROBLEM_ZAKHAROV) ||
273  (to == TESTOPTPROBLEM_HS1) ||
274  (to == TESTOPTPROBLEM_HS2) ||
275  (to == TESTOPTPROBLEM_HS3) ||
276  (to == TESTOPTPROBLEM_HS4) ||
277  (to == TESTOPTPROBLEM_HS5) ||
278  (to == TESTOPTPROBLEM_HS9) ||
279  (to == TESTOPTPROBLEM_HS14) ||
280  (to == TESTOPTPROBLEM_HS21) ||
281  (to == TESTOPTPROBLEM_HS24) ||
282  (to == TESTOPTPROBLEM_HS25) ||
283  (to == TESTOPTPROBLEM_HS28) ||
284  (to == TESTOPTPROBLEM_HS29) ||
285  (to == TESTOPTPROBLEM_HS32) ||
286  (to == TESTOPTPROBLEM_HS38) ||
287  (to == TESTOPTPROBLEM_HS39) ||
288  (to == TESTOPTPROBLEM_HS41) ||
289  (to == TESTOPTPROBLEM_HS42) ||
290  (to == TESTOPTPROBLEM_HS45) ||
291  (to == TESTOPTPROBLEM_HS48) ||
292  (to == TESTOPTPROBLEM_HS49) ||
293  (to == TESTOPTPROBLEM_HS50) ||
294  (to == TESTOPTPROBLEM_HS51) ||
295  (to == TESTOPTPROBLEM_HS52) ||
296  (to == TESTOPTPROBLEM_HS53) ||
297  (to == TESTOPTPROBLEM_HS55) ||
298  (to == TESTOPTPROBLEM_HS63) ||
299  (to == TESTOPTPROBLEM_BVP) ||
303  (to == TESTOPTPROBLEM_CUBIC) ||
304  (to == TESTOPTPROBLEM_QUARTIC) ||
305  (to == TESTOPTPROBLEM_CYLINDERHEAD) ||
306  (to == TESTOPTPROBLEM_CANTILEVER) ||
307  (to == TESTOPTPROBLEM_MINIMAX1) ||
308  (to == TESTOPTPROBLEM_MINIMAX2) ||
309  (to == TESTOPTPROBLEM_MINIMAX3) );
310  }
311 
313  return type = static_cast<ETestOptProblem>(type+1);
314  }
315 
317  ETestOptProblem oldval = type;
318  ++type;
319  return oldval;
320  }
321 
323  return type = static_cast<ETestOptProblem>(type-1);
324  }
325 
327  ETestOptProblem oldval = type;
328  --type;
329  return oldval;
330  }
331 
332  inline ETestOptProblem StringToETestOptProblem(std::string s) {
333  s = removeStringFormat(s);
335  if ( !s.compare(removeStringFormat(ETestOptProblemToString(to))) ) {
336  return to;
337  }
338  }
340  }
341 
342  template<class Real>
344  Ptr<Vector<Real> > &x0,
345  std::vector<Ptr<Vector<Real> > > &x,
346  const ETestOptProblem test ) {
347  Ptr<TestProblem<Real>> tp;
348  switch (test) {
349  case TESTOPTPROBLEM_ROSENBROCK: tp = makePtr<ZOO::getRosenbrock<Real>>(); break;
350  case TESTOPTPROBLEM_FREUDENSTEINANDROTH: tp = makePtr<ZOO::getFreudensteinRoth<Real>>(); break;
351  case TESTOPTPROBLEM_BEALE: tp = makePtr<ZOO::getBeale<Real>>(); break;
352  case TESTOPTPROBLEM_POWELL: tp = makePtr<ZOO::getPowell<Real>>(); break;
353  case TESTOPTPROBLEM_SUMOFSQUARES: tp = makePtr<ZOO::getSumOfSquares<Real>>(); break;
354  case TESTOPTPROBLEM_LEASTSQUARES: tp = makePtr<ZOO::getLeastSquares<Real>>(); break;
355  case TESTOPTPROBLEM_POISSONCONTROL: tp = makePtr<ZOO::getPoissonControl<Real>>(); break;
356  case TESTOPTPROBLEM_POISSONINVERSION: tp = makePtr<ZOO::getPoissonInversion<Real>>(); break;
357  case TESTOPTPROBLEM_ZAKHAROV: tp = makePtr<ZOO::getZakharov<Real>>(); break;
358  case TESTOPTPROBLEM_HS1: tp = makePtr<ZOO::getHS1<Real>>(); break;
359  case TESTOPTPROBLEM_HS2: tp = makePtr<ZOO::getHS2<Real>>(); break;
360  case TESTOPTPROBLEM_HS3: tp = makePtr<ZOO::getHS3<Real>>(); break;
361  case TESTOPTPROBLEM_HS4: tp = makePtr<ZOO::getHS4<Real>>(); break;
362  case TESTOPTPROBLEM_HS5: tp = makePtr<ZOO::getHS5<Real>>(); break;
363  case TESTOPTPROBLEM_HS9: tp = makePtr<ZOO::getHS9<Real>>(); break;
364  case TESTOPTPROBLEM_HS14: tp = makePtr<ZOO::getHS14<Real>>(); break;
365  case TESTOPTPROBLEM_HS21: tp = makePtr<ZOO::getHS21<Real>>(); break;
366  case TESTOPTPROBLEM_HS24: tp = makePtr<ZOO::getHS24<Real>>(); break;
367  case TESTOPTPROBLEM_HS25: tp = makePtr<ZOO::getHS25<Real>>(); break;
368  case TESTOPTPROBLEM_HS28: tp = makePtr<ZOO::getHS28<Real>>(); break;
369  case TESTOPTPROBLEM_HS29: tp = makePtr<ZOO::getHS29<Real>>(); break;
370  case TESTOPTPROBLEM_HS32: tp = makePtr<ZOO::getHS32<Real>>(); break;
371  case TESTOPTPROBLEM_HS38: tp = makePtr<ZOO::getHS38<Real>>(); break;
372  case TESTOPTPROBLEM_HS39: tp = makePtr<ZOO::getHS39<Real>>(); break;
373  case TESTOPTPROBLEM_HS41: tp = makePtr<ZOO::getHS41<Real>>(); break;
374  case TESTOPTPROBLEM_HS42: tp = makePtr<ZOO::getHS42<Real>>(); break;
375  case TESTOPTPROBLEM_HS45: tp = makePtr<ZOO::getHS45<Real>>(); break;
376  case TESTOPTPROBLEM_HS48: tp = makePtr<ZOO::getHS48<Real>>(); break;
377  case TESTOPTPROBLEM_HS49: tp = makePtr<ZOO::getHS49<Real>>(); break;
378  case TESTOPTPROBLEM_HS50: tp = makePtr<ZOO::getHS50<Real>>(); break;
379  case TESTOPTPROBLEM_HS51: tp = makePtr<ZOO::getHS51<Real>>(); break;
380  case TESTOPTPROBLEM_HS52: tp = makePtr<ZOO::getHS52<Real>>(); break;
381  case TESTOPTPROBLEM_HS53: tp = makePtr<ZOO::getHS53<Real>>(); break;
382  case TESTOPTPROBLEM_HS55: tp = makePtr<ZOO::getHS55<Real>>(); break;
383  case TESTOPTPROBLEM_HS63: tp = makePtr<ZOO::getHS63<Real>>(); break;
384  case TESTOPTPROBLEM_BVP: tp = makePtr<ZOO::getBVP<Real>>(); break;
385  case TESTOPTPROBLEM_PARABOLOIDCIRCLE: tp = makePtr<ZOO::getParaboloidCircle<Real>>(); break;
386  case TESTOPTPROBLEM_SIMPLEEQCONSTRAINED: tp = makePtr<ZOO::getSimpleEqConstrained<Real>>(); break;
387  case TESTOPTPROBLEM_CANTILEVERBEAM: tp = makePtr<ZOO::getCantileverBeam<Real>>(); break;
388  case TESTOPTPROBLEM_CUBIC: tp = makePtr<ZOO::getCubic<Real>>(2); break;
389  case TESTOPTPROBLEM_QUARTIC: tp = makePtr<ZOO::getQuartic<Real>>(); break;
390  case TESTOPTPROBLEM_CYLINDERHEAD: tp = makePtr<ZOO::getCylinderHead<Real>>(); break;
391  case TESTOPTPROBLEM_CANTILEVER: tp = makePtr<ZOO::getCantilever<Real>>(); break;
392  case TESTOPTPROBLEM_MINIMAX1: tp = makePtr<ZOO::getMinimax1<Real>>(); break;
393  case TESTOPTPROBLEM_MINIMAX2: tp = makePtr<ZOO::getMinimax2<Real>>(); break;
394  case TESTOPTPROBLEM_MINIMAX3: tp = makePtr<ZOO::getMinimax3<Real>>(); break;
395  case TESTOPTPROBLEM_LAST: break;
396  }
397  tp->get(problem,x0,x);
398  }
399 } // namespace ROL
400 
401 #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:249
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:80
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: