Code Duplication    Length = 16-16 lines in 2 locations

NiaPy/algorithms/basic/bea.py 1 location

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

NiaPy/algorithms/basic/mbo.py 1 location

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