Program Listing for File bi_tab_sel_probability.hpp

Return to documentation for file (cosm/ta/bi_tab_sel_probability.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <string>

#include "rcppsw/er/client.hpp"
#include "rcppsw/math/rng.hpp"
#include "rcppsw/math/sigmoid.hpp"
#include "rcppsw/rcppsw.hpp"

/*******************************************************************************
 * Namespaces/Decls
 ******************************************************************************/
namespace cosm::ta {

namespace ds { class bi_tab; }
namespace config { struct src_sigmoid_sel_config; }

/*******************************************************************************
 * Class Definitions
 ******************************************************************************/
class bi_tab_sel_probability : public rer::client<bi_tab_sel_probability>,
                               public rmath::sigmoid {
 public:
  static constexpr const double kHARWELL2019_REACTIVITY = 8.0;
  static constexpr const double kHARWELL2019_OFFSET = 1.25;
  static constexpr const double kHARWELL2019_GAMMA = 1.0;

  static inline const std::string kMethodHarwell2019 = "harwell2019";
  static inline const std::string kMethodRandom = "random";

  explicit bi_tab_sel_probability(const std::string& method);

  explicit bi_tab_sel_probability(const config::src_sigmoid_sel_config* config);

  const std::string& method(void) const { return mc_method; }

  double
  operator()(const ds::bi_tab* tab1, const ds::bi_tab* tab2, rmath::rng* rng);

 private:
  double calc_random(rmath::rng* rng);

  double calc_harwell2019(const ds::bi_tab& tab1, const ds::bi_tab& tab2);

  double calc_sigmoid(double ratio1, double ratio2) RCPPSW_PURE;

  /* clang-format off */
  const std::string mc_method;
  /* clang-format on */
};

} /* namespace cosm::ta */