Class: DRP::SearchAlgorithms::PSO::InteractiveParticleSwarmOptimizer

Inherits:
AbstractParticleSwarmOptimizer show all
Defined in:
lib/pso.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractParticleSwarmOptimizer

#global_best_error, #global_best_vector

Instance Method Summary collapse

Constructor Details

#initialize(swarm_size, vector_size, rebirth = 0.0) ⇒ InteractiveParticleSwarmOptimizer

Returns a new instance of InteractiveParticleSwarmOptimizer.



100
101
102
103
# File 'lib/pso.rb', line 100

def initialize swarm_size, vector_size, rebirth = 0.0
  super
  init_particles InteractiveParticle
end

Instance Attribute Details

#particlesObject (readonly)

Returns the value of attribute particles.



98
99
100
# File 'lib/pso.rb', line 98

def particles
  @particles
end

Instance Method Details

#eachObject



104
105
106
107
108
# File 'lib/pso.rb', line 104

def each
  @particles.each do |p|
    yield p
  end
end

#reinit_allObject



112
113
114
# File 'lib/pso.rb', line 112

def reinit_all
  each { |p| p.init_vector }
end

#roam_allObject



109
110
111
# File 'lib/pso.rb', line 109

def roam_all
  each { |p| p.roam }
end