Class: FeldtRuby::Optimize::Objective::QualityAggregator
- Defined in:
- lib/feldtruby/optimize/objective.rb
Overview
A QualityAggregator converts a vector of sub-quality values (for each individual goal of an objective) into a single number on which the candidates can be compared. Not every comparator uses the aggregated value to compare candidates though, but the default one does. This default aggregator is just a sum of the individual qualities where max goals are negated.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#objective ⇒ Object
Returns the value of attribute objective.
Instance Method Summary collapse
-
#aggregate_from_sub_qualities(subQualityValues, weights) ⇒ Object
Aggregate an array of sub_qualities into a single number given an array of weights.
- #make_quality_value(subQvs, candidate, objective) ⇒ Object
Instance Attribute Details
#objective ⇒ Object
Returns the value of attribute objective.
336 337 338 |
# File 'lib/feldtruby/optimize/objective.rb', line 336 def objective @objective end |
Instance Method Details
#aggregate_from_sub_qualities(subQualityValues, weights) ⇒ Object
Aggregate an array of sub_qualities into a single number given an array of weights. This default class just sums the quality values regardless of the weights.
351 352 353 |
# File 'lib/feldtruby/optimize/objective.rb', line 351 def aggregate_from_sub_qualities subQualityValues, weights subQualityValues.weighted_sum(@signs) end |
#make_quality_value(subQvs, candidate, objective) ⇒ Object
338 339 340 |
# File 'lib/feldtruby/optimize/objective.rb', line 338 def make_quality_value(subQvs, candidate, objective) QualityValue.new subQvs, candidate, objective end |