Method: MHL::PSOSwarm#mutate

Defined in:
lib/mhl/pso_swarm.rb

#mutate(params = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/mhl/pso_swarm.rb', line 36

def mutate(params={})
  # get chi parameter
  chi = @get_chi.call(@iteration)

  # move particles
  @particles.each_with_index do |p,i|
    p.move(chi, @c1, @c2, @swarm_attractor)
    if @constraints
      p.remain_within(@constraints)
    end
  end

  @iteration += 1
end