base classes creation
This commit is contained in:
parent
fb44e3a98d
commit
6b28ba2331
1 changed files with 40 additions and 0 deletions
|
@ -0,0 +1,40 @@
|
|||
# Librairie du projet en version orientée objet
|
||||
|
||||
class Population:
|
||||
"""
|
||||
Classe qui représente notre population d'individuts
|
||||
"""
|
||||
def __init__(self, ng, l, n, ts, pm, tm):
|
||||
self.individuals = [Individual().randomize(l) for _ in range(n)]
|
||||
self.ng = ng
|
||||
self.l = l
|
||||
self.n = n
|
||||
self.ts = ts
|
||||
self.pm = pm
|
||||
self.tm = tm
|
||||
|
||||
def select(self) -> None:
|
||||
# TODO
|
||||
pass
|
||||
|
||||
class Individual:
|
||||
"""
|
||||
Classe qui représente les individuts de la population (les solutions potentielles)
|
||||
"""
|
||||
def __init__(self):
|
||||
self.chromozome = ""
|
||||
|
||||
def setChromozome(self, c: str) -> None:
|
||||
self.chromozome = c
|
||||
|
||||
def randomize(self, l: int) -> None:
|
||||
# TODO
|
||||
pass
|
||||
|
||||
def fitness(self, pm: str) -> float:
|
||||
# TODO
|
||||
pass
|
||||
|
||||
def mutate(self, tm: float) -> None:
|
||||
# TODO
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue