diff --git a/.idea/AI.iml b/.idea/AI.iml
new file mode 100644
index 0000000..bf708e3
--- /dev/null
+++ b/.idea/AI.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..15a15b2
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/R_User_Library.xml b/.idea/libraries/R_User_Library.xml
new file mode 100644
index 0000000..71f5ff7
--- /dev/null
+++ b/.idea/libraries/R_User_Library.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..a2e120d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..1872027
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..208808e
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,602 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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/AStar.py b/AStar.py
index 13407c0..d9a4cf2 100644
--- a/AStar.py
+++ b/AStar.py
@@ -16,8 +16,8 @@ class AStar:
result[path[i][0]][path[i][1]] = startValue
startValue+=1
return result
-
- def search(self, start, end, grid, cost):
+######################################################### w current jest koszt do przebycia
+ def search(self, start, end, grid, cost): #start to kordy wózka, end miejsce podjęcia paczki
noRows, noColumns = numpy.shape(grid)
startNode = AStarState(None, tuple(start))
endNode = AStarState(None, tuple(end))
@@ -46,10 +46,11 @@ class AStar:
visited.append(current)
toVisit.pop(currentIndeks)
if current==endNode:
- return self.returnPath(current, grid)
+ return self.returnPath(current, grid) #zwracanie wagi przejscia
children = []
for new in moves:
positions = (current.position[0]+new[0], current.position[1]+new[1])
+
if (positions[0] > (noRows - 1) or
positions[0] < 0 or
positions[1] > (noColumns - 1) or
@@ -57,16 +58,21 @@ class AStar:
continue
if grid[positions[0]][positions[1]]!=0:
continue
+
children.append(AStarState(current, positions))
for child in children:
+
if len([visitedChild for visitedChild in visited if visitedChild==child])>0:
continue
+
if child.position[0]<=(len(grid)-4) and child.position[0]>=3 and child.position[1]>=4 and child.position[1]<=(len(grid[0])-1):
child.g = current.g + (10 * cost)
else:
child.g = current.g + cost
child.h = (((child.position[0]-endNode.position[0]) ** 2) + ((child.position[1]-endNode.position[1]) ** 2))
child.f = child.g + child.h
+
if len([i for i in toVisit if child==i and child.g>i.g])>0:
continue
+
toVisit.append(child)
diff --git a/Mapa/__pycache__/box.cpython-37.pyc b/Mapa/__pycache__/box.cpython-37.pyc
new file mode 100644
index 0000000..4254792
Binary files /dev/null and b/Mapa/__pycache__/box.cpython-37.pyc differ
diff --git a/Mapa/__pycache__/boxOnTheFloor.cpython-37.pyc b/Mapa/__pycache__/boxOnTheFloor.cpython-37.pyc
new file mode 100644
index 0000000..603594c
Binary files /dev/null and b/Mapa/__pycache__/boxOnTheFloor.cpython-37.pyc differ
diff --git a/Mapa/__pycache__/floor.cpython-37.pyc b/Mapa/__pycache__/floor.cpython-37.pyc
new file mode 100644
index 0000000..6d03228
Binary files /dev/null and b/Mapa/__pycache__/floor.cpython-37.pyc differ
diff --git a/Mapa/__pycache__/generate.cpython-37.pyc b/Mapa/__pycache__/generate.cpython-37.pyc
new file mode 100644
index 0000000..8b8dd78
Binary files /dev/null and b/Mapa/__pycache__/generate.cpython-37.pyc differ
diff --git a/Mapa/__pycache__/shelf.cpython-37.pyc b/Mapa/__pycache__/shelf.cpython-37.pyc
new file mode 100644
index 0000000..10f6109
Binary files /dev/null and b/Mapa/__pycache__/shelf.cpython-37.pyc differ
diff --git a/Mapa/__pycache__/unboxOnTheFloor.cpython-37.pyc b/Mapa/__pycache__/unboxOnTheFloor.cpython-37.pyc
new file mode 100644
index 0000000..949a716
Binary files /dev/null and b/Mapa/__pycache__/unboxOnTheFloor.cpython-37.pyc differ
diff --git a/Mapa/__pycache__/wall.cpython-37.pyc b/Mapa/__pycache__/wall.cpython-37.pyc
new file mode 100644
index 0000000..ad1ab54
Binary files /dev/null and b/Mapa/__pycache__/wall.cpython-37.pyc differ
diff --git a/Mapa/generate.py b/Mapa/generate.py
index 8f94ff0..268f25e 100644
--- a/Mapa/generate.py
+++ b/Mapa/generate.py
@@ -168,9 +168,13 @@ class Generate:
all[wysokosc-2][szerokosc-2] = 1
all[0][2] = 2
all[1][2] = 2
+#zmiana miejsca zrzutu paczki, unboxOnTheFloor
+ #all[1][4] = 2
+ #all[0][4] = 23
+ #all[1][5] = 1
all[wysokosc-2][szerokosc-3] = 2
all[wysokosc-1][szerokosc-3] = 23
all[wysokosc-2][szerokosc-4] = 1
return all
-x = Generate.generate(8, 9, 1, 1, 1, 1)
\ No newline at end of file
+#x = Generate.generate(8, 9, 1, 1, 1, 1)
\ No newline at end of file
diff --git a/__pycache__/AStar.cpython-37.pyc b/__pycache__/AStar.cpython-37.pyc
new file mode 100644
index 0000000..369e1c7
Binary files /dev/null and b/__pycache__/AStar.cpython-37.pyc differ
diff --git a/__pycache__/AStarState.cpython-37.pyc b/__pycache__/AStarState.cpython-37.pyc
new file mode 100644
index 0000000..fae2672
Binary files /dev/null and b/__pycache__/AStarState.cpython-37.pyc differ
diff --git a/__pycache__/Evencik.cpython-37.pyc b/__pycache__/Evencik.cpython-37.pyc
new file mode 100644
index 0000000..cef7b92
Binary files /dev/null and b/__pycache__/Evencik.cpython-37.pyc differ
diff --git a/__pycache__/neurons.cpython-37.pyc b/__pycache__/neurons.cpython-37.pyc
new file mode 100644
index 0000000..f057112
Binary files /dev/null and b/__pycache__/neurons.cpython-37.pyc differ
diff --git a/__pycache__/program.cpython-37.pyc b/__pycache__/program.cpython-37.pyc
new file mode 100644
index 0000000..8a2036e
Binary files /dev/null and b/__pycache__/program.cpython-37.pyc differ
diff --git a/__pycache__/wheel.cpython-37.pyc b/__pycache__/wheel.cpython-37.pyc
new file mode 100644
index 0000000..4aedda5
Binary files /dev/null and b/__pycache__/wheel.cpython-37.pyc differ
diff --git a/__pycache__/whereDecision.cpython-37.pyc b/__pycache__/whereDecision.cpython-37.pyc
new file mode 100644
index 0000000..37f9f92
Binary files /dev/null and b/__pycache__/whereDecision.cpython-37.pyc differ
diff --git a/genetyczny/Data.py b/genetyczny/Data.py
index e69de29..68c3b0f 100644
--- a/genetyczny/Data.py
+++ b/genetyczny/Data.py
@@ -0,0 +1,6 @@
+
+
+
+class Data:
+ def __init__(self):
+ pass
diff --git a/genetyczny/__pycache__/metody.cpython-37.pyc b/genetyczny/__pycache__/metody.cpython-37.pyc
new file mode 100644
index 0000000..2ecf1cf
Binary files /dev/null and b/genetyczny/__pycache__/metody.cpython-37.pyc differ
diff --git a/genetyczny/metody.py b/genetyczny/metody.py
index e69de29..2187f56 100644
--- a/genetyczny/metody.py
+++ b/genetyczny/metody.py
@@ -0,0 +1,11 @@
+from Mapa.shelf import Shelf
+from wheel import Wheel
+
+
+def RandomBox(shelfs_, mapa_):
+ shelfs = shelfs_
+ mapa = mapa_
+
+
+
+ return mapa
diff --git a/main.py b/main.py
index 263fa26..f83a8a3 100644
--- a/main.py
+++ b/main.py
@@ -6,6 +6,7 @@ def main():
good = False
while (True):
good = True
+ """
fieldValues = multenterbox("Wprowadź warunki początkowe", "Start programu", ["Szerekość kraty (>=6)", "Wysokość kraty (>=7)", "Ilość regałów kruchych", "Ilość regałów łatwopalnych", "Ilość regałów radioaktywnych", "Ilość regałów niebezpiecznych"])
if(fieldValues[0].isnumeric() and (fieldValues[0]!="")):
if(int(fieldValues[0])<=5):
@@ -30,7 +31,14 @@ def main():
elif (good == True):
msgbox("Wartość nie jest liczbą", "Błąd")
good = False
+ """
if good:
- window = MainWindow(int(fieldValues[0]), int(fieldValues[1]), int(fieldValues[2]), int(fieldValues[3]), int(fieldValues[4]), int(fieldValues[5]));
+ szerokosc = 15 #min 6
+ wysokosc = 8 #min 7
+ kruche = 1
+ latwopalne = 1
+ radioaktywne = 1
+ niebezpieczne= 1
+ window = MainWindow(szerokosc, wysokosc, kruche, latwopalne, radioaktywne, niebezpieczne);
break
main()
\ No newline at end of file
diff --git a/neurons.py b/neurons.py
index af6f80f..a8e9cfc 100644
--- a/neurons.py
+++ b/neurons.py
@@ -29,8 +29,11 @@ class Neurons:
if confidence > 0.5:
class_ids.append(class_id)
print([classes[ids] for ids in class_ids])"""
+
+ # randomowe przydzielanie typów paczek poki nie ma rozpoznawania paczki
+
x = [1, 0, 0, 0, 0]
- numpy.random.shuffle(x)
+ #numpy.random.shuffle(x)
if x[0]==1:
print("Zwykła")
elif x[1]==1:
diff --git a/program.py b/program.py
index 0cbf702..873e0fc 100644
--- a/program.py
+++ b/program.py
@@ -1,19 +1,19 @@
import pygame
from os import sys
-from generate import Generate
-from floor import Floor
-from wall import Wall
-from shelf import Shelf
+from Mapa.generate import Generate
+from Mapa.floor import Floor
+from Mapa.wall import Wall
+from Mapa.shelf import Shelf
from wheel import Wheel
-from boxOnTheFloor import BoxOnTheFloor
-from box import Box
-from unboxOnTheFloor import UnboxOnTheFloor
+from Mapa.boxOnTheFloor import BoxOnTheFloor
+from Mapa.box import Box
+from Mapa.unboxOnTheFloor import UnboxOnTheFloor
from AStar import AStar
-import numpy
import easygui
from neurons import Neurons
from whereDecision import WhereDecision
from Evencik import Evencik
+from genetyczny import metody
class MainWindow:
def __init__(self, szerokosc, wysokosc, kruche, latwopalne, radioaktywne, niebezpieczne):
@@ -33,6 +33,9 @@ class MainWindow:
self.whereDecision = WhereDecision()
#create
self.wheel = Wheel(self.screen, self.cell);
+
+#przekladanie wartosci liczbowych z tablicy na mapę obiektow
+
for i in range(len(self.map)):
for j in range(len(self.map[i])):
if (self.map[i][j]==1):
@@ -44,11 +47,14 @@ class MainWindow:
elif (self.map[i][j]==23):
self.map[i][j] = UnboxOnTheFloor(self.screen, self.cell, i, j)
self.mapForAStar[i][j] = 1
+
else:
+ #regals (kordy i,j oraz rodzaj regału)
self.regals.append((i, j, (self.map[i][j]-3)//4))
self.map[i][j] = Shelf(self.screen, self.cell, i, j, (self.map[i][j]-3)%4, (self.map[i][j]-3)//4)
self.mapForAStar[i][j] = 1
- #loop
+
+#loop
while True:
self.events()
self.draw()
@@ -66,6 +72,7 @@ class MainWindow:
elif (self.moves[0]==4):
self.wheel.move(Evencik(pygame.K_RIGHT), self.map)
self.moves.pop(0)
+
def events(self):
for event in pygame.event.get():
if(event.type==pygame.QUIT):
@@ -76,8 +83,9 @@ class MainWindow:
elif(event.type==pygame.MOUSEBUTTONDOWN):
if (type(self.map[0][2]) == Floor):
whatIsIt = self.neurons.whatIsIt(easygui.fileopenbox("Wybierz zdjęcie paczki", "Wybierz zdjęcie paczki", filetypes = [["*.jpg", "*.jpeg", "*.png", "Pliki graficzne"]]))
- where = self.whereDecision.recognize(whatIsIt, self.regalsik())
+ where = self.whereDecision.recognize(whatIsIt, self.regalsik()) #kordy regalu
self.map[0][2] = BoxOnTheFloor(self.screen, self.cell, 0, 2, Box())
+
star = AStar()
path = star.search([self.wheel.ns, self.wheel.we], [0, 2], self.mapForAStar, 1)
cns = self.wheel.ns
@@ -106,6 +114,8 @@ class MainWindow:
continue
break
self.mapForAStar[where[0]][where[1]] = 0
+ # wyszukiwanie ścieżki z miejsca podjęcia paczki do regału
+ # zmienna path posiada macierz oraz kroki podjęte przez wózek
path = star.search([0, 2], where, self.mapForAStar, 1)
self.mapForAStar[where[0]][where[1]] = 1
value = path[cns][cwe]
diff --git a/wheel.py b/wheel.py
index 32fe8b1..3e6ac99 100644
--- a/wheel.py
+++ b/wheel.py
@@ -1,12 +1,13 @@
import pygame
-from floor import Floor
-from boxOnTheFloor import BoxOnTheFloor
-from unboxOnTheFloor import UnboxOnTheFloor
-from shelf import Shelf
+from Mapa.floor import Floor
+from Mapa.boxOnTheFloor import BoxOnTheFloor
+from Mapa.unboxOnTheFloor import UnboxOnTheFloor
+from Mapa.shelf import Shelf
class Wheel:
def __init__(self, screen, cell):
self.cell = cell
+ #kordy wozka
self.ns = 1
self.we = 2
self.direction = 3
@@ -55,7 +56,7 @@ class Wheel:
elif(self.occupied==False and krata[self.ns+1][self.we].isOccupied()==True and krata[self.ns+1][self.we].kierunek==1):
self.putBox(krata[self.ns+1][self.we].get())
self.direction = 3
- elif(type(krata[self.ns+1][self.we])==UnboxOnTheFloor):
+ elif(type(krata[self.ns+1][self.we])==UnboxOnTheFloor): # Aktywacja unBoxOnTheFloor jak wózek najedzie na pole przed nim
if(self.ns+1==len(krata)-1):
self.ns+=1
self.m_ns=self.cell*(-1)
diff --git a/whereDecision.py b/whereDecision.py
index 1962e3a..4d0c95c 100644
--- a/whereDecision.py
+++ b/whereDecision.py
@@ -59,4 +59,5 @@ class WhereDecision:
y = prenumeratorzy["lokacja"]
drzewko = DecisionTreeClassifier(criterion="entropy")
drzewko.fit(X=z, y=y)
- return list(make_tuple(lokacja_kody[drzewko.predict(recognize)][0]))
\ No newline at end of file
+ tmp = list(make_tuple(lokacja_kody[drzewko.predict(recognize)][0]))
+ return tmp
\ No newline at end of file