updating for individual projecet
This commit is contained in:
parent
d98a738d48
commit
3c058cf50e
24
Main.py
24
Main.py
@ -6,7 +6,8 @@ import collections
|
|||||||
import alg
|
import alg
|
||||||
from models.dumpster import trash
|
from models.dumpster import trash
|
||||||
from models.Garbagetruck import GarbageTruck
|
from models.Garbagetruck import GarbageTruck
|
||||||
|
import numbering
|
||||||
|
from sklearn.datasets import load_digits
|
||||||
|
|
||||||
#heuristics for finding the closest dumpster
|
#heuristics for finding the closest dumpster
|
||||||
def closest(GT, D):
|
def closest(GT, D):
|
||||||
@ -96,6 +97,16 @@ a = createDumpstersAndDump(20,size+1)
|
|||||||
TheDump = np.reshape(a[-1], (1, 2))
|
TheDump = np.reshape(a[-1], (1, 2))
|
||||||
a = np.reshape(a[:-1], (size, 2))
|
a = np.reshape(a[:-1], (size, 2))
|
||||||
|
|
||||||
|
|
||||||
|
#Patryk Krawiec subproject part
|
||||||
|
digitsy=np.load("Ytest.npy")
|
||||||
|
digitsx=np.load("Xtest.npy")
|
||||||
|
images_and_labels=list(zip(digitsx,digitsy))
|
||||||
|
num,xnum,ynum=numbering.num(20,images_and_labels)
|
||||||
|
|
||||||
|
paying_customers=num[3:]
|
||||||
|
paying_customers = list(map(int, paying_customers))
|
||||||
|
|
||||||
#initiating the coordinates for the garbage truck
|
#initiating the coordinates for the garbage truck
|
||||||
GT = GarbageTruck()
|
GT = GarbageTruck()
|
||||||
coor = GT.start()
|
coor = GT.start()
|
||||||
@ -109,6 +120,8 @@ for i in range(0,size):
|
|||||||
s.throwAway()
|
s.throwAway()
|
||||||
s.colour()
|
s.colour()
|
||||||
s.xy = a[i]
|
s.xy = a[i]
|
||||||
|
s.numberx=xnum[i]
|
||||||
|
s.numbery=ynum[i]
|
||||||
dumpsters.append(s)
|
dumpsters.append(s)
|
||||||
|
|
||||||
#colouring trashcans
|
#colouring trashcans
|
||||||
@ -158,14 +171,19 @@ while not done:
|
|||||||
#recognize which dumpster are we visiting
|
#recognize which dumpster are we visiting
|
||||||
Xz=np.where(all==x)[0]
|
Xz=np.where(all==x)[0]
|
||||||
x =[item for item, count in collections.Counter(Xz).items() if count > 1]
|
x =[item for item, count in collections.Counter(Xz).items() if count > 1]
|
||||||
|
predicted=numbering.pred(dumpsters[x[0]].numberx,dumpsters[x[0]].numbery)
|
||||||
if GT.collectingTrash(dumpsters, x[0]):
|
if(predicted not in paying_customers):
|
||||||
|
print("House number is: ",predicted," but it is not our customer")
|
||||||
|
elif GT.collectingTrash(dumpsters, x[0]):
|
||||||
dumpsters[x[0]].empty()
|
dumpsters[x[0]].empty()
|
||||||
|
print("House number is: ",predicted)
|
||||||
elif GT.amIFull():
|
elif GT.amIFull():
|
||||||
print("DUMPSTER TRUCK FULL")
|
print("DUMPSTER TRUCK FULL")
|
||||||
else:
|
else:
|
||||||
print("No more space for this kind of trash")
|
print("No more space for this kind of trash")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# remove visited dumpster
|
# remove visited dumpster
|
||||||
a = a[~((a[:,0] ==ZZ[0]) & (a[:,1] ==ZZ[1]))]
|
a = a[~((a[:,0] ==ZZ[0]) & (a[:,1] ==ZZ[1]))]
|
||||||
print("Dumpsters left: ",len(a))
|
print("Dumpsters left: ",len(a))
|
||||||
|
Loading…
Reference in New Issue
Block a user