1 /* Copyright (c) 2004-2021. The SimGrid Team. All rights reserved. */
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. */
6 #ifndef SIMGRID_KERNEL_PROFILE_STOCHASTICDATEDVALUE
7 #define SIMGRID_KERNEL_PROFILE_STOCHASTICDATEDVALUE
9 #include "simgrid/forward.h"
10 #include "src/kernel/resource/profile/DatedValue.hpp"
17 enum class Distribution { EXP, NORM, UNIF, DET };
19 class XBT_PUBLIC StochasticDatedValue {
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)
35 bool operator==(StochasticDatedValue const& e2) const;
38 static double draw(Distribution law, std::vector<double> params);
41 } // namespace profile
43 } // namespace simgrid