change repo structure; modify readme
This commit is contained in:
45
tensorneat/algorithm/base.py
Normal file
45
tensorneat/algorithm/base.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from utils import State
|
||||
|
||||
|
||||
class BaseAlgorithm:
|
||||
|
||||
def setup(self, randkey):
|
||||
"""initialize the state of the algorithm"""
|
||||
|
||||
raise NotImplementedError
|
||||
|
||||
def ask(self, state: State):
|
||||
"""require the population to be evaluated"""
|
||||
raise NotImplementedError
|
||||
|
||||
def tell(self, state: State, fitness):
|
||||
"""update the state of the algorithm"""
|
||||
raise NotImplementedError
|
||||
|
||||
def transform(self, individual):
|
||||
"""transform the genome into a neural network"""
|
||||
raise NotImplementedError
|
||||
|
||||
def forward(self, inputs, transformed):
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def num_inputs(self):
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def num_outputs(self):
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def pop_size(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def member_count(self, state: State):
|
||||
# to analysis the species
|
||||
raise NotImplementedError
|
||||
|
||||
def generation(self, state: State):
|
||||
# to analysis the algorithm
|
||||
raise NotImplementedError
|
||||
|
||||
Reference in New Issue
Block a user