state_age_function.h Source File
|
CPP API
|
state_age_function.h
Go to the documentation of this file.
132 m_distribution_parameter == other.get_distribution_parameter() && m_location == other.get_location() &&
292 if (!floating_point_equal<FP>(m_mean_tol, tol, 1e-14) || floating_point_equal<FP>(m_mean, -1., 1e-14)) {
297 // We start with i=1 since the value for i=0 was already considered above when defining the variable mean.
298 // Note that we do not consider indices i>=supp_max_idx since it holds eval(i*dt)<tol for all i>=supp_max_idx
451 return smoother_cosine<FP>(state_age - this->m_location, 0.0, this->m_distribution_parameter, 1.0, 0.0);
521 GammaSurvivalFunction(ScalarType init_shape = 1, ScalarType init_location = 0, ScalarType init_scale = 1)
609 return boost::math::cdf(boost::math::complement(logn, (state_age - this->m_location) / this->m_scale));
695 log_warning("Attention: This function is not suited to be a TransitionDistribution. Do not call in case of "
750 (this->m_scale * boost::math::factorial<ScalarType>(shape - 1)) * exp(-state_age / this->m_scale);
764 // We are looking for the smallest time value t where function(tau)=0 for all tau>t. Thus support max is bigger
796 log_warning("Attention: This function is not suited to be a TransitionDistribution. Do not call in case of "
886 m_function->get_location() == other.get_location() && m_function->get_scale() == other.get_scale());
ad::internal::binary_intermediate_aa< AD_TAPE_REAL, ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 >, ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 >, ad::operations::ad_pow_aa< AD_TAPE_REAL > > pow(const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &x1, const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &x2)
Definition: ad.hpp:1610
static double ceil(const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &x)
Definition: ad.hpp:2449
ad::internal::unary_intermediate< AD_TAPE_REAL, ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 >, ad::operations::ad_exp< AD_TAPE_REAL > > exp(const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &x1)
Definition: ad.hpp:990
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
void log_warning(spdlog::string_view_t fmt, const Args &... args)
Definition: logging.h:112
void log_error(spdlog::string_view_t fmt, const Args &... args)
Definition: logging.h:100
void unused(T &&...)
Does nothing, can be used to mark variables as not used.
Definition: compiler_diagnostics.h:30
FP get_support_max(FP dt, FP tol=1e-10) override
Computes the maximum of the support of the function.
Definition: state_age_function.h:666
FP eval(FP state_age) override
Defines constant function.
Definition: state_age_function.h:650
FP get_mean(FP dt=1.0, FP tol=1e-10) override
Computes the mean value of the function.
Definition: state_age_function.h:691
ConstantFunction(FP init_distribution_parameter)
Constructs a new ConstantFunction object.
Definition: state_age_function.h:637
StateAgeFunction< FP > * clone_impl() const override
Clones unique pointer to a StateAgeFunction.
Definition: state_age_function.h:706
Class that defines the probability density function corresponding to the Erlang distribution with the...
Definition: state_age_function.h:720
ErlangDensity(unsigned int init_shape, ScalarType init_scale)
Constructs a new ErlangDensity object.
Definition: state_age_function.h:728
ScalarType get_support_max(ScalarType dt, ScalarType tol=1e-10) override
Computes the maximum of the support of the function.
Definition: state_age_function.h:762
ScalarType eval(ScalarType state_age) override
Defines ErlangDensity depending on state_age.
Definition: state_age_function.h:741
ScalarType get_mean(ScalarType dt=1.0, ScalarType tol=1e-10) override
Computes the mean value of the function.
Definition: state_age_function.h:792
StateAgeFunction< ScalarType > * clone_impl() const override
Implements clone for ErlangDensity.
Definition: state_age_function.h:807
Class that defines the survival function corresponding to the exponential distribution depending on t...
Definition: state_age_function.h:356
ExponentialSurvivalFunction(FP init_distribution_parameter, FP init_location=0)
Constructs a new ExponentialSurvivalFunction object.
Definition: state_age_function.h:365
FP eval(FP state_age) override
Defines exponential decay function depending on state_age.
Definition: state_age_function.h:378
FP get_mean(FP dt=1.0, FP tol=1e-10) override
Computes the mean value of the function.
Definition: state_age_function.h:397
StateAgeFunction< FP > * clone_impl() const override
Implements clone for ExponentialSurvivalFunction.
Definition: state_age_function.h:410
Class that defines an GammaSurvivalFunction function depending on the state age.
Definition: state_age_function.h:508
StateAgeFunction< ScalarType > * clone_impl() const override
Implements clone for GammaSurvivalFunction.
Definition: state_age_function.h:566
ScalarType eval(ScalarType state_age) override
Defines GammaSurvivalFunction depending on state_age.
Definition: state_age_function.h:532
GammaSurvivalFunction(ScalarType init_shape=1, ScalarType init_location=0, ScalarType init_scale=1)
Constructs a new GammaSurvivalFunction object.
Definition: state_age_function.h:521
ScalarType get_mean(ScalarType dt=1.0, ScalarType tol=1e-10) override
Computes the mean value of the function.
Definition: state_age_function.h:553
Class that defines an LognormSurvivalFunction function depending on the state age.
Definition: state_age_function.h:577
LognormSurvivalFunction(ScalarType init_distribution_parameter, ScalarType init_location=0, ScalarType init_scale=1)
Constructs a new LognormSurvivalFunction object.
Definition: state_age_function.h:590
ScalarType eval(ScalarType state_age) override
Defines the value of the LognormSurvivalFunction depending on state_age.
Definition: state_age_function.h:602
StateAgeFunction< ScalarType > * clone_impl() const override
Implements clone for LognormSurvivalFunction.
Definition: state_age_function.h:621
Class that defines an smoother_cosine function depending on the state age.
Definition: state_age_function.h:421
StateAgeFunction< FP > * clone_impl() const override
Clones unique pointer to a StateAgeFunction.
Definition: state_age_function.h:494
FP get_mean(FP dt=1.0, FP tol=1e-10) override
Computes the mean value of the function.
Definition: state_age_function.h:481
FP eval(FP state_age) override
Defines smoother cosine function depending on state_age.
Definition: state_age_function.h:446
SmootherCosine(FP init_distribution_parameter, FP init_location=0)
Constructs a new SmootherCosine object.
Definition: state_age_function.h:432
FP get_support_max(FP dt, FP tol=1e-10) override
Computes the maximum of the support of the function.
Definition: state_age_function.h:463
Wrapper around StateAgeFunction so that one can work with an arbitrary StateAgeFunction.
Definition: state_age_function.h:831
void set_location(FP new_location)
Set the m_location object of m_function.
Definition: state_age_function.h:955
void set_scale(FP new_scale)
Set the m_scale object of m_function.
Definition: state_age_function.h:974
FP get_mean(FP dt=1.0, FP tol=1e-10) const
Get the m_mean object of m_function.
Definition: state_age_function.h:998
FP eval(FP state_age) const
Accesses eval of m_function.
Definition: state_age_function.h:915
FP get_support_max(FP dt, FP tol=1e-10) const
Get the m_support_max object of m_function.
Definition: state_age_function.h:986
std::unique_ptr< StateAgeFunction< FP > > m_function
Stores StateAgeFunction that is used in Wrapper.
Definition: state_age_function.h:1004
StateAgeFunctionWrapper(StateAgeFunctionWrapper< FP > &&other)=default
Move constructor.
StateAgeFunctionWrapper(StateAgeFunction< FP > &init_function)
Constructs a new StateAgeFunctionWrapper object.
Definition: state_age_function.h:842
void set_distribution_parameter(FP new_distribution_parameter)
Set the m_distribution_parameter object of m_function.
Definition: state_age_function.h:935
bool operator==(const StateAgeFunctionWrapper< FP > &other) const
Comparison operator.
Definition: state_age_function.h:882
void set_state_age_function(StateAgeFunction< FP > &new_function)
Set the StateAgeFunction object.
Definition: state_age_function.h:894
StateAgeFunctionWrapper(StateAgeFunctionWrapper< FP > const &other)
Copy constructor.
Definition: state_age_function.h:850
StateAgeFunctionWrapper< FP > & operator=(StateAgeFunctionWrapper< FP > &&other)=default
Move assignment.
StateAgeFunctionWrapper()
Definition: state_age_function.h:833
FP get_location() const
Get the m_location object of m_function.
Definition: state_age_function.h:945
FP get_scale() const
Get the m_scale object of m_function.
Definition: state_age_function.h:964
std::string get_state_age_function_type() const
Get type of StateAgeFunction, i.e.
Definition: state_age_function.h:904
FP get_distribution_parameter() const
Get the m_distribution_parameter object of m_function.
Definition: state_age_function.h:925
StateAgeFunctionWrapper< FP > & operator=(StateAgeFunctionWrapper< FP > const &other)
Copy assignment.
Definition: state_age_function.h:863
A generic function depending on the state age, i.e.
Definition: state_age_function.h:79
FP get_location() const
Get the m_location object.
Definition: state_age_function.h:183
FP m_mean_tol
Tolerance for computation of the mean (initialize as not set).
Definition: state_age_function.h:342
void set_distribution_parameter(FP new_distribution_parameter)
Set the m_distribution_parameter object.
Definition: state_age_function.h:169
StateAgeFunction(const StateAgeFunction< FP > &other)=default
Copy constructor.
virtual FP get_mean(FP dt=1.0, FP tol=1e-10)
Computes the mean value of the function using the time step size dt and some tolerance tol.
Definition: state_age_function.h:289
StateAgeFunction(FP init_distribution_parameter, FP init_location=0, FP init_scale=1)
Constructs a new StateAgeFunction object.
Definition: state_age_function.h:88
FP get_distribution_parameter() const
Get the m_distribution_parameter object.
Definition: state_age_function.h:152
FP m_distribution_parameter
Parameter for function in derived class.
Definition: state_age_function.h:338
StateAgeFunction< FP > & operator=(StateAgeFunction< FP > &&other)=default
Move assignment operator.
std::string get_state_age_function_type() const
Get type of StateAgeFunction, i.e.which derived class is used.
Definition: state_age_function.h:315
FP m_support_max
Maximum of the support of the function.
Definition: state_age_function.h:343
StateAgeFunction< FP > & operator=(const StateAgeFunction< FP > &other)=default
Copy assignment operator.
FP m_support_tol
Tolerance for computation of the support (initialize as not set).
Definition: state_age_function.h:344
void set_scale(FP new_scale)
Set the m_scale object.
Definition: state_age_function.h:231
bool operator==(const StateAgeFunction< FP > &other) const
Comparison operator.
Definition: state_age_function.h:129
std::unique_ptr< StateAgeFunction< FP > > clone() const
Clones unique pointer to a StateAgeFunction.
Definition: state_age_function.h:327
void set_location(FP new_location)
Set the m_location object.
Definition: state_age_function.h:200
FP m_location
Location parameter for function in derived class.
Definition: state_age_function.h:339
virtual FP get_support_max(FP dt, FP tol=1e-10)
Computes the maximum of the support of the function using the time step size dt and some tolerance to...
Definition: state_age_function.h:256
FP get_scale() const
Get the m_scale object.
Definition: state_age_function.h:214
virtual StateAgeFunction< FP > * clone_impl() const =0
Pure virtual method that implements cloning.
FP m_scale
Scale parameter for function in derived class.
Definition: state_age_function.h:340
virtual FP eval(FP state_age)=0
Here a pure virtual function is defined that depends on the state_age.
StateAgeFunction(StateAgeFunction< FP > &&other)=default
Move constructor.
FP m_mean
Mean value of the function.
Definition: state_age_function.h:341
Generated by