eckity.creators.creator

 1from abc import abstractmethod
 2
 3from eckity.event_based_operator import Operator
 4from eckity.fitness.simple_fitness import SimpleFitness
 5
 6
 7class Creator(Operator):
 8	def __init__(self, events=None, fitness_type=SimpleFitness):
 9		super().__init__(events)
10		self.created_individuals = None
11		self.fitness_type = fitness_type
12
13	@abstractmethod
14	def create_individuals(self, n_individuals, higher_is_better):
15		pass
16
17	def apply_operator(self, payload):
18		return self.create_individuals(payload)
19
20	def event_name_to_data(self, event_name):
21		if event_name == "after_operator":
22			return {"created_individuals": self.created_individuals}
23		else:
24			return {}
class Creator(eckity.event_based_operator.Operator):
 8class Creator(Operator):
 9	def __init__(self, events=None, fitness_type=SimpleFitness):
10		super().__init__(events)
11		self.created_individuals = None
12		self.fitness_type = fitness_type
13
14	@abstractmethod
15	def create_individuals(self, n_individuals, higher_is_better):
16		pass
17
18	def apply_operator(self, payload):
19		return self.create_individuals(payload)
20
21	def event_name_to_data(self, event_name):
22		if event_name == "after_operator":
23			return {"created_individuals": self.created_individuals}
24		else:
25			return {}
Creator( events=None, fitness_type=<class 'eckity.fitness.simple_fitness.SimpleFitness'>)
 9	def __init__(self, events=None, fitness_type=SimpleFitness):
10		super().__init__(events)
11		self.created_individuals = None
12		self.fitness_type = fitness_type
created_individuals
fitness_type
@abstractmethod
def create_individuals(self, n_individuals, higher_is_better):
14	@abstractmethod
15	def create_individuals(self, n_individuals, higher_is_better):
16		pass
def apply_operator(self, payload):
18	def apply_operator(self, payload):
19		return self.create_individuals(payload)
def event_name_to_data(self, event_name):
21	def event_name_to_data(self, event_name):
22		if event_name == "after_operator":
23			return {"created_individuals": self.created_individuals}
24		else:
25			return {}