Code Duplication    Length = 16-16 lines in 2 locations

NiaPy/algorithms/basic/bea.py 1 location

@@ 160-175 (lines=16) @@
157
158
		return BeesPosition, BeesCost, {'ngh': self.ngh}
159
160
	def repair(self, x, lower, upper):
161
		r"""Truncate exceeded dimensions to the limits.
162
163
		Args:
164
			 x (numpy.ndarray): Individual to repair.
165
			 lower (numpy.ndarray): Lower limits for dimensions.
166
			 upper (numpy.ndarray): Upper limits for dimensions.
167
168
		Returns:
169
			 numpy.ndarray: Repaired individual.
170
		"""
171
		ir = where(x < lower)
172
		x[ir] = lower[ir]
173
		ir = where(x > upper)
174
		x[ir] = upper[ir]
175
		return x
176
177
	def runIteration(self, task, BeesPosition, BeesCost, xb, fxb, ngh, **dparams):
178
		r"""Core function of Forest Optimization Algorithm.

NiaPy/algorithms/basic/mbo.py 1 location

@@ 111-126 (lines=16) @@
108
		})
109
		return d
110
111
	def repair(self, x, lower, upper):
112
		r"""Truncate exceeded dimensions to the limits.
113
114
		Args:
115
			 x (numpy.ndarray): Individual to repair.
116
			 lower (numpy.ndarray): Lower limits for dimensions.
117
			 upper (numpy.ndarray): Upper limits for dimensions.
118
119
		Returns:
120
			 numpy.ndarray: Repaired individual.
121
		"""
122
		ir = where(x < lower)
123
		x[ir] = lower[ir]
124
		ir = where(x > upper)
125
		x[ir] = upper[ir]
126
		return x
127
128
	def levy(self, step_size, D):
129
		r"""Calculate levy flight.