Optimist  0.0.0
A C++ library for optimization
Loading...
Searching...
No Matches
Optimist::Optimizer::LinearDecrease< Scalar > Class Template Reference

Inertia weight functor, which decreases linearly over time. More...

#include <ParticleSwarm.hh>

Public Member Functions

 LinearDecrease ()
 LinearDecrease (const Scalar min_weight, const Scalar max_weight)
Scalar operator() (const Integer iteration, const Integer max_iterations) const

Private Attributes

Scalar m_min_weight {0.4}
Scalar m_max_weight {0.9}

Detailed Description

template<typename Scalar>
class Optimist::Optimizer::LinearDecrease< Scalar >
Template Parameters
ScalarFloating-point number type. The inertia weight is calculated by the following formula:

\[ w = w_{\min} + (w_{\max} - w_{\min}) * \displaystyle\frac{t}{t_{\max}} \text{.} \]

Constructor & Destructor Documentation

◆ LinearDecrease() [1/2]

template<typename Scalar>
Optimist::Optimizer::LinearDecrease< Scalar >::LinearDecrease ( )
inline

Class class onstructor with default minimum and maximum weights equal to 0.4 and 0.9, respectively.

◆ LinearDecrease() [2/2]

template<typename Scalar>
Optimist::Optimizer::LinearDecrease< Scalar >::LinearDecrease ( const Scalar min_weight,
const Scalar max_weight )
inline

Class constructor that accepts the minimum and maximum weight of the linear decrease.

Parameters
[in]min_weightLower bound of the inertia weight.
[in]max_weightUpper bound of the inertia weight.

Member Function Documentation

◆ operator()()

template<typename Scalar>
Scalar Optimist::Optimizer::LinearDecrease< Scalar >::operator() ( const Integer iteration,
const Integer max_iterations ) const
inline

Get the inertia weight.

Parameters
[in]iterationCurrent iteration.
[in]max_iterationsMaximum number of iterations.
Returns
The inertia weight.

Member Data Documentation

◆ m_max_weight

template<typename Scalar>
Scalar Optimist::Optimizer::LinearDecrease< Scalar >::m_max_weight {0.9}
private

Maximum inertia weight.

◆ m_min_weight

template<typename Scalar>
Scalar Optimist::Optimizer::LinearDecrease< Scalar >::m_min_weight {0.4}
private

Minimum inertia weight.


The documentation for this class was generated from the following file: