20 DistributionHandler::DistributionHandler() : m_nbr_combinations(1)
22 setName(
"DistributionHandler");
25 DistributionHandler::~DistributionHandler() =
default;
30 m_distributions.push_back(par_distr);
38 return m_nbr_combinations;
43 if (index >= m_nbr_combinations)
45 "DistributionWeighter::setParameterValues: "
46 "index must be smaller than the total number of parameter combinations");
47 size_t n_distr = m_distributions.size();
51 for (
size_t param_index = n_distr - 1;; --param_index) {
52 size_t remainder = index % m_distributions[param_index].getNbrSamples();
53 index /= m_distributions[param_index].getNbrSamples();
55 m_distributions[param_index].getMainParameterName(),
56 m_cached_samples[param_index][remainder].value);
59 "parameter name matches nothing or more than "
62 weight *= m_cached_samples[param_index][remainder].weight;
71 for (
auto& distribution : m_distributions) {
72 const std::string par_name = distribution.getMainParameterName();
73 const double mean_val = distribution.getDistribution()->getMean();
75 throw std::runtime_error(
"Error in DistributionHandler::setParameterToMeans: parameter "
76 "name matches nothing or more than "
81 const DistributionHandler::Distributions_t& DistributionHandler::getDistributions()
const
83 return m_distributions;
Defines class DistributionHandler.
Defines classes representing one-dimensional distributions.
Defines many exception classes in namespace Exceptionss.
Defines class ParameterPool.
void addParameterDistribution(const std::string ¶m_name, const IDistribution1D &distribution, size_t nbr_samples, double sigma_factor=0.0, const RealLimits &limits=RealLimits())
add a sampled parameter distribution
double setParameterValues(ParameterPool *p_parameter_pool, size_t index)
set the parameter values of the simulation object to a specific combination of values,...
void setParameterToMeans(ParameterPool *p_parameter_pool) const
Sets mean distribution values to the parameter pool.
size_t getTotalNumberOfSamples() const
get the total number of parameter value combinations (product of the individual sizes of each paramet...
A parametric distribution function, for use with any model parameter.
size_t getNbrSamples() const
get number of samples for this distribution
std::vector< ParameterSample > generateSamples() const
generate list of sampled values with their weight
Container with parameters for IParameterized object.
int setMatchedParametersValue(const std::string &wildcards, double value)
Sets value of the nonzero parameters that match pattern ('*' allowed), or throws.