Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into stoprofiles
[simgrid.git] / src / kernel / resource / profile / StochasticDatedValue.hpp
1 /* Copyright (c) 2004-2019. 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 Distribution { Dist_Exp, Dist_Norm, Dist_Unif, Dist_Det };
18
19 class XBT_PUBLIC StochasticDatedValue {
20 public:
21   Distribution date_law;
22   std::vector<double> date_params;
23   Distribution value_law;
24   std::vector<double> value_params;
25   DatedValue get_datedvalue();
26   double get_date();
27   double get_value();
28   explicit StochasticDatedValue() = default;
29   explicit StochasticDatedValue(double d, double v)
30       : date_law(Dist_Det), date_params({d}), value_law(Dist_Det), value_params({v})
31   {
32   }
33   explicit StochasticDatedValue(Distribution dl, std::vector<double> dp, Distribution vl, std::vector<double> vp)
34       : date_law(dl), date_params(dp), value_law(vl), value_params(vp)
35   {
36   }
37   bool operator==(StochasticDatedValue const& e2) const;
38
39 private:
40   double draw(Distribution law, std::vector<double> params);
41 };
42
43 std::ostream& operator<<(std::ostream& out, const StochasticDatedValue& e);
44
45 } // namespace profile
46 } // namespace kernel
47 } // namespace simgrid
48
49 #endif