ROL
Loading...
Searching...
No Matches
ROL_MonteCarloGenerator.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_MONTECARLOGENERATOR_HPP
11#define ROL_MONTECARLOGENERATOR_HPP
12
14#include "ROL_Distribution.hpp"
15
16namespace ROL {
17
18template<typename Real>
20private:
21 std::vector<std::vector<Real>> data_;
22 const std::vector<Ptr<Distribution<Real>>> dist_;
23
24 const bool use_normal_;
25 const bool useDist_;
26
29 Real sum_ng_;
31
32 Real ierf(Real input) const;
33 Real random(void) const;
34
35protected:
36 int nSamp_;
37 const bool use_SA_;
38 const bool adaptive_;
39 const int numNewSamps_;
40 const int seed_;
41
42 virtual std::vector<std::vector<Real>> sample(int nSamp, bool store = true, bool refine = false);
43
44public:
45 MonteCarloGenerator(int nSamp,
46 const std::vector<Ptr<Distribution<Real>>> &dist,
47 const Ptr<BatchManager<Real>> &bman,
48 bool use_SA = false,
49 bool adaptive = false,
50 int numNewSamps = 0,
51 int seed = 123454321);
52
53 MonteCarloGenerator(int nSamp,
54 std::vector<std::vector<Real>> &bounds,
55 const Ptr<BatchManager<Real>> &bman,
56 bool use_SA = false,
57 bool adaptive = false,
58 int numNewSamps = 0,
59 int seed = 123454321);
60
61 MonteCarloGenerator(int nSamp,
62 const std::vector<Real> &mean,
63 const std::vector<Real> &std,
64 const Ptr<BatchManager<Real>> &bman,
65 bool use_SA = false,
66 bool adaptive = false,
67 int numNewSamps = 0,
68 int seed = 123454321);
69
71 bool use_SA = false,
72 bool adaptive = false,
73 int numNewSamps = 0,
74 int seed = 123454321);
75
76 void update( const Vector<Real> &x ) override;
77 Real computeError( std::vector<Real> &vals ) override;
78 Real computeError( std::vector<Ptr<Vector<Real>>> &vals, const Vector<Real> &x ) override;
79 void refine(void) override;
80 int numGlobalSamples(void) const override;
81
82};
83
84}
85
87
88#endif
Real computeError(std::vector< Real > &vals) override
std::vector< std::vector< Real > > data_
const std::vector< Ptr< Distribution< Real > > > dist_
void update(const Vector< Real > &x) override
int numGlobalSamples(void) const override
virtual std::vector< std::vector< Real > > sample(int nSamp, bool store=true, bool refine=false)
Defines the linear algebra or vector space interface.