Code Duplication    Length = 13-13 lines in 2 locations

NiaPy/algorithms/basic/de.py 1 location

@@ 918-930 (lines=13) @@
915
		d.update({'strategies': self.strategies})
916
		return d
917
918
	def evolve(self, pop, xb, task, **kwargs):
919
		r"""Evolve population with the help multiple mutation strategies.
920
921
		Args:
922
			pop (numpy.ndarray): Current population.
923
			xb (numpy.ndarray): Current best individual.
924
			task (Task): Optimization task.
925
			**kwargs (Dict[str, Any]): Additional arguments.
926
927
		Returns:
928
			numpy.ndarray: New population of individuals.
929
		"""
930
		return objects2array([self.CrossMutt(pop, i, xb, self.F, self.CR, self.Rand, task, self.itype, self.strategies) for i in range(len(pop))])
931
932
class DynNpMultiStrategyDifferentialEvolution(MultiStrategyDifferentialEvolution, DynNpDifferentialEvolution):
933
	r"""Implementation of Dynamic population size Differential evolution algorithm with dynamic population size that is defined by the quality of population.

NiaPy/algorithms/modified/jde.py 1 location

@@ 366-378 (lines=13) @@
363
		SelfAdaptiveDifferentialEvolution.setParameters(self, CrossMutt=kwargs.pop('CrossMutt', multiMutations), **kwargs)
364
		self.strategies = strategies
365
366
	def evolve(self, pop, xb, task, **kwargs):
367
		r"""Evolve population with the help multiple mutation strategies.
368
369
		Args:
370
			pop (numpy.ndarray[Individual]): Current population.
371
			xb (Individual): Current best individual.
372
			task (Task): Optimization task.
373
			**kwargs (Dict[str, Any]): Additional arguments.
374
375
		Returns:
376
			numpy.ndarray[Individual]: New population of individuals.
377
		"""
378
		return objects2array([self.CrossMutt(pop, i, xb, self.F, self.CR, self.Rand, task, self.itype, self.strategies) for i in range(len(pop))])
379
380
class DynNpMultiStrategySelfAdaptiveDifferentialEvolution(MultiStrategySelfAdaptiveDifferentialEvolution, DynNpSelfAdaptiveDifferentialEvolutionAlgorithm):
381
	r"""Implementation of Dynamic population size self-adaptive differential evolution algorithm with multiple mutation strategies.