Code Duplication    Length = 53-53 lines in 3 locations

NiaPy/algorithms/modified/sade.py 2 locations

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

NiaPy/algorithms/modified/jade.py 1 location

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