Class: MinEggHolder

Inherits:
Min2DSingleObjectiveFunc show all
Defined in:
lib/feldtruby/optimize/problems/single_objective_problems.rb

Overview

EggHolder function as stated on the page:

http://en.wikipedia.org/wiki/Test_functions_for_optimization

It says that it has a minima at:

f(512, 404.2319) = -959.6407

but our DE finds a better one! Note sure why!

Instance Attribute Summary

Attributes inherited from FeldtRuby::Optimize::Objective

#best_candidate, #current_version, #global_max_values_per_goal, #global_min_values_per_goal

Attributes included from FeldtRuby::Logging

#logger

Instance Method Summary collapse

Methods inherited from Min2DSingleObjectiveFunc

#dimensions

Methods inherited from MinSingleObjectiveFunc

#objective_min_func

Methods inherited from MinContinousFunction

#dimensions, #domain_as_mins_maxs, #search_space

Methods inherited from FeldtRuby::Optimize::Objective

#aggregated_quality, #calculate_sub_qualities_of, #goal_methods, #hat_compare, #initialize, #invalidate_quality_of, #is_better_than?, #is_better_than_for_goal?, #is_goal_method?, #is_min_goal?, #is_min_goal_method?, #map_candidate_to_object_to_be_evaluated, #note_end_of_optimization, #num_goals, #quality_of, #rank_candidates, #sub_qualities_of, #weights, #weights=

Methods included from FeldtRuby::Logging

#__find_logger_set_on_instance_vars, #new_default_logger, #setup_logger_and_distribute_to_instance_variables

Constructor Details

This class inherits a constructor from FeldtRuby::Optimize::Objective

Instance Method Details

#calc_func(candidate) ⇒ Object



184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/feldtruby/optimize/problems/single_objective_problems.rb', line 184

def calc_func(candidate)
  x, y = candidate[0], candidate[1]

  f1 = y + 47.0
  f2 = Math.sin( Math.sqrt( (y + (x/2.0) + 47.0).abs ) )
  t1 = (-f1)*f2

  f3 = Math.sin( Math.sqrt( (x - (y + 47.0)).abs ) )
  t2 = (-x) * f3

  t1 - t2
end

#domain_per_dimensionObject



180
181
182
# File 'lib/feldtruby/optimize/problems/single_objective_problems.rb', line 180

def domain_per_dimension
  [-512.0, 512.0]
end

#min_solutionsObject



175
176
177
178
# File 'lib/feldtruby/optimize/problems/single_objective_problems.rb', line 175

def min_solutions
  # [[512, 404.2319]]
  [[495.6221190220226, 426.3549675681817]]
end

#minimumObject



170
171
172
173
# File 'lib/feldtruby/optimize/problems/single_objective_problems.rb', line 170

def minimum
  # -959.6407
  -963.5808501270571
end