state_age_function.h Source File

CPP API: state_age_function.h Source File
state_age_function.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2020-2026 MEmilio
3 *
4 * Authors: Anna Wendler, Lena Ploetzke
5 *
6 * Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 
21 #ifndef STATEAGEFUNCTION_H
22 #define STATEAGEFUNCTION_H
23 
24 #include "memilio/config.h"
26 #include "memilio/math/smoother.h"
28 
29 #include "boost/math/distributions/gamma.hpp"
30 #include "boost/math/distributions/lognormal.hpp"
31 #include "memilio/utils/logging.h"
32 
33 namespace mio
34 {
35 /**************************
36 * Define StateAgeFunction *
37 ***************************/
38 
78 template <typename FP>
80 
88  StateAgeFunction(FP init_distribution_parameter, FP init_location = 0, FP init_scale = 1)
89  : m_distribution_parameter{init_distribution_parameter}
90  , m_location{init_location}
91  , m_scale{init_scale}
92  , m_mean{-1.0} // Initialize mean as not set.
93  , m_support_max{-1.0} // Initialize support maximum as not set.
94  {
95  if (m_scale <= 0) {
96  log_error("The scale parameter of a StateAgeFunction has to be positive. Set scale to 1.");
97  m_scale = 1.0;
98  }
99  }
100 
104  virtual ~StateAgeFunction() = default;
105 
109  StateAgeFunction(const StateAgeFunction<FP>& other) = default;
110 
115 
120 
125 
129  bool operator==(const StateAgeFunction<FP>& other) const
130  {
131  return (typeid(*this).name() == typeid(other).name() &&
133  m_scale == other.get_scale());
134  }
135 
143  virtual FP eval(FP state_age) = 0;
144 
153  {
155  }
156 
169  void set_distribution_parameter(FP new_distribution_parameter)
170  {
171  m_distribution_parameter = new_distribution_parameter;
172  m_support_max = -1.;
173  m_mean = -1.;
174  }
175 
183  FP get_location() const
184  {
185  return m_location;
186  }
187 
200  void set_location(FP new_location)
201  {
202  m_location = new_location;
203  m_support_max = -1.;
204  m_mean = -1.;
205  }
206 
214  FP get_scale() const
215  {
216  return m_scale;
217  }
218 
231  void set_scale(FP new_scale)
232  {
233  if (new_scale <= 0) {
234  log_error("The scale parameter of a StateAgeFunction has to be positive. Set scale to 1.");
235  new_scale = 1;
236  }
237  m_scale = new_scale;
238  m_support_max = -1.;
239  m_mean = -1.;
240  }
241 
256  virtual FP get_support_max(FP dt, FP tol = 1e-10)
257  {
258  FP support_max = 0.0;
259 
260  if (!floating_point_equal<FP>(m_support_tol, tol, 1e-14) ||
261  floating_point_equal<FP>(m_support_max, -1.0, 1e-14)) {
262  while (eval(support_max) >= tol) {
263  support_max += dt;
264  }
265 
266  m_support_max = support_max;
267  m_support_tol = tol;
268  }
269 
270  return m_support_max;
271  }
272 
289  virtual FP get_mean(FP dt = 1.0, FP tol = 1e-10)
290  {
291  using std::ceil;
292  if (!floating_point_equal<FP>(m_mean_tol, tol, 1e-14) || floating_point_equal<FP>(m_mean, -1., 1e-14)) {
293  // Integration using trapezoidal rule.
294  // Compute value for i=0.
295  FP mean = 0.5 * dt * eval(FP(0 * dt));
296  FP supp_max_idx = ceil(get_support_max(dt, tol) / dt);
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
299  // by definition of the support_max.
300  for (int i = 1; i < supp_max_idx; i++) {
301  mean += dt * eval(FP(i * dt));
302  }
303 
304  m_mean = mean;
305  m_mean_tol = tol;
306  }
307  return m_mean;
308  }
309 
315  std::string get_state_age_function_type() const
316  {
317  return typeid(*this).name();
318  }
319 
327  std::unique_ptr<StateAgeFunction<FP>> clone() const
328  {
329  return std::unique_ptr<StateAgeFunction<FP>>(clone_impl());
330  }
331 
332 protected:
336  virtual StateAgeFunction<FP>* clone_impl() const = 0;
337 
340  FP m_scale;
341  FP m_mean;
342  FP m_mean_tol{-1.0};
344  FP m_support_tol{-1.0};
345 };
346 
347 /**************************************
348 * Derived classes of StateAgeFunction *
349 ***************************************/
350 
355 template <typename FP>
357 
365  ExponentialSurvivalFunction(FP init_distribution_parameter, FP init_location = 0)
366  : StateAgeFunction<FP>(init_distribution_parameter, init_location)
367  {
368  }
369 
378  FP eval(FP state_age) override
379  {
380  using std::exp;
381  if (state_age <= this->m_location) {
382  return 1;
383  }
384  return exp(-this->m_distribution_parameter * (state_age - this->m_location));
385  }
386 
397  FP get_mean(FP dt = 1.0, FP tol = 1e-10) override
398  {
399  unused(dt);
400  unused(tol);
401  return 1.0 / this->m_distribution_parameter + this->m_location;
402  }
403 
404 protected:
411  {
412  return new ExponentialSurvivalFunction<FP>(*this);
413  }
414 };
415 
420 template <typename FP>
421 struct SmootherCosine : public StateAgeFunction<FP> {
422 
432  SmootherCosine(FP init_distribution_parameter, FP init_location = 0)
433  : StateAgeFunction<FP>(init_distribution_parameter, init_location)
434  {
435  }
436 
446  FP eval(FP state_age) override
447  {
448  if (state_age <= this->m_location) {
449  return 1.0;
450  }
451  return smoother_cosine<FP>(state_age - this->m_location, 0.0, this->m_distribution_parameter, 1.0, 0.0);
452  }
453 
463  FP get_support_max(FP dt, FP tol = 1e-10) override
464  {
465  unused(dt);
466  unused(tol);
467  this->m_support_max = this->m_distribution_parameter + this->m_location;
468  return this->m_support_max;
469  }
470 
481  FP get_mean(FP dt = 1.0, FP tol = 1e-10) override
482  {
483  unused(dt);
484  unused(tol);
485  return 0.5 * this->m_distribution_parameter + this->m_location;
486  }
487 
488 protected:
495  {
496  return new SmootherCosine<FP>(*this);
497  }
498 };
499 
508 struct GammaSurvivalFunction : public StateAgeFunction<ScalarType> {
509 
521  GammaSurvivalFunction(ScalarType init_shape = 1, ScalarType init_location = 0, ScalarType init_scale = 1)
522  : StateAgeFunction<ScalarType>(init_shape, init_location, init_scale)
523  {
524  }
525 
532  ScalarType eval(ScalarType state_age) override
533  {
534  if (state_age <= this->m_location) {
535  return 1;
536  }
537  boost::math::gamma_distribution<ScalarType, boost::math::policies::policy<>> gamma(
538  this->m_distribution_parameter, this->m_scale);
539  return boost::math::cdf(boost::math::complement(gamma, state_age - this->m_location));
540  }
541 
553  ScalarType get_mean(ScalarType dt = 1.0, ScalarType tol = 1e-10) override
554  {
555  unused(dt);
556  unused(tol);
557  return this->m_distribution_parameter * this->m_scale + this->m_location;
558  }
559 
560 protected:
567  {
568  return new GammaSurvivalFunction(*this);
569  }
570 };
571 
577 struct LognormSurvivalFunction : public StateAgeFunction<ScalarType> {
578 
590  LognormSurvivalFunction(ScalarType init_distribution_parameter, ScalarType init_location = 0,
591  ScalarType init_scale = 1)
592  : StateAgeFunction<ScalarType>(init_distribution_parameter, init_location, init_scale)
593  {
594  }
595 
602  ScalarType eval(ScalarType state_age) override
603  {
604  if (state_age < this->m_location) {
605  return 1;
606  }
607  boost::math::lognormal_distribution<ScalarType, boost::math::policies::policy<>> logn(
608  0.0, this->m_distribution_parameter);
609  return boost::math::cdf(boost::math::complement(logn, (state_age - this->m_location) / this->m_scale));
610  }
611 
612  // Closed form for the mean value is kind of complex, use default implementation.
613  // For testing purposes, a class must exist anyway that uses the default implementation.
614 
615 protected:
622  {
623  return new LognormSurvivalFunction(*this);
624  }
625 };
626 
630 template <typename FP>
631 struct ConstantFunction : public StateAgeFunction<FP> {
637  ConstantFunction(FP init_distribution_parameter)
638  : StateAgeFunction<FP>(init_distribution_parameter)
639  {
640  }
641 
650  FP eval(FP state_age) override
651  {
652  unused(state_age);
653  return this->m_distribution_parameter;
654  }
655 
666  FP get_support_max(FP dt, FP tol = 1e-10) override
667  {
668  // In case of a ConstantFunction we would have support_max = infinity
669  // This type of function is not suited to be a TransitionDistribution
670  // Log error and return -2.
671 
672  unused(dt);
673  unused(tol);
674  this->m_support_max = -2.0;
675 
676  log_error("This function is not suited to be a TransitionDistribution. Do not call in case of "
677  "StateAgeFunctions of type b); see documentation of StateAgeFunction Base class.");
678 
679  return this->m_support_max;
680  }
681 
691  FP get_mean(FP dt = 1.0, FP tol = 1e-10) override
692  {
693  unused(dt);
694  unused(tol);
695  log_warning("Attention: This function is not suited to be a TransitionDistribution. Do not call in case of "
696  "StateAgeFunctions of type b); see documentation of StateAgeFunction Base class.");
697  return this->m_distribution_parameter;
698  }
699 
700 protected:
707  {
708  return new ConstantFunction<FP>(*this);
709  }
710 };
711 
720 struct ErlangDensity : public StateAgeFunction<ScalarType> {
721 
728  ErlangDensity(unsigned int init_shape, ScalarType init_scale)
729  : StateAgeFunction<ScalarType>(init_shape, 0.0, init_scale)
730  {
731  }
732 
741  ScalarType eval(ScalarType state_age) override
742  {
743  using std::exp;
744  using std::pow;
745  if (state_age < 0) {
746  return 0;
747  }
748  int shape = static_cast<int>(this->m_distribution_parameter);
749  return pow(state_age / this->m_scale, shape - 1) /
750  (this->m_scale * boost::math::factorial<ScalarType>(shape - 1)) * exp(-state_age / this->m_scale);
751  }
752 
763  {
764  // We are looking for the smallest time value t where function(tau)=0 for all tau>t. Thus support max is bigger
765  // than the mean.
766  // We use, that the density is monotonically decreasing for tau>mean here.
767  ScalarType mean = this->m_distribution_parameter * this->m_scale;
768  ScalarType support_max = dt * static_cast<int>(mean / dt);
769 
770  if (!floating_point_equal<ScalarType>(this->m_support_tol, tol, 1e-14) ||
771  floating_point_equal<ScalarType>(this->m_support_max, -1.0, 1e-14)) {
772  while (eval(support_max) >= tol) {
773  support_max += dt;
774  }
775 
776  this->m_support_max = support_max;
777  this->m_support_tol = tol;
778  }
779 
780  return this->m_support_max;
781  }
782 
792  ScalarType get_mean(ScalarType dt = 1.0, ScalarType tol = 1e-10) override
793  {
794  unused(dt);
795  unused(tol);
796  log_warning("Attention: This function is not suited to be a TransitionDistribution. Do not call in case of "
797  "StateAgeFunctions of type b); see documentation of StateAgeFunction Base class.");
798  return this->m_distribution_parameter * this->m_scale;
799  }
800 
801 protected:
808  {
809  return new ErlangDensity(*this);
810  }
811 };
812 
813 /*********************************
814 * Define StateAgeFunctionWrapper *
815 *********************************/
816 
830 template <typename FP>
832 
834  : m_function(mio::SmootherCosine<FP>(1.0).clone())
835  {
836  }
843  : m_function(init_function.clone())
844  {
845  }
846 
851  : m_function(other.m_function->clone())
852  {
853  }
854 
859 
864  {
865  m_function = other.m_function->clone();
866  return *this;
867  }
868 
873 
878 
882  bool operator==(const StateAgeFunctionWrapper<FP>& other) const
883  {
884  return (m_function->get_state_age_function_type() == other.get_state_age_function_type() &&
885  m_function->get_distribution_parameter() == other.get_distribution_parameter() &&
886  m_function->get_location() == other.get_location() && m_function->get_scale() == other.get_scale());
887  }
888 
895  {
896  m_function = new_function.clone();
897  }
898 
904  std::string get_state_age_function_type() const
905  {
906  return m_function->get_state_age_function_type();
907  }
908 
915  FP eval(FP state_age) const
916  {
917  return m_function->eval(state_age);
918  }
919 
926  {
927  return m_function->get_distribution_parameter();
928  }
929 
935  void set_distribution_parameter(FP new_distribution_parameter)
936  {
937  m_function->set_distribution_parameter(new_distribution_parameter);
938  }
939 
945  FP get_location() const
946  {
947  return m_function->get_location();
948  }
949 
955  void set_location(FP new_location)
956  {
957  m_function->set_location(new_location);
958  }
964  FP get_scale() const
965  {
966  return m_function->get_scale();
967  }
968 
974  void set_scale(FP new_scale)
975  {
976  m_function->set_scale(new_scale);
977  }
978 
986  FP get_support_max(FP dt, FP tol = 1e-10) const
987  {
988  return m_function->get_support_max(dt, tol);
989  }
990 
998  FP get_mean(FP dt = 1.0, FP tol = 1e-10) const
999  {
1000  return m_function->get_mean(dt, tol);
1001  }
1002 
1003 private:
1004  std::unique_ptr<StateAgeFunction<FP>> m_function;
1005 };
1006 
1007 } // namespace mio
1008 
1009 #endif // STATEAGEFUNCTION_H
double ScalarType
Configuration of memilio library.
Definition: memilio/config.h:30
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
auto i
Definition: io.h:809
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
Class that defines a constant function.
Definition: state_age_function.h:631
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
~StateAgeFunctionWrapper()=default
Destructor.
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
virtual ~StateAgeFunction()=default
Virtual destructor.
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