Code Duplication    Length = 17-20 lines in 2 locations

NiaPy/algorithms/modified/jde.py 1 location

@@ 74-93 (lines=20) @@
71
	"""
72
	Name = ['SelfAdaptiveDifferentialEvolution', 'jDE']
73
74
	@staticmethod
75
	def typeParameters():
76
		r"""Get dictionary with functions for checking values of parameters.
77
78
		Returns:
79
			Dict[str, Callable]:
80
				* F_l (Callable[[Union[float, int]], bool])
81
				* F_u (Callable[[Union[float, int]], bool])
82
				* Tao1 (Callable[[Union[float, int]], bool])
83
				* Tao2 (Callable[[Union[float, int]], bool])
84
85
		See Also:
86
			* :func:`NiaPy.algorithms.basic.DifferentialEvolution.typeParameters`
87
		"""
88
		d = DifferentialEvolution.typeParameters()
89
		d['F_l'] = lambda x: isinstance(x, (float, int)) and x > 0
90
		d['F_u'] = lambda x: isinstance(x, (float, int)) and x > 0
91
		d['Tao1'] = lambda x: isinstance(x, (float, int)) and 0 <= x <= 1
92
		d['Tao2'] = lambda x: isinstance(x, (float, int)) and 0 <= x <= 1
93
		return d
94
95
	def setParameters(self, F_l=0.0, F_u=1.0, Tao1=0.4, Tao2=0.2, **ukwargs):
96
		r"""Set the parameters of an algorithm.

NiaPy/algorithms/basic/fwa.py 1 location

@@ 616-632 (lines=17) @@
613
		"""
614
		return r"""S. Zheng, A. Janecek, J. Li and Y. Tan, "Dynamic search in fireworks algorithm," 2014 IEEE Congress on Evolutionary Computation (CEC), Beijing, 2014, pp. 3222-3229. doi: 10.1109/CEC.2014.6900485"""
615
616
	@staticmethod
617
	def typeParameters():
618
		r"""Get dictionary with functions for checking values of parameters.
619
620
		Returns:
621
			Dict[str, Callable]:
622
				* A_cr (Callable[[Union[float, int], bool]): TODo
623
624
		See Also:
625
			* :func:`FireworksAlgorithm.typeParameters`
626
		"""
627
		d = FireworksAlgorithm.typeParameters()
628
		d['A_cf'] = lambda x: isinstance(x, (float, int)) and x > 0
629
		d['C_a'] = lambda x: isinstance(x, (float, int)) and x > 1
630
		d['C_r'] = lambda x: isinstance(x, (float, int)) and 0 < x < 1
631
		d['epsilon'] = lambda x: isinstance(x, (float, int)) and 0 < x < 1
632
		return d
633
634
	def setParameters(self, A_cf=20, C_a=1.2, C_r=0.9, epsilon=1e-8, **ukwargs):
635
		r"""Set core arguments of DynamicFireworksAlgorithmGauss.