|
|
|
@ -68,8 +68,12 @@ def kPlusProches(point,lstRepre,k): #je ne sais pas si il faut mettre k ce n'est |
|
|
|
if k > len(lstRepre): |
|
|
|
k = len(lstRepre) |
|
|
|
for i in range(len(lstRepre)): |
|
|
|
|
|
|
|
d = distance(point,lstRepre[i]) |
|
|
|
if boolDistanceDeManhattan: |
|
|
|
d = distanceManhattan(point,lstRepre[i]) |
|
|
|
print(True) |
|
|
|
else: |
|
|
|
d = distanceEuclidienne(point,lstRepre[i]) |
|
|
|
print(False) |
|
|
|
lstvoisins.append((d,i)) |
|
|
|
lstvoisins.sort() |
|
|
|
return [lstvoisins[i] for i in range(k)] |
|
|
|
@ -109,14 +113,14 @@ def lancerTest(): |
|
|
|
affichageResultats.configure(text="La consommation électrique devrait être d'environ " + str(ConsoMoy) +"MW") |
|
|
|
|
|
|
|
def changeDistance(): |
|
|
|
global DistanceEuclidienne |
|
|
|
if DistanceEuclidienne: |
|
|
|
global boolDistanceDeManhattan |
|
|
|
if boolDistanceDeManhattan: |
|
|
|
boutonDistance.config(text='Distance de Manhattan') |
|
|
|
else: |
|
|
|
boutonDistance.config(text='Distance euclidienne') |
|
|
|
DistanceEuclidienne = not DistanceEuclidienne |
|
|
|
boolDistanceDeManhattan = not boolDistanceDeManhattan |
|
|
|
|
|
|
|
DistanceEuclidienne = False |
|
|
|
boolDistanceDeManhattan = False |
|
|
|
|
|
|
|
fenetre = tk.Tk() |
|
|
|
fenetre['bg'] = "snow" |
|
|
|
|