Code Duplication    Length = 13-16 lines in 3 locations

NiaPy/algorithms/other/mts.py 1 location

@@ 311-326 (lines=16) @@
308
		"""
309
		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"""
310
311
	@staticmethod
312
	def typeParameters():
313
		r"""Get dictionary with functions for checking values of parameters.
314
315
		Returns:
316
			Dict[str, Callable]:
317
				* NoLsTests (Callable[[int], bool])
318
				* NoLs (Callable[[int], bool])
319
				* NoLsBest (Callable[[int], bool])
320
				* NoEnabled (Callable[[int], bool])
321
		"""
322
		return {
323
			'NoLsTests': lambda x: isinstance(x, int) and x >= 0,
324
			'NoLs': lambda x: isinstance(x, int) and x >= 0,
325
			'NoLsBest': lambda x: isinstance(x, int) and x >= 0,
326
			'NoEnabled': lambda x: isinstance(x, int) and x > 0
327
		}
328
329
	def setParameters(self, M=40, NoLsTests=5, NoLs=5, NoLsBest=5, NoEnabled=17, BONUS1=10, BONUS2=1, LSs=(MTS_LS1v1, MTS_LS2, MTS_LS3v1), **ukwargs):

NiaPy/algorithms/basic/hs.py 1 location

@@ 55-70 (lines=16) @@
52
			str: Basic information.
53
		"""
54
		return r"""Yang, Xin-She. "Harmony search as a metaheuristic algorithm." Music-inspired harmony search algorithm. Springer, Berlin, Heidelberg, 2009. 1-14."""
55
	@staticmethod
56
	def typeParameters():
57
		r"""Get dictionary with functions for checking values of parameters.
58
59
		Returns:
60
			Dict[str, Callable]:
61
				* HMS (Callable[[int], bool])
62
				* r_accept (Callable[[float], bool])
63
				* r_pa (Callable[[float], bool])
64
				* b_range (Callable[[float], bool])
65
		"""
66
		return {
67
			'HMS': lambda x: isinstance(x, int) and x > 0,
68
			'r_accept': lambda x: isinstance(x, float) and 0 < x < 1,
69
			'r_pa': lambda x: isinstance(x, float) and 0 < x < 1,
70
			'b_range': lambda x: isinstance(x, (int, float)) and x > 0
71
		}
72
73
	def setParameters(self, HMS=30, r_accept=0.7, r_pa=0.35, b_range=1.42, **ukwargs):

NiaPy/algorithms/other/sa.py 1 location

@@ 87-99 (lines=13) @@
84
		"""
85
		return r"""None"""
86
87
	@staticmethod
88
	def typeParameters():
89
		r"""Get dictionary with functions for checking values of parameters.
90
91
		Returns:
92
			Dict[str, Callable]:
93
				* delta (Callable[[Union[float, int], bool]): TODO
94
		"""
95
		return {
96
			'delta': lambda x: isinstance(x, (int, float)) and x > 0,
97
			'T': lambda x: isinstance(x, (int, float)) and x > 0,
98
			'deltaT': lambda x: isinstance(x, (int, float)) and x > 0,
99
			'epsilon': lambda x: isinstance(x, float) and 0 < x < 1
100
		}
101
102
	def setParameters(self, delta=0.5, T=2000, deltaT=0.8, coolingMethod=coolDelta, epsilon=1e-23, **ukwargs):