 |
Grail (C++)
1.1.1
A multi-platform, modular, universal engine for embedding advanced AI in games.
|
1 #ifndef GRAIL_SIGMOID_FUNCTION_H
2 #define GRAIL_SIGMOID_FUNCTION_H
11 template <
typename ContextType>
32 :
Curve<ContextType>{childEvaluator},
36 displacement(displacement)
40 virtual float Sample(
float argument)
const override final
42 float x = slope * (argument - threshold);
45 float exp_x = std::exp(x);
46 return ((range * exp_x) / (1 + exp_x)) + displacement;
50 return (range / (1 + std::exp(-x))) + displacement;
75 virtual EvaluatorType GetEvaluatorType() const override final {
return EvaluatorType::CURVE_SIGMOID; }
80 float threshold = 0.0f;
81 float displacement = 0.0f;
86 #endif // GRAIL_SIGMOID_FUNCTION_H
The Curve class - Defines objects transforming one value into the other.
Definition: Curve.hh:19
float GetThreshold() const
GetThreshold.
Definition: SigmoidFunction.hh:68
virtual float Sample(float argument) const override final
Sample - Transforms argument into output value depending on the type of Curve.
Definition: SigmoidFunction.hh:40
float GetSlope() const
GetSlope.
Definition: SigmoidFunction.hh:63
SigmoidFunction(std::shared_ptr< utility::Evaluator< ContextType >> childEvaluator, float range, float slope, float threshold, float displacement)
SigmoidFunction - Constructor.
Definition: SigmoidFunction.hh:27
float GetDisplacement() const
GetDisplacement.
Definition: SigmoidFunction.hh:73
The SigmoidFunction class - Sigmoid function.
Definition: SigmoidFunction.hh:16
The Evaluator class - base class being able to evaluate given context and output the result.
Definition: Evaluator.hh:20
float GetRange() const
GetRange.
Definition: SigmoidFunction.hh:58