-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
executable file
·91 lines (81 loc) · 4.29 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
"""
Configuration hyperparameters for balancing evolutionary process
__author__ = "Joe Sarsfield"
__email__ = "joe.sarsfield@gmail.com"
"""
import random
from enum import Enum
# TODO allow loading params from yaml config
# weight params
weight_max_value = 2
weight_min_value = -2
weight_mutate_rate = 0.2 # Chance of link weight being adjusted by value drawn from zero-centered normal distribution
weight_replace_rate = 0.002 # Chance of link weight being replaced with random value
weight_init_min = -2 # min value of weight initialisation range
weight_init_max = 2 # max value of weight initialisation range
uniform_weight_scale = 0.1 # Scale of gaussian function for adjusting gene link weights
# bias params / phase shift into act func
bias_max_value = 5
bias_min_value = -5
bias_mutate_rate = 0.1
bias_replace_rate = 0.002
bias_init_min = -0.5 # min value of bias initialisation range
bias_init_max = 0.5 # max value of bias initialisation range
# structural params
link_toggle_prob = 0.05 # Chance of link being toggled between enabled/disabled
link_add_prob = 0.1 # Chance of adding a new link
link_add_attempts = 10 # Number of attempts to find new link until give up
node_add_prob = 0.05
link_enable_prob = 0.2 # Chance of disabled link being re-enabled
new_link_attempts = 10 # How many attempts should we try and find a new node before giving up
change_act_prob = 0.05 # Chance of changing activation function to random act func
# act func coefficients
func_adjust_prob = 0.02
guass_freq_adjust = 0.02 # adjust function frequency
sin_freq_adjust = 0.02
func_amp_adjust = 0.02 # adjust function amplitude
func_vshift_adjust = 0.02 # adjust function vertical shift
func_amp_range = 4 # init ranges
gauss_freq_range = 1
sin_freq_range = 6
gauss_vshift_range = 0.5
sin_vshift_range = 0.1
# es-hyperneat params
init_var_thresh = 0.3
init_band_thresh = 0
var_mutate_prob = 0.05
band_mutate_prob = 0.05
#gauss_var_scale = 0.00001 # Scale of gaussian function for adjusting QuadTree variance threshold
#gauss_band_scale = 0.00001 # Scale of gaussian function for adjusting QuadTree band pruning threshold
quad_tree_max_depth = 10 # The max depth the quadtree will split if variance is still above variance threshold
substrate_search_max_time = 10 # max num of seconds to search for hid nodes on substrate before giving up and marking net as void
# substrate params
init_substrate_width_max = 16
init_substrate_height_max = 8
width_mutate_prob = 0.05
height_mutate_prob = 0.05
# reproduce params
compatibility_dist_init = 2 # Max distance two genomes can be considered as the same species
compatibility_adjust = 0.1 # Amount to adjust compatibility_dist each gen to achieve target num species
compatibility_excess_coeff = 1 # Balance the distance calculation against weights and disjoint genes
compatibility_disjoint_coeff = 2 # Balance the distance calculation against weights and excess genes
compatibility_weight_coeff = 2 # Balance the distance calculation against excess and disjoint genes
organisms_to_species_ratio = 6 # Average number of organisms per species to target.
species_survival_thresh = 0.3 # Fraction of species that is allowed to reproduce for next generation
interspecies_mating_prob = 0.15 # Chance of genome mating outside of species
genome_crossover_prob = 0.9 # chance of crossover with another genome instead of copy with mutation
# MAP-elites parameters
crossover_neighbour_elites = 16 # num of nearest neighbour elite genomes to consider for crossover (randomly selected)
diversity_coeff = 1 # increase/decrease the level of mutation based on species sizes and species ages
select_diverse_champs_prob = 0.1 # The probability of filling champs based on max genomic distance (encourages diversity)
num_evolution_champs = 15 # Number of all time champs to put back into the population after each generation
link_cost_coeff = 0.01 # coefficient cost for adjusting fitness based on number of links/connections in neural network
#elitism_thresh = 1 # Number of fittest organisms in each species that is preserved as-is to next generation
#min_species_size = 2 # min number of organisms/nets in a species
def event(x):
""" determine whether an event occurred given probability coefficient """
return False if random.random() > x else True
class Exec(Enum):
SERIAL = 1
PARALLEL_LOCAL = 2
PARALLEL_HPC = 3