-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.py
41 lines (36 loc) · 1.34 KB
/
constants.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
''' Global Inputs '''
WORKSTATION_JSON = 'Workstations075.json'
EVOLUTION_CYCLES = 10
FIELD_SIZE = 30
DRAW_EVERY_CYCLE = False
SHOW_PRODUCT_PATH = False
TIME_PER_STEP = 0
FADE = False
''' Evolutionary Optimizer Constants '''
POPULATION_SIZE = 50
SELECTION_FACTOR = 0.2 # Linear probability of distribution
MUTATION_FACTOR = 0.4
RECOMBINATION_FACTOR = 0.4
DIVERGENCE_COMPARISON_COUNT = 3
''' Product Optimizer Constants '''
COEVOLUTION_ON = True
PRODUCTS_PER_LIST = 10
PRODUCTS_PATH_LENGTH = 7
LISTS_PER_GENERATION = 5
PRODUCTS_SELECTION_FACTOR = 0.5
PRODUCTS_MUTATION_FACTOR = 0.4
PRODUCTS_RECOMBINATION_FACTOR = 0.4
DIVERGENCE_COMPARISON_COUNT = 3
# DO NOT CHANGE THIS
if not COEVOLUTION_ON:
LISTS_PER_GENERATION = 1
PRODUCTS_MUTATION_FACTOR = 0
def getConstantsDict():
'''Helper function putting all consts into a dict'''
constantNames = ['WORKSTATION_JSON', 'EVOLUTION_CYCLES', 'FIELD_SIZE',
'POPULATION_SIZE', 'SELECTION_FACTOR', 'MUTATION_FACTOR',
'RECOMBINATION_FACTOR', 'DIVERGENCE_COMPARISON_COUNT',
'COEVOLUTION_ON', 'PRODUCTS_PER_LIST', 'PRODUCTS_PATH_LENGTH',
'LISTS_PER_GENERATION', 'PRODUCTS_SELECTION_FACTOR',
'PRODUCTS_MUTATION_FACTOR', 'PRODUCTS_RECOMBINATION_FACTOR']
return dict((name, eval(name)) for name in constantNames)