Class: FeldtRuby::Optimize::Archive::WeirdoTopList

Inherits:
GlobalTopList show all
Defined in:
lib/feldtruby/optimize/archive.rb

Instance Method Summary collapse

Methods inherited from GlobalTopList

#[], #add, #delete_candidates, #each, #inspect, #is_better_than?, #length, #sort_top_list, #to_json

Constructor Details

#initialize(maxSize, diversityObjective, qualityObjective) ⇒ WeirdoTopList

Returns a new instance of WeirdoTopList.



208
209
210
211
# File 'lib/feldtruby/optimize/archive.rb', line 208

def initialize(maxSize, diversityObjective, qualityObjective)
  super(maxSize, diversityObjective)
  @quality_objective = qualityObjective
end

Instance Method Details

#data_to_json_hashObject



213
214
215
216
217
218
219
220
# File 'lib/feldtruby/optimize/archive.rb', line 213

def data_to_json_hash
  h = super()
  # Since the diversity objective is used to sort the weirdos their
  # 'quality_values' are actually the diversity quality values.
  h['diversity_quality_values'] = h['quality_values']
  h['quality_values'] = @top_list.map {|c| @quality_objective.quality_of(c)}
  h
end