Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / src / kernel / resource / profile / StochasticDatedValue.hpp
1 /* Copyright (c) 2004-2021. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMGRID_KERNEL_PROFILE_STOCHASTICDATEDVALUE
7 #define SIMGRID_KERNEL_PROFILE_STOCHASTICDATEDVALUE
8
9 #include "simgrid/forward.h"
10 #include "src/kernel/resource/profile/DatedValue.hpp"
11 #include <vector>
12
13 namespace simgrid {
14 namespace kernel {
15 namespace profile {
16
17 enum class Distribution { EXP, NORM, UNIF, DET };
18
19 class XBT_PUBLIC StochasticDatedValue {
20 public:
21   Distribution date_law = Distribution::DET;
22   std::vector<double> date_params;
23   Distribution value_law = Distribution::DET;
24   std::vector<double> value_params;
25   DatedValue get_datedvalue() const;
26   double get_date() const;
27   double get_value() const;
28   explicit StochasticDatedValue() = default;
29   explicit StochasticDatedValue(double d, double v) : date_params({d}), value_params({v}) {}
30   explicit StochasticDatedValue(Distribution dl, const std::vector<double>& dp, Distribution vl,
31                                 const std::vector<double>& vp)
32       : date_law(dl), date_params(dp), value_law(vl), value_params(vp)
33   {
34   }
35   bool operator==(StochasticDatedValue const& e2) const;
36
37 private:
38   static double draw(Distribution law, std::vector<double> params);
39 };
40
41 } // namespace profile
42 } // namespace kernel
43 } // namespace simgrid
44
45 #endif