-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhw3c_beefy.py
29 lines (24 loc) · 900 Bytes
/
hw3c_beefy.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
from cppn_encoding import *
def main():
### GENETIC ALGORITHM
# (depth, N, pop_size, num_gens, T, dt = 0.0001, p = 0.5, mutat_prob = 0.05, damping=0.05,
# constant_max = 1):
depth = 6
N = 10
side_length = 1
pop_size = 50
num_gens = 100
T = 5
dt = 0.0001
truncation_p = 0.5
mutation_prob = 0.25
damping = 0.05
results = genetic_programming(depth, N, pop_size, num_gens, T, dt = dt,
p = truncation_p, mutat_prob = mutation_prob,
damping = damping, side_length = side_length)
population, best_dist_list, best_genome_list, diversity_list = results
print(f'best dist list:{best_dist_list}\n')
print(f'best genome list:{best_genome_list}\n')
print(f'diversity list:{diversity_list}\n')
if __name__ == '__main__':
main()