3 #include "../activations/ActivationBase.hpp" 10 template <typename SCALAR, typename TRAIT = typename ct::core::tpl::TraitSelector<SCALAR>::Trait>
16 : t_on_(t_on), t_off_(t_off), slope_(slope), startVal_(startVal)
21 : t_on_(arg.t_on_), t_off_(arg.t_off_), slope_(arg.slope_), startVal_(arg.startVal_)
24 virtual void loadConfigFile(
const std::string& filename,
const std::string& termName,
bool verbose =
false)
override 26 boost::property_tree::ptree pt;
27 boost::property_tree::read_info(filename, pt);
28 t_on_ = pt.get<
SCALAR>(termName +
".t_on");
29 t_off_ = pt.get<
SCALAR>(termName +
".t_off");
30 slope_ = pt.get<
SCALAR>(termName +
".slope");
31 startVal_ = pt.get<
SCALAR>(termName +
".startVal");
35 virtual bool isActive(
const SCALAR t)
override {
return (t >= t_on_ && t < t_off_); }
40 std::cout <<
"Cost function with linear activation active from " << t_on_ <<
" s with value " << startVal_
41 <<
", increasing by " << slope_ <<
" per second and ending at " << t_off_ <<
" s." << std::endl;
Definition: LinearActivation.hpp:11
LinearActivation(const LinearActivation &arg)
Definition: LinearActivation.hpp:20
virtual SCALAR computeActivation(const SCALAR t) override
within this time-window, the activation is saturated
Definition: LinearActivation.hpp:37
virtual void printInfo() override
print to console
Definition: LinearActivation.hpp:38
LinearActivation(const SCALAR t_on, const SCALAR t_off, const SCALAR slope, const SCALAR startVal)
Definition: LinearActivation.hpp:15
CppAD::AD< CppAD::cg::CG< double > > SCALAR
Definition: ActivationBase.hpp:18
const bool verbose
Definition: JacobianCGTest.h:19
virtual void loadConfigFile(const std::string &filename, const std::string &termName, bool verbose=false) override
load activations from file
Definition: LinearActivation.hpp:24
LinearActivation()=default
virtual bool isActive(const SCALAR t) override
this activation is active in a strict time window
Definition: LinearActivation.hpp:35
virtual ~LinearActivation()=default