Convert to class
This commit is contained in:
parent
2a99fdbf13
commit
0e6d124eaa
|
@ -1,6 +1,14 @@
|
|||
from math import pow, sin, pi
|
||||
|
||||
|
||||
def fitness_function(x, y):
|
||||
class Individual(object):
|
||||
|
||||
def __init__(self, x, y):
|
||||
self.x = x
|
||||
self.y = y
|
||||
|
||||
def fitness_function(self):
|
||||
x = self.x
|
||||
y = self.y
|
||||
n = 9
|
||||
return pow(15*x*y*(1-x)*(1-y)*sin(n*pi*x)*sin(n*pi*y), 2)
|
Loading…
Reference in New Issue
Block a user