-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenome_structure.py
46 lines (29 loc) · 1.07 KB
/
genome_structure.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
class Block_Declaration():
def __init__(self, skeleton: Block_Definition):
# Inputs
self.input_dtypes = skeleton['input_dtypes']
self.input_count = len(self.input_dtypes)
# Outputs
self.output_dtypes = skeleton['output_dtypes']
self.output_count = skeleton[self.output_dtypes]
# Main
self.arg_count = skeleton['arg_count']
self.main_count = skeleton['main_count']
self.genome_count = self.main_count + self.input_count + self.output_dtypes
self.buildWeights('arg_methods', skeleton)
self.buildWeights('ftn_methods', skeleton)
self.buildWeights('mut_methods', skeleton)
self.buildWeights('mate_methods', skeleton)
def init_block(self, indiv: Block_Material, skeleton: Block_Definition):
# args
indiv.args = [None]*self.arg_count
self.fillArgs(indiv)
# genome
indiv.genome = [None]*self.genome_count
indiv.genome[(-1*self.input_count):] = ["InputPlaceholder"]*self.input_count
def fillArgs(self, indiv: Block_Material):
pass
def fillGenome(self, indiv: Block_Material):
pass
def buildWeights(self, skeleton: Block_Definition):
pass