Program Listing for File abort_probability.hpp
↰ Return to documentation for file (cosm/ta/abort_probability.hpp
)
#pragma once
/*******************************************************************************
* Includes
******************************************************************************/
#include "rcppsw/math/sigmoid.hpp"
#include "rcppsw/rcppsw.hpp"
#include "rcppsw/types/timestep.hpp"
#include "cosm/ta/time_estimate.hpp"
/*******************************************************************************
* Namespaces/Decls
******************************************************************************/
namespace cosm::ta {
/*******************************************************************************
* Class Definitions
******************************************************************************/
class abort_probability : public rmath::sigmoid {
public:
/*
* A default reactivity value found experimentally to work well.
*/
static constexpr const double kDEFAULT_REACTIVITY = 8.0;
/*
* A default offset value found experimentally to work well.
*/
static constexpr const double kDEFAULT_OFFSET = 3.0;
/*
* A default gamma value because there needs to be one.
*/
static constexpr const double kDEFAULT_GAMMA = 1.0;
/*
* \brief All tasks need to have a small abort probability, so that they don't
* get stuck indefinitely.
*/
static constexpr const double kMIN_ABORT_PROB = 0.0001;
abort_probability(void)
: sigmoid(kDEFAULT_REACTIVITY, kDEFAULT_OFFSET, kDEFAULT_GAMMA) {}
explicit abort_probability(const rmath::config::sigmoid_config* config);
double operator()(const rtypes::timestep& exec_time,
const time_estimate& whole_task);
double calc(const rtypes::timestep& exec_time,
const time_estimate& whole_task) {
return operator()(exec_time, whole_task);
}
};
} /* namespace cosm::ta */