- 3.0.2 core module.
ActivationBase.hpp
Go to the documentation of this file.
1 /**********************************************************************************************************************
2 This file is part of the Control Toolbox (https://github.com/ethz-adrl/control-toolbox), copyright by ETH Zurich.
3 Licensed under the BSD-2 license (see LICENSE file in main directory)
4 **********************************************************************************************************************/
5 
6 #pragma once
7 
8 namespace ct {
9 namespace core {
10 
11 namespace tpl {
12 
17 template <typename SCALAR>
19 {
20 public:
22  ActivationBase() = default;
24  virtual ~ActivationBase() = default;
26  virtual void loadConfigFile(const std::string& filename, const std::string& termName, bool verbose = false)
27  {
28  throw std::runtime_error("No loadConfigFile method implemented for selected activation term");
29  }
30 
32  virtual bool isActive(const SCALAR s) { return true; }
34  virtual SCALAR computeActivation(const SCALAR s) { return (SCALAR)1.0; }
37  {
38  throw std::runtime_error("First order derivative not implemented for selected activation term");
39  }
42  {
43  throw std::runtime_error("Second order derivative not implemented for selected activation term");
44  }
46  virtual void printInfo() {}
47 };
48 } // namespace tpl
49 
51 } // namespace core
52 } // namespace ct
virtual SCALAR firstOrderDerivative(const SCALAR s)
first order derivative of this activation
Definition: ActivationBase.hpp:36
virtual ~ActivationBase()=default
destructor
virtual void loadConfigFile(const std::string &filename, const std::string &termName, bool verbose=false)
load activations from file
Definition: ActivationBase.hpp:26
CppAD::AD< CppAD::cg::CG< double > > SCALAR
Definition: ActivationBase.hpp:18
virtual bool isActive(const SCALAR s)
return if term is active
Definition: ActivationBase.hpp:32
virtual SCALAR secondOrderDerivative(const SCALAR s)
second order derivative of this activation
Definition: ActivationBase.hpp:41
ActivationBase()=default
constructor
const bool verbose
Definition: JacobianCGTest.h:19
virtual void printInfo()
print to console
Definition: ActivationBase.hpp:46
virtual SCALAR computeActivation(const SCALAR s)
compute activation multiplier based on scalar input
Definition: ActivationBase.hpp:34