Skip to main content

NegativeReinforcement

Struct NegativeReinforcement 

Source
pub struct NegativeReinforcement<T> { /* private fields */ }
Expand description

Velocity update with negative reinforcement, global and current best and worst positions. v_i = xi * (v_i + phi_best_personal * rb_p * (p_best_i - x_i) + phi_best_current * rb_c * (c_best_i - x_i) + phi_best_global * rb_g * (g_best_i - x_i) - phi_worst_personal * rw_p * (p_worst_i - x_i) - phi_worst_current * rw_c * (c_worst_i - x_i) - phi_worst_global * rw_g * (g_worst_i - x_i))

v_i - velocity projection for dimension i, p_best_i - personal best coordinate, c_best_i - best coordinate for current swarm, g_best_i - global best coordinate, p_worst_i - personal worst coordinate, c_worst_i - worst coordinate for current swarm, g_worst_i - global worst coordinate, xi - parameter, x_i - current coordinate, phi_best_personal, phi_best_current, phi_best_global, phi_worst_personal, phi_worst_current, phi_worst_global - parameters, rb_p, rb_c, rb_g, rw_p, rw_c, rw_g - random values in (0, 1),

Implementations§

Source§

impl<T> NegativeReinforcement<T>

Source

pub fn new( phi_best_personal: T, phi_best_current: T, phi_best_global: T, phi_worst_personal: T, phi_worst_current: T, phi_worst_global: T, xi: T, ) -> Self

Trait Implementations§

Source§

impl<T: NumCast + Num + Copy> VelocityCalculator<T> for NegativeReinforcement<T>

Source§

fn calc_new_velocity( &mut self, swarm: &Swarm<T>, particle: &Particle<T>, ) -> Vec<T>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V