Code Duplication    Length = 17-20 lines in 2 locations

NiaPy/algorithms/basic/fwa.py 1 location

@@ 621-637 (lines=17) @@
618
		"""
619
		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"""
620
621
	@staticmethod
622
	def typeParameters():
623
		r"""Get dictionary with functions for checking values of parameters.
624
625
		Returns:
626
			Dict[str, Callable]:
627
				* A_cr (Callable[[Union[float, int], bool]): TODo
628
629
		See Also:
630
			* :func:`FireworksAlgorithm.typeParameters`
631
		"""
632
		d = FireworksAlgorithm.typeParameters()
633
		d['A_cf'] = lambda x: isinstance(x, (float, int)) and x > 0
634
		d['C_a'] = lambda x: isinstance(x, (float, int)) and x > 1
635
		d['C_r'] = lambda x: isinstance(x, (float, int)) and 0 < x < 1
636
		d['epsilon'] = lambda x: isinstance(x, (float, int)) and 0 < x < 1
637
		return d
638
639
	def setParameters(self, A_cf=20, C_a=1.2, C_r=0.9, epsilon=1e-8, **ukwargs):
640
		r"""Set core arguments of DynamicFireworksAlgorithmGauss.

NiaPy/algorithms/modified/jde.py 1 location

@@ 85-104 (lines=20) @@
82
		"""
83
		return r"""Brest, J., Greiner, S., Boskovic, B., Mernik, M., Zumer, V. Self-adapting control parameters in differential evolution: A comparative study on numerical benchmark problems. IEEE transactions on evolutionary computation, 10(6), 646-657, 2006."""
84
85
	@staticmethod
86
	def typeParameters():
87
		r"""Get dictionary with functions for checking values of parameters.
88
89
		Returns:
90
			Dict[str, Callable]:
91
				* F_l (Callable[[Union[float, int]], bool])
92
				* F_u (Callable[[Union[float, int]], bool])
93
				* Tao1 (Callable[[Union[float, int]], bool])
94
				* Tao2 (Callable[[Union[float, int]], bool])
95
96
		See Also:
97
			* :func:`NiaPy.algorithms.basic.DifferentialEvolution.typeParameters`
98
		"""
99
		d = DifferentialEvolution.typeParameters()
100
		d['F_l'] = lambda x: isinstance(x, (float, int)) and x > 0
101
		d['F_u'] = lambda x: isinstance(x, (float, int)) and x > 0
102
		d['Tao1'] = lambda x: isinstance(x, (float, int)) and 0 <= x <= 1
103
		d['Tao2'] = lambda x: isinstance(x, (float, int)) and 0 <= x <= 1
104
		return d
105
106
	def setParameters(self, F_l=0.0, F_u=1.0, Tao1=0.4, Tao2=0.2, **ukwargs):
107
		r"""Set the parameters of an algorithm.