Code Duplication    Length = 21-28 lines in 2 locations

NiaPy/algorithms/basic/ca.py 1 location

@@ 162-189 (lines=28) @@
159
		"""
160
		return r'''Ali, Ramzy. (2016). Novel Optimization Algorithm Inspired by Camel Traveling Behavior. Iraq J. Electrical and Electronic Engineering. 12. 167-177.'''
161
162
	@staticmethod
163
	def typeParameters():
164
		r"""Get dictionary with functions for checking values of parameters.
165
166
		Returns:
167
			Dict[str, Callable]:
168
				* omega (Callable[[Union[int, float]], bool])
169
				* mu (Callable[[float], bool])
170
				* alpha (Callable[[float], bool])
171
				* S_init (Callable[[Union[float, int]], bool])
172
				* E_init (Callable[[Union[float, int]], bool])
173
				* T_min (Callable[[Union[float, int], bool])
174
				* T_max (Callable[[Union[float, int], bool])
175
176
		See Also:
177
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
178
		"""
179
		d = Algorithm.typeParameters()
180
		d.update({
181
			'omega': lambda x: isinstance(x, (float, int)),
182
			'mu': lambda x: isinstance(x, float) and 0 <= x <= 1,
183
			'alpha': lambda x: isinstance(x, float) and 0 <= x <= 1,
184
			'S_init': lambda x: isinstance(x, (float, int)) and x > 0,
185
			'E_init': lambda x: isinstance(x, (float, int)) and x > 0,
186
			'T_min': lambda x: isinstance(x, (float, int)) and x > 0,
187
			'T_max': lambda x: isinstance(x, (float, int)) and x > 0
188
		})
189
		return d
190
191
	def setParameters(self, NP=50, omega=0.25, mu=0.5, alpha=0.5, S_init=10, E_init=10, T_min=-10, T_max=10, **ukwargs):
192
		r"""Set the arguments of an algorithm.

NiaPy/algorithms/modified/saba.py 1 location

@@ 244-264 (lines=21) @@
241
		"""
242
		return r"""Fister Jr., Iztok and Fister, Dusan and Yang, Xin-She. "A Hybrid Bat Algorithm". Elektrotehniski vestnik, 2013. 1-7."""
243
244
	@staticmethod
245
	def typeParameters():
246
		r"""Get dictionary with functions for checking values of parameters.
247
248
		Returns:
249
			Dict[str, Callable]: TODO
250
251
		See Also:
252
			* :func:`NiaPy.algorithms.basic.BatAlgorithm.typeParameters`
253
		"""
254
		d = AdaptiveBatAlgorithm.typeParameters()
255
		d.pop('A', None), d.pop('r', None)
256
		d.update({
257
			'A_l': lambda x: isinstance(x, (float, int)) and x >= 0,
258
			'A_u': lambda x: isinstance(x, (float, int)) and x >= 0,
259
			'r_l': lambda x: isinstance(x, (float, int)) and x >= 0,
260
			'r_u': lambda x: isinstance(x, (float, int)) and x >= 0,
261
			'tao_1': lambda x: isinstance(x, (float, int)) and 0 <= x <= 1,
262
			'tao_2': lambda x: isinstance(x, (float, int)) and 0 <= x <= 1
263
		})
264
		return d
265
266
	def setParameters(self, A_l=0.9, A_u=1.0, r_l=0.001, r_u=0.1, tao_1=0.1, tao_2=0.1, **ukwargs):
267
		r"""Set core parameters of HybridBatAlgorithm algorithm.