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_HS24.hpp"
68 #include "ROL_HS25.hpp"
69 #include "ROL_HS29.hpp"
70 #include "ROL_HS32.hpp"
71 #include "ROL_HS38.hpp"
72 #include "ROL_HS39.hpp"
73 #include "ROL_HS45.hpp"
74 #include "ROL_BVP.hpp"
75 #include "ROL_ParaboloidCircle.hpp"
77 #include "ROL_CantileverBeam.hpp"
78 #include "ROL_Minimax1.hpp"
79 #include "ROL_Minimax2.hpp"
80 #include "ROL_Minimax3.hpp"
81 
82 
83 namespace ROL {
84 
147  };
148 
149  inline std::string ETestOptProblemToString(ETestOptProblem to) {
150  std::string retString;
151  switch(to) {
152  case TESTOPTPROBLEM_ROSENBROCK: retString = "Rosenbrock's Function"; break;
153  case TESTOPTPROBLEM_FREUDENSTEINANDROTH: retString = "Freudenstein and Roth's Function"; break;
154  case TESTOPTPROBLEM_BEALE: retString = "Beale's Function"; break;
155  case TESTOPTPROBLEM_POWELL: retString = "Powell's Badly Scaled Function"; break;
156  case TESTOPTPROBLEM_SUMOFSQUARES: retString = "Sum of Squares Function"; break;
157  case TESTOPTPROBLEM_LEASTSQUARES: retString = "Least Squares Function"; break;
158  case TESTOPTPROBLEM_POISSONCONTROL: retString = "Poisson Optimal Control"; break;
159  case TESTOPTPROBLEM_POISSONINVERSION: retString = "Poisson Inversion Problem"; break;
160  case TESTOPTPROBLEM_ZAKHAROV: retString = "Zakharov's Function"; break;
161  case TESTOPTPROBLEM_HS1: retString = "Hock and Schittkowski Test Problem #1"; break;
162  case TESTOPTPROBLEM_HS2: retString = "Hock and Schittkowski Test Problem #2"; break;
163  case TESTOPTPROBLEM_HS3: retString = "Hock and Schittkowski Test Problem #3"; break;
164  case TESTOPTPROBLEM_HS4: retString = "Hock and Schittkowski Test Problem #4"; break;
165  case TESTOPTPROBLEM_HS5: retString = "Hock and Schittkowski Test Problem #5"; break;
166  case TESTOPTPROBLEM_HS24: retString = "Hock and Schittkowski Test Problem #24"; break;
167  case TESTOPTPROBLEM_HS25: retString = "Hock and Schittkowski Test Problem #25"; break;
168  case TESTOPTPROBLEM_HS29: retString = "Hock and Schittkowski Test Problem #29"; break;
169  case TESTOPTPROBLEM_HS32: retString = "Hock and Schittkowski Test Problem #32"; break;
170  case TESTOPTPROBLEM_HS38: retString = "Hock and Schittkowski Test Problem #38"; break;
171  case TESTOPTPROBLEM_HS39: retString = "Hock and Schittkowski Test Problem #39"; break;
172  case TESTOPTPROBLEM_HS45: retString = "Hock and Schittkowski Test Problem #45"; break;
173  case TESTOPTPROBLEM_BVP: retString = "Boundary Value Problem"; break;
174  case TESTOPTPROBLEM_PARABOLOIDCIRCLE: retString = "Paraboloid Circle"; break;
175  case TESTOPTPROBLEM_SIMPLEEQCONSTRAINED: retString = "Simple Equality Constrained"; break;
176  case TESTOPTPROBLEM_CANTILEVERBEAM: retString = "Cantilever Beam"; break;
177  case TESTOPTPROBLEM_MINIMAX1: retString = "Minimax #1"; break;
178  case TESTOPTPROBLEM_MINIMAX2: retString = "Minimax #2"; break;
179  case TESTOPTPROBLEM_MINIMAX3: retString = "Minimax #3"; break;
180  case TESTOPTPROBLEM_LAST: retString = "Last Type (Dummy)"; break;
181  default: retString = "INVALID ETestOptProblem";
182  }
183  return retString;
184  }
185 
192  return( (to == TESTOPTPROBLEM_ROSENBROCK) ||
194  (to == TESTOPTPROBLEM_BEALE) ||
195  (to == TESTOPTPROBLEM_POWELL) ||
196  (to == TESTOPTPROBLEM_SUMOFSQUARES) ||
197  (to == TESTOPTPROBLEM_LEASTSQUARES) ||
200  (to == TESTOPTPROBLEM_ZAKHAROV) ||
201  (to == TESTOPTPROBLEM_HS1) ||
202  (to == TESTOPTPROBLEM_HS2) ||
203  (to == TESTOPTPROBLEM_HS3) ||
204  (to == TESTOPTPROBLEM_HS4) ||
205  (to == TESTOPTPROBLEM_HS5) ||
206  (to == TESTOPTPROBLEM_HS24) ||
207  (to == TESTOPTPROBLEM_HS25) ||
208  (to == TESTOPTPROBLEM_HS29) ||
209  (to == TESTOPTPROBLEM_HS32) ||
210  (to == TESTOPTPROBLEM_HS38) ||
211  (to == TESTOPTPROBLEM_HS39) ||
212  (to == TESTOPTPROBLEM_HS45) ||
213  (to == TESTOPTPROBLEM_BVP) ||
217  (to == TESTOPTPROBLEM_MINIMAX1) ||
218  (to == TESTOPTPROBLEM_MINIMAX2) ||
219  (to == TESTOPTPROBLEM_MINIMAX3) );
220  }
221 
223  return type = static_cast<ETestOptProblem>(type+1);
224  }
225 
227  ETestOptProblem oldval = type;
228  ++type;
229  return oldval;
230  }
231 
233  return type = static_cast<ETestOptProblem>(type-1);
234  }
235 
237  ETestOptProblem oldval = type;
238  --type;
239  return oldval;
240  }
241 
242  inline ETestOptProblem StringToETestOptProblem(std::string s) {
243  s = removeStringFormat(s);
245  if ( !s.compare(removeStringFormat(ETestOptProblemToString(to))) ) {
246  return to;
247  }
248  }
250  }
251 
252  template<class Real>
254  Ptr<Vector<Real> > &x0,
255  std::vector<Ptr<Vector<Real> > > &x,
256  const ETestOptProblem test ) {
257  Ptr<TestProblem<Real>> tp;
258  switch (test) {
259  case TESTOPTPROBLEM_ROSENBROCK: tp = makePtr<ZOO::getRosenbrock<Real>>(); break;
260  case TESTOPTPROBLEM_FREUDENSTEINANDROTH: tp = makePtr<ZOO::getFreudensteinRoth<Real>>(); break;
261  case TESTOPTPROBLEM_BEALE: tp = makePtr<ZOO::getBeale<Real>>(); break;
262  case TESTOPTPROBLEM_POWELL: tp = makePtr<ZOO::getPowell<Real>>(); break;
263  case TESTOPTPROBLEM_SUMOFSQUARES: tp = makePtr<ZOO::getSumOfSquares<Real>>(); break;
264  case TESTOPTPROBLEM_LEASTSQUARES: tp = makePtr<ZOO::getLeastSquares<Real>>(); break;
265  case TESTOPTPROBLEM_POISSONCONTROL: tp = makePtr<ZOO::getPoissonControl<Real>>(); break;
266  case TESTOPTPROBLEM_POISSONINVERSION: tp = makePtr<ZOO::getPoissonInversion<Real>>(); break;
267  case TESTOPTPROBLEM_ZAKHAROV: tp = makePtr<ZOO::getZakharov<Real>>(); break;
268  case TESTOPTPROBLEM_HS1: tp = makePtr<ZOO::getHS1<Real>>(); break;
269  case TESTOPTPROBLEM_HS2: tp = makePtr<ZOO::getHS2<Real>>(); break;
270  case TESTOPTPROBLEM_HS3: tp = makePtr<ZOO::getHS3<Real>>(); break;
271  case TESTOPTPROBLEM_HS4: tp = makePtr<ZOO::getHS4<Real>>(); break;
272  case TESTOPTPROBLEM_HS5: tp = makePtr<ZOO::getHS5<Real>>(); break;
273  case TESTOPTPROBLEM_HS24: tp = makePtr<ZOO::getHS24<Real>>(); break;
274  case TESTOPTPROBLEM_HS25: tp = makePtr<ZOO::getHS25<Real>>(); break;
275  case TESTOPTPROBLEM_HS29: tp = makePtr<ZOO::getHS29<Real>>(); break;
276  case TESTOPTPROBLEM_HS32: tp = makePtr<ZOO::getHS32<Real>>(); break;
277  case TESTOPTPROBLEM_HS38: tp = makePtr<ZOO::getHS38<Real>>(); break;
278  case TESTOPTPROBLEM_HS39: tp = makePtr<ZOO::getHS39<Real>>(); break;
279  case TESTOPTPROBLEM_HS45: tp = makePtr<ZOO::getHS45<Real>>(); break;
280  case TESTOPTPROBLEM_BVP: tp = makePtr<ZOO::getBVP<Real>>(); break;
281  case TESTOPTPROBLEM_PARABOLOIDCIRCLE: tp = makePtr<ZOO::getParaboloidCircle<Real>>(); break;
282  case TESTOPTPROBLEM_SIMPLEEQCONSTRAINED: tp = makePtr<ZOO::getSimpleEqConstrained<Real>>(); break;
283  case TESTOPTPROBLEM_CANTILEVERBEAM: tp = makePtr<ZOO::getCantileverBeam<Real>>(); break;
284  case TESTOPTPROBLEM_MINIMAX1: tp = makePtr<ZOO::getMinimax1<Real>>(); break;
285  case TESTOPTPROBLEM_MINIMAX2: tp = makePtr<ZOO::getMinimax1<Real>>(); break;
286  case TESTOPTPROBLEM_MINIMAX3: tp = makePtr<ZOO::getMinimax1<Real>>(); break;
287  case TESTOPTPROBLEM_LAST: break;
288  }
289  tp->get(problem,x0,x);
290  }
291 } // namespace ROL
292 
293 #endif
ROL_LeastSquares.hpp
Contains definitions for least squares function.
ROL_ParaboloidCircle.hpp
Contains definitions for the equality constrained NLP:
ROL::TESTOPTPROBLEM_MINIMAX2
Definition: ROL_GetTestProblems.hpp:144
ROL_HS3.hpp
Contains definitions for W. Hock and K. Schittkowski 3rd test function.
ROL_HS25.hpp
Contains definitions for W. Hock and K. Schittkowski 25th test function.
ROL_BVP.hpp
Contains definitions for the discrete boundary value problem (More, Garbow, Hillstrom,...
ROL_PoissonInversion.hpp
Contains definitions for Poisson material inversion.
ROL_HS5.hpp
Contains definitions for W. Hock and K. Schittkowski 5th test function.
ROL::TESTOPTPROBLEM_HS3
Definition: ROL_GetTestProblems.hpp:129
ROL::TESTOPTPROBLEM_BEALE
Definition: ROL_GetTestProblems.hpp:120
ROL_CantileverBeam.hpp
Contains definitions for Cantilevered Beam example in G. N. Vanderplaats, Numerical Optimization Tech...
ROL::TESTOPTPROBLEM_PARABOLOIDCIRCLE
Definition: ROL_GetTestProblems.hpp:140
ROL::TESTOPTPROBLEM_BVP
Definition: ROL_GetTestProblems.hpp:139
ROL::TESTOPTPROBLEM_ROSENBROCK
Definition: ROL_GetTestProblems.hpp:118
ROL::TESTOPTPROBLEM_MINIMAX3
Definition: ROL_GetTestProblems.hpp:145
ROL_HS2.hpp
Contains definitions for W. Hock and K. Schittkowski 2nd test function.
ROL::TESTOPTPROBLEM_HS5
Definition: ROL_GetTestProblems.hpp:131
ROL_HS39.hpp
Contains definitions for W. Hock and K. Schittkowski 39th test function.
ROL_FreudensteinRoth.hpp
Contains definitions for Freudenstein and Roth's function.
ROL::TESTOPTPROBLEM_ZAKHAROV
Definition: ROL_GetTestProblems.hpp:126
ROL::TESTOPTPROBLEM_MINIMAX1
Definition: ROL_GetTestProblems.hpp:143
ROL::TESTOPTPROBLEM_FREUDENSTEINANDROTH
Definition: ROL_GetTestProblems.hpp:119
ROL::TESTOPTPROBLEM_SUMOFSQUARES
Definition: ROL_GetTestProblems.hpp:122
ROL::removeStringFormat
std::string removeStringFormat(std::string s)
Definition: ROL_Types.hpp:247
ROL::TESTOPTPROBLEM_HS4
Definition: ROL_GetTestProblems.hpp:130
ROL::TESTOPTPROBLEM_HS2
Definition: ROL_GetTestProblems.hpp:128
ROL::TESTOPTPROBLEM_HS38
Definition: ROL_GetTestProblems.hpp:136
ROL_Rosenbrock.hpp
Contains definitions for Rosenbrock's function.
ROL::TESTOPTPROBLEM_CANTILEVERBEAM
Definition: ROL_GetTestProblems.hpp:142
ROL_Minimax2.hpp
ROL::TESTOPTPROBLEM_SIMPLEEQCONSTRAINED
Definition: ROL_GetTestProblems.hpp:141
ROL_HS24.hpp
Contains definitions for W. Hock and K. Schittkowski 24th test problem which contains bound and inequ...
ROL::operator++
ETrustRegion & operator++(ETrustRegion &type)
Definition: ROL_TrustRegionTypes.hpp:99
ROL::operator--
ETrustRegion & operator--(ETrustRegion &type)
Definition: ROL_TrustRegionTypes.hpp:109
ROL_HS32.hpp
Contains definitions for W. Hock and K. Schittkowski 32nd test problem which contains both inequality...
ROL::TESTOPTPROBLEM_HS45
Definition: ROL_GetTestProblems.hpp:138
ROL::TESTOPTPROBLEM_POISSONCONTROL
Definition: ROL_GetTestProblems.hpp:124
ROL::Vector
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:80
ROL::TESTOPTPROBLEM_HS25
Definition: ROL_GetTestProblems.hpp:133
ROL_SumOfSquares.hpp
Contains definitions for sum of squares function.
ROL::TESTOPTPROBLEM_HS1
Definition: ROL_GetTestProblems.hpp:127
ROL::StringToETestOptProblem
ETestOptProblem StringToETestOptProblem(std::string s)
Definition: ROL_GetTestProblems.hpp:242
ROL::GetTestProblem
void GetTestProblem(Ptr< OptimizationProblem< Real > > &problem, Ptr< Vector< Real > > &x0, std::vector< Ptr< Vector< Real > > > &x, const ETestOptProblem test)
Definition: ROL_GetTestProblems.hpp:253
ROL::TESTOPTPROBLEM_HS29
Definition: ROL_GetTestProblems.hpp:134
ROL::TESTOPTPROBLEM_LAST
Definition: ROL_GetTestProblems.hpp:146
ROL
Definition: ROL_ElementwiseVector.hpp:61
ROL::ETestOptProblem
ETestOptProblem
Enumeration of test optimization problems.
Definition: ROL_GetTestProblems.hpp:117
ROL_HS45.hpp
Contains definitions for W. Hock and K. Schittkowski 45th test function.
ROL_Powell.hpp
Contains definitions for Powell's badly scaled function.
ROL_PoissonControl.hpp
Contains definitions for Poisson optimal control.
ROL_HS4.hpp
Contains definitions for W. Hock and K. Schittkowski 4th test function.
ROL::isValidTestOptProblem
int isValidTestOptProblem(ETestOptProblem to)
Verifies validity of a TestOptProblem enum.
Definition: ROL_GetTestProblems.hpp:191
ROL::TESTOPTPROBLEM_HS39
Definition: ROL_GetTestProblems.hpp:137
ROL_Minimax3.hpp
ROL::TESTOPTPROBLEM_LEASTSQUARES
Definition: ROL_GetTestProblems.hpp:123
ROL::TESTOPTPROBLEM_POISSONINVERSION
Definition: ROL_GetTestProblems.hpp:125
ROL_HS38.hpp
Contains definitions for W. Hock and K. Schittkowski 38th test function.
ROL_Beale.hpp
Contains definitions for Beale's function.
ROL_SimpleEqConstrained.hpp
Contains definitions for the equality constrained NLP from Nocedal/Wright, 2nd edition,...
ROL::OptimizationProblem
Definition: ROL_OptimizationProblem.hpp:73
ROL::TESTOPTPROBLEM_HS24
Definition: ROL_GetTestProblems.hpp:132
ROL_Minimax1.hpp
ROL_Zakharov.hpp
Contains definitions for the Zakharov function as evaluated using only the ROL::Vector interface.
ROL_HS29.hpp
Contains definitions for W. Hock and K. Schittkowski 32nd test problem which contains only inequality...
ROL::ETestOptProblemToString
std::string ETestOptProblemToString(ETestOptProblem to)
Definition: ROL_GetTestProblems.hpp:149
ROL::TESTOPTPROBLEM_HS32
Definition: ROL_GetTestProblems.hpp:135
ROL::TESTOPTPROBLEM_POWELL
Definition: ROL_GetTestProblems.hpp:121
ROL_HS1.hpp
Contains definitions for W. Hock and K. Schittkowski 1st test function.