Method: EvoSynth::Profile#initialize
- Defined in:
- lib/evosynth/core/profile.rb
#initialize(*properties) ⇒ Profile
Creates a new Profile using a given hash of symbols and values.
usage:
profile = EvoSynth::Profile.new(
:individual => MaxOnes.create_individual,
:population => EvoSynth::Population.new(POP_SIZE) { MaxOnes.create_individual },
:evaluator => MaxOnes::MaxOnesEvaluator.new,
:mutation => EvoSynth::Mutations::BinaryMutation.new(EvoSynth::Mutations::Functions::FLIP_BOOLEAN)
)
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/evosynth/core/profile.rb', line 43 def initialize(*properties) @properties = {} properties.each do |property| if property.is_a?(Symbol) add_symbol(property, nil) elsif property.is_a?(Hash) add_hash(property) else raise ArgumentError, "argument type not supported" end end end |