Code Duplication    Length = 17-20 lines in 5 locations

NiaPy/algorithms/basic/de.py 1 location

@@ 255-272 (lines=18) @@
252
		"""
253
		return r"""Storn, Rainer, and Kenneth Price. "Differential evolution - a simple and efficient heuristic for global optimization over continuous spaces." Journal of global optimization 11.4 (1997): 341-359."""
254
255
	@staticmethod
256
	def typeParameters():
257
		r"""Get dictionary with functions for checking values of parameters.
258
259
		Returns:
260
			Dict[str, Callable]:
261
				* F (Callable[[Union[float, int]], bool]): Check for correct value of parameter.
262
				* CR (Callable[[float], bool]): Check for correct value of parameter.
263
264
		See Also:
265
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
266
		"""
267
		d = Algorithm.typeParameters()
268
		d.update({
269
			'F': lambda x: isinstance(x, (float, int)) and 0 < x <= 2,
270
			'CR': lambda x: isinstance(x, float) and 0 <= x <= 1
271
		})
272
		return d
273
274
	def setParameters(self, NP=50, F=1, CR=0.8, CrossMutt=CrossRand1, **ukwargs):
275
		r"""Set the algorithm parameters.

NiaPy/algorithms/basic/gsa.py 1 location

@@ 52-69 (lines=18) @@
49
		"""
50
		return r"""Esmat Rashedi, Hossein Nezamabadi-pour, Saeid Saryazdi, GSA: A Gravitational Search Algorithm, Information Sciences, Volume 179, Issue 13, 2009, Pages 2232-2248, ISSN 0020-0255"""
51
52
	@staticmethod
53
	def typeParameters():
54
		r"""TODO.
55
56
		Returns:
57
			Dict[str, Callable]:
58
				* G_0 (Callable[[Union[int, float]], bool]): TODO
59
				* epsilon (Callable[[float], bool]): TODO
60
61
		See Also:
62
			* :func:`NiaPy.algorithms.algorithm.Algorithm.typeParameters`
63
		"""
64
		d = Algorithm.typeParameters()
65
		d.update({
66
			'G_0': lambda x: isinstance(x, (int, float)) and x >= 0,
67
			'epsilon': lambda x: isinstance(x, float) and 0 < x < 1
68
		})
69
		return d
70
71
	def setParameters(self, NP=40, G_0=2.467, epsilon=1e-17, **ukwargs):
72
		r"""Set the algorithm parameters.

NiaPy/algorithms/basic/mbo.py 1 location

@@ 60-76 (lines=17) @@
57
		Main reference: Wang, Gai-Ge & Deb, Suash & Cui, Zhihua. (2015). Monarch Butterfly Optimization. Neural Computing and Applications. 10.1007/s00521-015-1923-y. , https://www.researchgate.net/publication/275964443_Monarch_Butterfly_Optimization.
58
    """
59
60
	@staticmethod
61
	def typeParameters():
62
		r"""Get dictionary with functions for checking values of parameters.
63
64
		Returns:
65
			 Dict[str, Callable]:
66
				  * PAR (Callable[[float], bool]): Checks if partition parameter has a proper value.
67
				  * PER (Callable[[float], bool]): Checks if period parameter has a proper value.
68
		See Also:
69
			 * :func:`NiaPy.algorithms.algorithm.Algorithm.typeParameters`
70
		"""
71
		d = Algorithm.typeParameters()
72
		d.update({
73
			'PAR': lambda x: isinstance(x, float) and x > 0,
74
			'PER': lambda x: isinstance(x, float) and x > 0
75
		})
76
		return d
77
78
	def setParameters(self, NP=20, PAR=5.0 / 12.0, PER=1.2, **ukwargs):
79
		r"""Set the parameters of the algorithm.

NiaPy/algorithms/basic/fa.py 1 location

@@ 55-74 (lines=20) @@
52
		"""
53
		return r"""Fister, I., Fister Jr, I., Yang, X. S., & Brest, J. (2013). A comprehensive review of firefly algorithms. Swarm and Evolutionary Computation, 13, 34-46."""
54
55
	@staticmethod
56
	def typeParameters():
57
		r"""TODO.
58
59
		Returns:
60
			Dict[str, Callable]:
61
				* alpha (Callable[[Union[float, int]], bool]): TODO.
62
				* betamin (Callable[[Union[float, int]], bool]): TODO.
63
				* gamma (Callable[[Union[float, int]], bool]): TODO.
64
65
		See Also:
66
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
67
		"""
68
		d = Algorithm.typeParameters()
69
		d.update({
70
			'alpha': lambda x: isinstance(x, (float, int)) and x > 0,
71
			'betamin': lambda x: isinstance(x, (float, int)) and x > 0,
72
			'gamma': lambda x: isinstance(x, (float, int)) and x > 0,
73
		})
74
		return d
75
76
	def setParameters(self, NP=20, alpha=1, betamin=1, gamma=2, **ukwargs):
77
		r"""Set the parameters of the algorithm.

NiaPy/algorithms/basic/fpa.py 1 location

@@ 58-75 (lines=18) @@
55
		"""
56
		return r"""Yang, Xin-She. "Flower pollination algorithm for global optimization. International conference on unconventional computing and natural computation. Springer, Berlin, Heidelberg, 2012."""
57
58
	@staticmethod
59
	def typeParameters():
60
		r"""TODO.
61
62
		Returns:
63
			Dict[str, Callable]:
64
				* p (function): TODO
65
				* beta (function): TODO
66
67
		See Also:
68
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
69
		"""
70
		d = Algorithm.typeParameters()
71
		d.update({
72
			'p': lambda x: isinstance(x, float) and 0 <= x <= 1,
73
			'beta': lambda x: isinstance(x, (float, int)) and x > 0,
74
		})
75
		return d
76
77
	def setParameters(self, NP=25, p=0.35, beta=1.5, **ukwargs):
78
		r"""Set core parameters of FlowerPollinationAlgorithm algorithm.