eckity.evaluators.individual_evaluator

 1from overrides import overrides
 2
 3from eckity.event_based_operator import Operator
 4
 5
 6class IndividualEvaluator(Operator):
 7
 8	def evaluate(self, individual, environment_individuals):
 9		"""
10		Updates the fitness score of the given individuals, then returns the best individual
11
12		Parameters
13		----------
14		individual: Individual
15			the current individual to evaluate its fitness
16
17		environment_individuals: list of Individuals
18			the individuals in the current individual's environment
19			those individuals will affect the current individual's fitness
20
21		Returns
22		-------
23		Individual
24			the individual with the best fitness out of the given individuals
25		"""
26		self.applied_individuals = [individual]
27
28	@overrides
29	def apply_operator(self, payload):
30		return self.evaluate(payload[0], payload[1])
class IndividualEvaluator(eckity.event_based_operator.Operator):
 7class IndividualEvaluator(Operator):
 8
 9	def evaluate(self, individual, environment_individuals):
10		"""
11		Updates the fitness score of the given individuals, then returns the best individual
12
13		Parameters
14		----------
15		individual: Individual
16			the current individual to evaluate its fitness
17
18		environment_individuals: list of Individuals
19			the individuals in the current individual's environment
20			those individuals will affect the current individual's fitness
21
22		Returns
23		-------
24		Individual
25			the individual with the best fitness out of the given individuals
26		"""
27		self.applied_individuals = [individual]
28
29	@overrides
30	def apply_operator(self, payload):
31		return self.evaluate(payload[0], payload[1])
def evaluate(self, individual, environment_individuals):
 9	def evaluate(self, individual, environment_individuals):
10		"""
11		Updates the fitness score of the given individuals, then returns the best individual
12
13		Parameters
14		----------
15		individual: Individual
16			the current individual to evaluate its fitness
17
18		environment_individuals: list of Individuals
19			the individuals in the current individual's environment
20			those individuals will affect the current individual's fitness
21
22		Returns
23		-------
24		Individual
25			the individual with the best fitness out of the given individuals
26		"""
27		self.applied_individuals = [individual]

Updates the fitness score of the given individuals, then returns the best individual

Parameters
  • individual (Individual): the current individual to evaluate its fitness
  • environment_individuals (list of Individuals): the individuals in the current individual's environment those individuals will affect the current individual's fitness
Returns
  • Individual: the individual with the best fitness out of the given individuals
@overrides
def apply_operator(self, payload):
29	@overrides
30	def apply_operator(self, payload):
31		return self.evaluate(payload[0], payload[1])