class MHL::GenericSwarmBehavior

Constants

DEFAULT_ALPHA

alpha is the contraction-expansion (CE) coefficient for quantum particles [SUN11]. In order for the QPSO algorithm to converge, alpha must be lower than $e^{gamma} approx 1.781$, where $gamma approx 0.5772156649$ is the Euler constant. According to [SUN11], 0.75 looks like a sensible default parameter.

DEFAULT_C1

The following values are considered a best practice [SUN11] [CLERC02] [BLACKWELLBRANKE04]. C_1 is the cognitive acceleration coefficient

DEFAULT_C2

C_2 is the social acceleration coefficient

DEFAULT_CHI
PHI

chi is the constraining factor for normal particles

Public Instance Methods

update_attractor() click to toggle source
# File lib/mhl/generic_swarm.rb, line 29
def update_attractor
  # get the particle attractors
  particle_attractors = @particles.map { |p| p.attractor }

  # update swarm attractor (if needed)
  unless (defined?(@swarm_attractor))
    @swarm_attractor = particle_attractors.max_by {|p| p[:height] }
  else
    @swarm_attractor = [ @swarm_attractor, *particle_attractors ].max_by {|p| p[:height] }
  end

  @swarm_attractor
end