class YAGA::Population(T, V)
- YAGA::Population(T, V)
- Reference
- Object
Defined in:
yaga/population.crConstant Summary
-
MUTATION_PERCENT =
10_u8
-
PERCENT_RANGE =
1_u8..100_u8
-
SELECTION_BOTS =
8_u32
-
SIMULATIONS_HISTORY =
400_u64
-
TOTAL_BOTS =
64_u32
Constructors
- .new(total_bots : UInt32 = TOTAL_BOTS, selection_bots : UInt32 = SELECTION_BOTS, mutation_percent : UInt8 = MUTATION_PERCENT, crossover_enabled : Bool = true, random : Random = Random::DEFAULT, &)
- .new(total_bots : UInt32 = TOTAL_BOTS, selection_bots : UInt32 = SELECTION_BOTS, mutation_percent : UInt8 = MUTATION_PERCENT, crossover_enabled : Bool = true, random : Random = Random::DEFAULT)
Instance Method Summary
- #after_evolution(&block : UInt64 -> Void) : Void
- #after_simulation(&block : UInt64, Bool -> Void) : Void
- #after_training(&block : UInt64, V, UInt64 -> Void) : Void
- #before_evolution(&block : UInt64 -> Void) : Void
- #before_simulation(&block : UInt64, Bool -> Void) : Void
- #before_training(&block : UInt64, V, UInt64 -> Void) : Void
- #bots
-
#crossover : Void
Crossover specific amount of bots with best selection
-
#evolve!(native : Bool = false) : Void
Usually it is not needed to call this method explicitly But there are no restrictions about that Do not use argument
native
, it is only for internal usage Or selection will not be collected -
#finalize_evolution : Void
Reset lask part of bots to prevent stagnation
- #fitness_history
- #generation
- #generation=(generation : UInt64)
-
#mutate : Void
Mutate specific amount of bots out of selection
- #selection
- #selection_bots
- #simulate_each(&block : Bot(T, V), UInt64 -> Void) : Void
- #simulate_world(&block : Array(Bot(T, V)), UInt64 -> Void) : Void
- #total_bots
- #train_each(goal : V, generation_cap : UInt64 = 10000_u64, &block : Bot(T, V), UInt64 -> V) : UInt64
- #train_world(goal : V, generation_cap : UInt64 = 10000_u64, &block : Array(Bot(T, V)), UInt64 -> Void) : UInt64
Constructor Detail
def self.new(total_bots : UInt32 = TOTAL_BOTS, selection_bots : UInt32 = SELECTION_BOTS, mutation_percent : UInt8 = MUTATION_PERCENT, crossover_enabled : Bool = true, random : Random = Random::DEFAULT, &)
#
def self.new(total_bots : UInt32 = TOTAL_BOTS, selection_bots : UInt32 = SELECTION_BOTS, mutation_percent : UInt8 = MUTATION_PERCENT, crossover_enabled : Bool = true, random : Random = Random::DEFAULT)
#
Instance Method Detail
def evolve!(native : Bool = false) : Void
#
Usually it is not needed to call this method explicitly
But there are no restrictions about that
Do not use argument native
, it is only for internal usage
Or selection will not be collected
def train_each(goal : V, generation_cap : UInt64 = 10000_u64, &block : Bot(T, V), UInt64 -> V) : UInt64
#