Class: MinSingleObjectiveFunc

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

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 MinContinousFunction

#dimensions, #domain_as_mins_maxs, #domain_per_dimension, #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(x) ⇒ Object

Subclasses must implement this which is the function to be minimized.

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/feldtruby/optimize/problems/single_objective_problems.rb', line 44

def calc_func(x)
  raise NotImplementedError
end

#min_solutionsObject

Known optima that gives the minimum value. Default is that it is at 0,…,0.



35
36
37
# File 'lib/feldtruby/optimize/problems/single_objective_problems.rb', line 35

def min_solutions
  @min_solutions ||= ([[0.0] * dimensions])
end

#minimumObject

Known minimum (or nil if not known). Default is at 0.0.



30
31
32
# File 'lib/feldtruby/optimize/problems/single_objective_problems.rb', line 30

def minimum
  0.0
end

#objective_min_func(x) ⇒ Object



39
40
41
# File 'lib/feldtruby/optimize/problems/single_objective_problems.rb', line 39

def objective_min_func(x)
  calc_func(x) - minimum
end