Class: Evolvable::MaximizeGoal
- Defined in:
- lib/evolvable/maximize_goal.rb
Overview
Prioritizes instances with greater values. This is the default.
The default goal value is Float::INFINITY
, but it can be reassigned
to any numeric value.
Direct Known Subclasses
Instance Method Summary collapse
Methods inherited from Goal
Constructor Details
This class inherits a constructor from Evolvable::Goal
Instance Method Details
#evaluate(evolvable) ⇒ Object
15 16 17 |
# File 'lib/evolvable/maximize_goal.rb', line 15 def evaluate(evolvable) evolvable.value end |
#met?(evolvable) ⇒ Boolean
19 20 21 |
# File 'lib/evolvable/maximize_goal.rb', line 19 def met?(evolvable) evolvable.value >= value end |
#value ⇒ Object
11 12 13 |
# File 'lib/evolvable/maximize_goal.rb', line 11 def value @value ||= Float::INFINITY end |