Method: Algorithms::SimulatedAnnealing#initialize

Defined in:
lib/algorithms/simulated_annealing.rb

#initialize(opts) ⇒ SimulatedAnnealing

Example:

obj = MySimulatedAnnealingObject.new

SimulatedAnnealing.new(
  :support             => obj,
  :global_threshold    => 200,
  :step_multiplicator  => 0.63,
  :initial_temperature => 10,
  :initial_cost        => obj.cost,
  :iteration_modulus   => 500,      # display status once a 500
  :step_modulus        => 5000      # change the temperature once a 5000
)


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/algorithms/simulated_annealing.rb', line 33

def initialize ( opts )
  @support = opts[:support]
  @global_threshold = opts[:global_threshold] ||
     opts[:global_thresold] # :) backward compatibility
  @step_multiplicator = opts[:step_multiplicator]
  @temperature = opts[:initial_temperature]
  @cur_cost = opts[:initial_cost]
  @output = opts[:output] || STDOUT
  @iteration_modulus = opts[:iteration_modulus] || 1
  @step_modulus = opts[:step_modulus] || 1
  @generator = opts[:generator]
  @iteration_max = opts[:iteration_max] || (1.0 / 0.0) # Infinity
  @progression = ' '
  @diff_cost = 0
  @iteration = 0
  @probability_threshold = 0
  @argmin = @support.copy_of_the_current_solution
  @min = @cur_cost
end