mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2025-10-21 20:00:35 +00:00
feat(ai): add config
This commit is contained in:
parent
932dea1676
commit
96802195cb
79
config.txt
Normal file
79
config.txt
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
[NEAT]
|
||||||
|
fitness_criterion = max
|
||||||
|
fitness_threshold = 10
|
||||||
|
pop_size = 50
|
||||||
|
reset_on_extinction = False
|
||||||
|
|
||||||
|
[DefaultGenome]
|
||||||
|
# node activation options
|
||||||
|
activation_default = relu
|
||||||
|
activation_mutate_rate = 0.0
|
||||||
|
activation_options = relu
|
||||||
|
|
||||||
|
# node aggregation options
|
||||||
|
aggregation_default = sum
|
||||||
|
aggregation_mutate_rate = 0.0
|
||||||
|
aggregation_options = sum
|
||||||
|
|
||||||
|
# node bias options
|
||||||
|
bias_init_mean = 0.0
|
||||||
|
bias_init_stdev = 1.0
|
||||||
|
bias_max_value = 30.0
|
||||||
|
bias_min_value = -30.0
|
||||||
|
bias_mutate_power = 0.5
|
||||||
|
bias_mutate_rate = 0.7
|
||||||
|
bias_replace_rate = 0.1
|
||||||
|
|
||||||
|
# genome compatibility options
|
||||||
|
compatibility_disjoint_coefficient = 1.0
|
||||||
|
compatibility_weight_coefficient = 0.5
|
||||||
|
|
||||||
|
# connection add/remove rates
|
||||||
|
conn_add_prob = 0.5
|
||||||
|
conn_delete_prob = 0.5
|
||||||
|
|
||||||
|
# connection enable options
|
||||||
|
enabled_default = True
|
||||||
|
enabled_mutate_rate = 0.01
|
||||||
|
|
||||||
|
feed_forward = True
|
||||||
|
initial_connection = full_direct
|
||||||
|
|
||||||
|
# node add/remove rates
|
||||||
|
node_add_prob = 0.2
|
||||||
|
node_delete_prob = 0.2
|
||||||
|
|
||||||
|
# network parameters
|
||||||
|
num_hidden = 2
|
||||||
|
num_inputs = 200
|
||||||
|
num_outputs = 5
|
||||||
|
|
||||||
|
# node response options
|
||||||
|
response_init_mean = 1.0
|
||||||
|
response_init_stdev = 0.0
|
||||||
|
response_max_value = 30.0
|
||||||
|
response_min_value = -30.0
|
||||||
|
response_mutate_power = 0.0
|
||||||
|
response_mutate_rate = 0.0
|
||||||
|
response_replace_rate = 0.0
|
||||||
|
|
||||||
|
# connection weight options
|
||||||
|
weight_init_mean = 0.0
|
||||||
|
weight_init_stdev = 1.0
|
||||||
|
weight_max_value = 30
|
||||||
|
weight_min_value = -30
|
||||||
|
weight_mutate_power = 0.5
|
||||||
|
weight_mutate_rate = 0.8
|
||||||
|
weight_replace_rate = 0.1
|
||||||
|
|
||||||
|
[DefaultSpeciesSet]
|
||||||
|
compatibility_threshold = 3.0
|
||||||
|
|
||||||
|
[DefaultStagnation]
|
||||||
|
species_fitness_func = max
|
||||||
|
max_stagnation = 20
|
||||||
|
species_elitism = 2
|
||||||
|
|
||||||
|
[DefaultReproduction]
|
||||||
|
elitism = 2
|
||||||
|
survival_threshold = 0.2
|
||||||
13
src/ai/config.py
Normal file
13
src/ai/config.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import neat
|
||||||
|
from utils import BASE_PATH
|
||||||
|
|
||||||
|
|
||||||
|
def get_config() -> neat.Config:
|
||||||
|
config_path = BASE_PATH / "config.txt"
|
||||||
|
return neat.Config(
|
||||||
|
neat.DefaultGenome,
|
||||||
|
neat.DefaultReproduction,
|
||||||
|
neat.DefaultSpeciesSet,
|
||||||
|
neat.DefaultStagnation,
|
||||||
|
config_path,
|
||||||
|
)
|
||||||
Loading…
Reference in New Issue
Block a user