Code Duplication    Length = 13-14 lines in 2 locations

examples/run.py 1 location

@@ 17-30 (lines=14) @@
14
logger.setLevel('INFO')
15
16
17
class MyBenchmark(Benchmark):
18
    Name = ['MyBenchmark']
19
20
    def __init__(self):
21
        self.Lower = -5.12
22
        self.Upper = 5.12
23
24
    def function(self):
25
        def evaluate(D, sol):
26
            val = 0.0
27
            for i in range(D):
28
                val = val + sol[i] * sol[i]
29
            return val
30
        return evaluate
31
32
33
algorithms = ['BatAlgorithm',

examples/run_benchmark.py 1 location

@@ 19-31 (lines=13) @@
16
logger = logging.getLogger('examples')
17
logger.setLevel('INFO')
18
19
class MyBenchmark(Benchmark):
20
	Name = ['MyBenchmark']
21
22
	def __init__(self):
23
		self.Lower = -11
24
		self.Upper = 11
25
26
	def function(self):
27
		def evaluate(D, sol):
28
			val = 0.0
29
			for i in range(D): val += sol[i] ** 2
30
			return val
31
		return evaluate
32
33
benc = MyBenchmark()
34
benc.plot3d()