Class: FeldtRuby::Optimize::Objective::QualityAggregator

Inherits:
Object
  • Object
show all
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

WeightedSumAggregator

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#objectiveObject

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