class MetaheuristicAlgorithms::FireflyAlgorithm::Firefly

Note: May be able to use Struct for this purpose, moving update_light_intensity method to FireflyAlgorithm class.

Attributes

light_intensity[RW]
location_coordinates[RW]

Public Class Methods

new(function_wrapper, location_coordinates, light_intensity) click to toggle source
# File lib/metaheuristic_algorithms/firefly_algorithm.rb, line 16
def initialize(function_wrapper, location_coordinates, light_intensity)
  @function_wrapper = function_wrapper
  @location_coordinates = location_coordinates
  @light_intensity = light_intensity
end

Public Instance Methods

deep_clone() click to toggle source
# File lib/metaheuristic_algorithms/firefly_algorithm.rb, line 26
def deep_clone
  clone_object = self.clone
  clone_object.location_coordinates = self.location_coordinates.clone
  clone_object
end
update_light_intensity() click to toggle source
# File lib/metaheuristic_algorithms/firefly_algorithm.rb, line 22
def update_light_intensity
  @light_intensity = @function_wrapper.objective_function_value(@location_coordinates).to_f
end