Class: MinLevi13

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

Overview

This is Lévi function number 13 as stated on the page:

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

It has a global minima at f(1,1) = 0. -10 <= x,y <= 10

Constant Summary collapse

TwoPi =
2*Math::PI
ThreePi =
3*Math::PI

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

#minimum, #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



94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/feldtruby/optimize/problems/single_objective_problems.rb', line 94

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

  sin_3pi_x = Math.sin(ThreePi * x)
  sin_3pi_y = Math.sin(ThreePi * y)
  sin_2pi_y = Math.sin(TwoPi * y)
  x_min1 = x - 1.0
  y_min1 = y - 1.0

  (sin_3pi_x * sin_3pi_x) + 
    (x_min1 * x_min1) * (1 + (sin_3pi_y * sin_3pi_y)) +
    (y_min1 * y_min1) * (1 + (sin_3pi_y * sin_2pi_y))
end

#domain_per_dimensionObject



87
88
89
# File 'lib/feldtruby/optimize/problems/single_objective_problems.rb', line 87

def domain_per_dimension
  [-10.0, 10.0]
end

#min_solutionsObject



83
84
85
# File 'lib/feldtruby/optimize/problems/single_objective_problems.rb', line 83

def min_solutions
  [[1.0, 1.0]]
end