Code Duplication    Length = 22-22 lines in 2 locations

NiaPy/algorithms/other/mts.py 1 location

@@ 313-334 (lines=22) @@
310
		"""
311
		return r"""Lin-Yu Tseng and Chun Chen, "Multiple trajectory search for Large Scale Global Optimization," 2008 IEEE Congress on Evolutionary Computation (IEEE World Congress on Computational Intelligence), Hong Kong, 2008, pp. 3052-3059. doi: 10.1109/CEC.2008.4631210"""
312
313
	@staticmethod
314
	def typeParameters():
315
		r"""Get dictionary with functions for checking values of parameters.
316
317
		Returns:
318
			Dict[str, Callable]:
319
				* M (Callable[[int], bool])
320
				* NoLsTests (Callable[[int], bool])
321
				* NoLs (Callable[[int], bool])
322
				* NoLsBest (Callable[[int], bool])
323
				* NoEnabled (Callable[[int], bool])
324
				* BONUS1 (Callable([[Union[int, float], bool])
325
				* BONUS2 (Callable([[Union[int, float], bool])
326
		"""
327
		return {
328
			'M': lambda x: isinstance(x, int) and x > 0,
329
			'NoLsTests': lambda x: isinstance(x, int) and x >= 0,
330
			'NoLs': lambda x: isinstance(x, int) and x >= 0,
331
			'NoLsBest': lambda x: isinstance(x, int) and x >= 0,
332
			'NoEnabled': lambda x: isinstance(x, int) and x > 0,
333
			'BONUS1': lambda x: isinstance(x, (int, float)) and x > 0,
334
			'BONUS2': lambda x: isinstance(x, (int, float)) and x > 0,
335
		}
336
337
	def setParameters(self, M=40, NoLsTests=5, NoLs=5, NoLsBest=5, NoEnabled=17, BONUS1=10, BONUS2=1, LSs=(MTS_LS1, MTS_LS2, MTS_LS3), **ukwargs):

NiaPy/algorithms/basic/gso.py 1 location

@@ 61-82 (lines=22) @@
58
		"""
59
		return r"""Kaipa, Krishnanand N., and Debasish Ghose. Glowworm swarm optimization: theory, algorithms, and applications. Vol. 698. Springer, 2017."""
60
61
	@staticmethod
62
	def typeParameters():
63
		r"""Get dictionary with functions for checking values of parameters.
64
65
		Returns:
66
			Dict[str, Callable]:
67
				* n (Callable[[int], bool])
68
				* l0 (Callable[[Union[float, int]], bool])
69
				* nt (Callable[[Union[float, int]], bool])
70
				* rho (Callable[[Union[float, int]], bool])
71
				* gamma (Callable[[float], bool])
72
				* beta (Callable[[float], bool])
73
				* s (Callable[[float], bool])
74
		"""
75
		return {
76
			'n': lambda x: isinstance(x, int) and x > 0,
77
			'l0': lambda x: isinstance(x, (float, int)) and x > 0,
78
			'nt': lambda x: isinstance(x, (float, int)) and x > 0,
79
			'rho': lambda x: isinstance(x, float) and 0 < x < 1,
80
			'gamma': lambda x: isinstance(x, float) and 0 < x < 1,
81
			'beta': lambda x: isinstance(x, float) and x > 0,
82
			's': lambda x: isinstance(x, float) and x > 0
83
		}
84
85
	def setParameters(self, n=25, l0=5, nt=5, rho=0.4, gamma=0.6, beta=0.08, s=0.03, Distance=euclidean, **ukwargs):