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/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):

NiaPy/algorithms/basic/hs.py 1 location

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