Code Duplication    Length = 7-18 lines in 3 locations

NiaPy/algorithms/basic/hs.py 1 location

@@ 58-73 (lines=16) @@
55
		"""
56
		return r"""Geem, Z. W., Kim, J. H., & Loganathan, G. V. (2001). A new heuristic optimization algorithm: harmony search. Simulation, 76(2), 60-68."""
57
58
	@staticmethod
59
	def typeParameters():
60
		r"""Get dictionary with functions for checking values of parameters.
61
62
		Returns:
63
			Dict[str, Callable]:
64
			* HMS (Callable[[int], bool])
65
			* r_accept (Callable[[float], bool])
66
		 	* r_pa (Callable[[float], bool])
67
			* b_range (Callable[[float], bool])
68
		"""
69
		return {
70
			"HMS": lambda x: isinstance(x, int) and x > 0,
71
			"r_accept": lambda x: isinstance(x, float) and 0 < x < 1,
72
			"r_pa": lambda x: isinstance(x, float) and 0 < x < 1,
73
			"b_range": lambda x: isinstance(x, (int, float)) and x > 0
74
		}
75
76
	def setParameters(self, HMS=30, r_accept=0.7, r_pa=0.35, b_range=1.42, **ukwargs):

NiaPy/algorithms/basic/fwa.py 1 location

@@ 156-162 (lines=7) @@
153
		"""
154
		return r"""Tan, Ying. "Fireworks algorithm." Heidelberg, Germany: Springer 10 (2015): 978-3."""
155
156
	@staticmethod
157
	def typeParameters(): return {
158
			'N': lambda x: isinstance(x, int) and x > 0,
159
			'm': lambda x: isinstance(x, int) and x > 0,
160
			'a': lambda x: isinstance(x, (int, float)) and x > 0,
161
			'b': lambda x: isinstance(x, (int, float)) and x > 0,
162
			'epsilon': lambda x: isinstance(x, float) and 0 < x < 1
163
	}
164
165
	def setParameters(self, N=40, m=40, a=1, b=2, A=40, epsilon=1e-31, **ukwargs):

NiaPy/algorithms/basic/es.py 1 location

@@ 78-95 (lines=18) @@
75
		"""
76
		return r"""TODO"""
77
78
	@staticmethod
79
	def typeParameters():
80
		r"""Get dictionary with functions for checking values of parameters.
81
82
		Returns:
83
			Dict[str, Callable]:
84
				* mu (Callable[[int], bool])
85
				* k (Callable[[int], bool])
86
				* c_a (Callable[[Union[float, int]], bool])
87
				* c_r (Callable[[Union[float, int]], bool])
88
				* epsilon (Callable[[float], bool])
89
		"""
90
		return {
91
			'mu': lambda x: isinstance(x, int) and x > 0,
92
			'k': lambda x: isinstance(x, int) and x > 0,
93
			'c_a': lambda x: isinstance(x, (float, int)) and x > 1,
94
			'c_r': lambda x: isinstance(x, (float, int)) and 0 < x < 1,
95
			'epsilon': lambda x: isinstance(x, float) and 0 < x < 1
96
		}
97
98
	def setParameters(self, mu=1, k=10, c_a=1.1, c_r=0.5, epsilon=1e-20, **ukwargs):