-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
35 lines (28 loc) · 1.23 KB
/
main.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
from algorithms.evolution_strategy import EvolutionStrategy
from reporters.best_individual_reporter import BestIndividualReporter
from evaluators.breezy.breezy import BreezyEvaluator
from evaluators.breezy.reinforcers import last_hit, win
from mutations.cgp.smart_mutation import CGPSmartMutation
from genotypes.cgp.cgp import CGPIndividual
from genotypes.individual import IndividualGenerator
def main():
evaluator = BreezyEvaluator((last_hit.LastHitReinforcer(), win.WinReinforcer()),
listener_address=('127.0.0.1', 8088),
breezy_url='http://127.0.0.1:8085')
reporters = [BestIndividualReporter()]
cgp_hyperparams = {
'input_len': evaluator.input_len,
'grid_size': (50, 30),
'output_len': evaluator.output_len,
'constant_len': 4
}
generator = IndividualGenerator(CGPIndividual, cgp_hyperparams)
mutation = CGPSmartMutation(n=4)
max_iterations = 0
parent_count = 2
children_count = 4
alg = EvolutionStrategy(reporters, max_iterations, evaluator, generator,
parent_count, children_count, mutation, elitism=True, target_fitness=1000000)
alg.run()
if __name__ == "__main__":
main()