Code Duplication    Length = 53-53 lines in 3 locations

NiaPy/algorithms/modified/sade.py 2 locations

@@ 73-125 (lines=53) @@
70
		# TODO implemnt algorithm
71
		return pop, fpop, xb, fxb, dparams
72
73
class StrategyAdaptationDifferentialEvolutionV1(DifferentialEvolution):
74
	r"""Implementation of Differential Evolution Algorithm With Strategy Adaptation algorihtm.
75
76
	Algorithm:
77
		Differential Evolution Algorithm With StrategyAdaptation
78
79
	Date:
80
		2019
81
82
	Author:
83
		Klemen Berkovič
84
85
	License:
86
		MIT
87
88
	Reference URL:
89
		https://ieeexplore.ieee.org/document/4632146
90
91
	Reference paper:
92
		Qin, A. Kai, Vicky Ling Huang, and Ponnuthurai N. Suganthan. "Differential evolution algorithm with strategy adaptation for global numerical optimization." IEEE transactions on Evolutionary Computation 13.2 (2009): 398-417.
93
94
	Attributes:
95
		Name (List[str]): List of strings representing algorithm name.
96
97
	See Also:
98
		:class:`NiaPy.algorithms.basic.DifferentialEvolution`
99
	"""
100
	Name = ['StrategyAdaptationDifferentialEvolutionV1', 'SADEV1', 'SaDEV1']
101
102
	@staticmethod
103
	def algorithmInfo():
104
		r"""Get algorithm information.
105
106
		Returns:
107
			str: Get algorithm information.
108
109
		See Also:
110
			:func:`NiaPy.algorithms.algorithm.Algorithm.algorithmInfo`
111
		"""
112
		return r"""Qin, A. Kai, Vicky Ling Huang, and Ponnuthurai N. Suganthan. "Differential evolution algorithm with strategy adaptation for global numerical optimization." IEEE transactions on Evolutionary Computation 13.2 (2009): 398-417."""
113
114
	def setParameters(self, **kwargs):
115
		DifferentialEvolution.setParameters(self, **kwargs)
116
		# TODO add parameters of the algorithm
117
118
	def getParameters(self):
119
		d = DifferentialEvolution.getParameters(self)
120
		# TODO add paramters values
121
		return d
122
123
	def runIteration(self, task, pop, fpop, xb, fxb, **dparams):
124
		# TODO implement algorithm
125
		return pop, fpop, xb, fxb, dparams
126
127
# vim: tabstop=3 noexpandtab shiftwidth=3 softtabstop=3
128
@@ 19-71 (lines=53) @@
16
	'StrategyAdaptationDifferentialEvolutionV1'
17
]
18
19
class StrategyAdaptationDifferentialEvolution(DifferentialEvolution):
20
	r"""Implementation of Differential Evolution Algorithm With Strategy Adaptation algorihtm.
21
22
	Algorithm:
23
		Differential Evolution Algorithm With StrategyAdaptation
24
25
	Date:
26
		2019
27
28
	Author:
29
		Klemen Berkovič
30
31
	License:
32
		MIT
33
34
	Reference URL:
35
		https://ieeexplore.ieee.org/document/1554904
36
37
	Reference paper:
38
		Qin, A. Kai, and Ponnuthurai N. Suganthan. "Self-adaptive differential evolution algorithm for numerical optimization." 2005 IEEE congress on evolutionary computation. Vol. 2. IEEE, 2005.
39
40
	Attributes:
41
		Name (List[str]): List of strings representing algorithm name.
42
43
	See Also:
44
		:class:`NiaPy.algorithms.basic.DifferentialEvolution`
45
	"""
46
	Name = ['StrategyAdaptationDifferentialEvolution', 'SADE', 'SaDE']
47
48
	@staticmethod
49
	def algorithmInfo():
50
		r"""Geg basic algorithm information.
51
52
		Returns:
53
			str: Basic algorithm information.
54
55
		See Also:
56
			:func:`NiaPy.algorithms.algorithm.Algorithm.algorithmInfo`
57
		"""
58
		return r"""Qin, A. Kai, and Ponnuthurai N. Suganthan. "Self-adaptive differential evolution algorithm for numerical optimization." 2005 IEEE congress on evolutionary computation. Vol. 2. IEEE, 2005."""
59
60
	def setParameters(self, **kwargs):
61
		DifferentialEvolution.setParameters(self, **kwargs)
62
		# TODO add parameters of the algorithm
63
64
	def getParameters(self):
65
		d = DifferentialEvolution.getParameters(self)
66
		# TODO add paramters values
67
		return d
68
69
	def runIteration(self, task, pop, fpop, xb, fxb, **dparams):
70
		# TODO implemnt algorithm
71
		return pop, fpop, xb, fxb, dparams
72
73
class StrategyAdaptationDifferentialEvolutionV1(DifferentialEvolution):
74
	r"""Implementation of Differential Evolution Algorithm With Strategy Adaptation algorihtm.

NiaPy/algorithms/modified/jade.py 1 location

@@ 57-109 (lines=53) @@
54
	x = [pop[ic][i] + f * (ppop[rp[0]][i] - pop[ic][i]) + f * (pop[r[0]][i] - apop[ra[0]][i]) if rnd.rand() < cr or i == j else pop[ic][i] for i in range(len(pop[ic]))]
55
	return asarray(x)
56
57
class AdaptiveArchiveDifferentialEvolution(DifferentialEvolution):
58
	r"""Implementation of Adaptive Differential Evolution With Optional External Archive algorithm.
59
60
	Algorithm:
61
		Adaptive Differential Evolution With Optional External Archive
62
63
	Date:
64
		2019
65
66
	Author:
67
		Klemen Berkovič
68
69
	License:
70
		MIT
71
72
	Reference URL:
73
		https://ieeexplore.ieee.org/document/5208221
74
75
	Reference paper:
76
		Zhang, Jingqiao, and Arthur C. Sanderson. "JADE: adaptive differential evolution with optional external archive." IEEE Transactions on evolutionary computation 13.5 (2009): 945-958.
77
78
	Attributes:
79
		Name (List[str]): List of strings representing algorithm name.
80
81
	See Also:
82
		:class:`NiaPy.algorithms.basic.DifferentialEvolution`
83
	"""
84
	Name = ['AdaptiveArchiveDifferentialEvolution', 'JADE']
85
86
	@staticmethod
87
	def algorithmInfo():
88
		r"""Get algorithm information.
89
90
		Returns:
91
			str: Alogrithm information.
92
93
		See Also:
94
			:func:`NiaPy.algorithms.algorithm.Algorithm.algorithmInfo`
95
		"""
96
		return r"""Zhang, Jingqiao, and Arthur C. Sanderson. "JADE: adaptive differential evolution with optional external archive." IEEE Transactions on evolutionary computation 13.5 (2009): 945-958."""
97
98
	def setParameters(self, **kwargs):
99
		DifferentialEvolution.setParameters(self, **kwargs)
100
		# TODO add parameters of the algorithm
101
102
	def getParameters(self):
103
		d = DifferentialEvolution.getParameters(self)
104
		# TODO add paramters values
105
		return d
106
107
	def runIteration(self, task, pop, fpop, xb, fxb, **dparams):
108
		# TODO Implement algorithm
109
		return pop, fpop, xb, fxb, dparams
110
111
# vim: tabstop=3 noexpandtab shiftwidth=3 softtabstop=3
112