Code Duplication    Length = 15-15 lines in 2 locations

NiaPy/algorithms/basic/fwa.py 1 location

@@ 243-257 (lines=15) @@
240
		"""
241
		return self.Mapping(x + self.rand(task.D) * self.normal(1, 1, task.D), task)
242
243
	def Mapping(self, x, task):
244
		r"""Fix value to bounds..
245
246
		Args:
247
			x (numpy.ndarray): Individual to fix.
248
			task (Task): Optimization task.
249
250
		Returns:
251
			numpy.ndarray: Individual in search range.
252
		"""
253
		ir = where(x > task.Upper)
254
		x[ir] = task.Lower[ir] + x[ir] % task.bRange[ir]
255
		ir = where(x < task.Lower)
256
		x[ir] = task.Lower[ir] + x[ir] % task.bRange[ir]
257
		return x
258
259
	def R(self, x, FW):
260
		r"""Calculate ranges.

NiaPy/algorithms/basic/fpa.py 1 location

@@ 92-106 (lines=15) @@
89
		self.p, self.beta = p, beta
90
		self.S = zeros((NP, 10))
91
92
	def repair(self, x, task):
93
		r"""Repair solution to search space.
94
95
		Args:
96
			x (numpy.ndarray): Solution to fix.
97
			task (Task): Optimization task.
98
99
		Returns:
100
			numpy.ndarray: fixed solution.
101
		"""
102
		ir = where(x > task.Upper)
103
		x[ir] = task.Lower[ir] + x[ir] % task.bRange[ir]
104
		ir = where(x < task.Lower)
105
		x[ir] = task.Lower[ir] + x[ir] % task.bRange[ir]
106
		return x
107
108
	def levy(self, D):
109
		r"""Levy function.