ROL
ROL_RandVarFunctionalFactory.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 
10 #ifndef ROL_RANDVARFUNCTIONALFACTORY_HPP
11 #define ROL_RANDVARFUNCTIONALFACTORY_HPP
12 
18 
19 namespace ROL {
20 
21  template<class Real>
22  inline Ptr<RandVarFunctional<Real> > RandVarFunctionalFactory(ROL::ParameterList &parlist) {
23  std::string type = parlist.sublist("SOL").get("Type","Risk Averse");
24  if (type == "Risk Averse") {
25  return RiskMeasureFactory<Real>(parlist);
26  }
27  else if (type == "Deviation") {
28  return DeviationMeasureFactory<Real>(parlist);
29  }
30  else if (type == "Error") {
31  return ErrorMeasureFactory<Real>(parlist);
32  }
33  else if (type == "Regret") {
34  return RegretMeasureFactory<Real>(parlist);
35  }
36  else if (type == "Probability") {
37  return ProbabilityFactory<Real>(parlist);
38  }
39  else {
40  ROL_TEST_FOR_EXCEPTION(true,std::invalid_argument,
41  ">>> (ROL::RandVarFunctionalFactory): Invalid random variable functional type!");
42  }
43  }
44 }
45 #endif
Ptr< RandVarFunctional< Real > > RandVarFunctionalFactory(ROL::ParameterList &parlist)