diff --git a/.idea/misc.xml b/.idea/misc.xml index 52c15d7..715ed69 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e7d3537..9bdf8d2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,12 +2,19 @@ +<<<<<<< HEAD +======= + + + + +>>>>>>> upstream/master + + + + + @@ -49,7 +65,7 @@ - + +<<<<<<< HEAD +======= + + + + +>>>>>>> upstream/master +<<<<<<< HEAD +======= + + + + + + + + +>>>>>>> upstream/master @@ -118,10 +171,41 @@ +<<<<<<< HEAD +======= + + + + + + + + 1589815443652 + + + 1589816028640 + + + 1589822196451 + + @@ -140,10 +224,22 @@ + + + + + +<<<<<<< HEAD +======= + + +>>>>>>> upstream/master + \ No newline at end of file diff --git a/.idea/workspace.xml.orig b/.idea/workspace.xml.orig new file mode 100644 index 0000000..9bdf8d2 --- /dev/null +++ b/.idea/workspace.xml.orig @@ -0,0 +1,245 @@ + + + + +<<<<<<< HEAD + + + + + + +======= + + + + +>>>>>>> upstream/master + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<<<<<<< HEAD + +======= + + + + +>>>>>>> upstream/master + + + +<<<<<<< HEAD + + + + + +======= + + + + + + + + +>>>>>>> upstream/master + + + + + + + + + + + 1589206421672 + + + 1589815443652 + + + 1589816028640 + + + 1589822196451 + + + + + + + + + + + + + +<<<<<<< HEAD + + + +======= + + +>>>>>>> upstream/master + + + + \ No newline at end of file diff --git a/.idea/wozek.iml b/.idea/wozek.iml index 85c7612..a9742fc 100644 --- a/.idea/wozek.iml +++ b/.idea/wozek.iml @@ -4,7 +4,7 @@ - + diff --git a/Assiging/feature_hashing.py b/Assiging/feature_hashing.py new file mode 100644 index 0000000..479b42f --- /dev/null +++ b/Assiging/feature_hashing.py @@ -0,0 +1,5 @@ +from sklearn.feature_extraction import FeatureHasher +from data import create_data_dict + +data = create_data_dict() +print(data) \ No newline at end of file diff --git a/__pycache__/data.cpython-37.pyc b/__pycache__/data.cpython-37.pyc index 90788d5..77ec7fd 100644 Binary files a/__pycache__/data.cpython-37.pyc and b/__pycache__/data.cpython-37.pyc differ diff --git a/__pycache__/field.cpython-37.pyc b/__pycache__/field.cpython-37.pyc index 4e6a06c..2a25f24 100644 Binary files a/__pycache__/field.cpython-37.pyc and b/__pycache__/field.cpython-37.pyc differ diff --git a/__pycache__/shelf.cpython-37.pyc b/__pycache__/shelf.cpython-37.pyc new file mode 100644 index 0000000..12cbc7c Binary files /dev/null and b/__pycache__/shelf.cpython-37.pyc differ diff --git a/data.py b/data.py index 679b5d5..4c3a444 100644 --- a/data.py +++ b/data.py @@ -1,7 +1,7 @@ from sweets import Sweets -def createDataSweets(): +def create_data_sweets(): allProducts = [] sweet = Sweets('Mars', 'czekoladowy', 'baton', 'sredni', 2.49) @@ -57,4 +57,31 @@ learning_data = [ ['red', 'jar', 250, 'medium', 'Strawberry Jam'], ['black', 'jar', 250, 'medium', 'Blackberry Jam'], ['orange', 'jar', 250, 'medium', 'Peach Jam'], -] \ No newline at end of file +] + + +def create_data_dict(): + products_as_dict = [] + + sweet = Sweets('Mars', 'czekoladowy', 'baton', 'sredni', 2.49) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Mars', 'czekoladowy', 'czekolada', 'duzy', 4.99) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Mars', 'czekoladowy', 'czekolada', 'ogromny', 11.26) + products_as_dict.append(vars(sweet)) + sweet = Sweets('M&M', 'czekoladowy', 'czekolada', 'duzy', 3.99) + products_as_dict.append(vars(sweet)) + sweet = Sweets('M&M', 'czekoladowy', 'baton', 'sredni', 2.89) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Nestle', 'bananowy', 'landrynka', 'maly', 0.39) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Nestle', 'truskawkowy', 'landrynka', 'maly', 0.39) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Nestle', 'cola', 'landrynka', 'maly', 0.49) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Wedel', 'czekoladowy', 'baton', 'sredni', 1.99) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Maoam', 'truskawkowy', 'guma', 'maly', 0.25) + products_as_dict.append(vars(sweet)) + + return products_as_dict diff --git a/data.py.orig b/data.py.orig new file mode 100644 index 0000000..d7b921a --- /dev/null +++ b/data.py.orig @@ -0,0 +1,91 @@ +from sweets import Sweets + + +def create_data_sweets(): + allProducts = [] + + sweet = Sweets('Mars', 'czekoladowy', 'baton', 'sredni', 2.49) + allProducts.append(sweet) + sweet = Sweets('Mars', 'czekoladowy', 'czekolada', 'duzy', 4.99) + allProducts.append(sweet) + sweet = Sweets('Mars', 'czekoladowy', 'czekolada', 'ogromny', 11.26) + allProducts.append(sweet) + sweet = Sweets('M&M', 'czekoladowy', 'czekolada', 'duzy', 3.99) + allProducts.append(sweet) + sweet = Sweets('M&M', 'czekoladowy', 'baton', 'sredni', 2.89) + allProducts.append(sweet) + sweet = Sweets('Nestle', 'bananowy', 'landrynka', 'maly', 0.39) + allProducts.append(sweet) + sweet = Sweets('Nestle', 'truskawkowy', 'landrynka', 'maly', 0.39) + allProducts.append(sweet) + sweet = Sweets('Nestle', 'cola', 'landrynka', 'maly', 0.49) + allProducts.append(sweet) + sweet = Sweets('Wedel', 'czekoladowy', 'baton', 'sredni', 1.99) + allProducts.append(sweet) + sweet = Sweets('Maoam', 'truskawkowy', 'guma', 'maly', 0.25) + allProducts.append(sweet) + +<<<<<<< HEAD + return allProducts + + +learning_data = [ + # kolor, kształt, waga, rozmiar, nazwa + ['black', 'rectangle', 51, 'small', 'Mars'], + ['gold', 'pack', 100, 'big', 'Haribo'], + ['purple', 'rectangle', 100, 'big', 'Milka'], + ['brown', 'pack', 45, 'small', 'M&M'], + ['blue', 'rectangle', 50, 'medium', 'Bounty'], + ['blue', 'square', 40, 'small', 'Knoppers'], + ['blue', 'rectangle', 35, 'small', 'Milky-way'], + ['gold', 'rectangle', 40, 'medium', 'Twix'], + ['gold', 'rectangle', 50, 'medium', 'Prince-polo'], + ['brown', 'rectangle', 55, 'medium', 'Snickers'], + ['brown', 'rectangle', 45, 'medium', 'Lion'], + ['white', 'rectangle', 40, 'medium', 'Kinder-bueno'], + ['red', 'rectangle', 50, 'medium', 'Kit-kat'], + ['blue', 'rectangle', 115, 'big', 'Wedel'], + ['white', 'rectangle', 15, 'small', 'Krowka'], + ['red', 'pack', 70, 'medium', 'Skittles'], + ['orange', 'rectangle', 45, 'medium', 'Reeses'], + ['blue', 'rectangle', 55, 'medium', 'Oreo'], + ['gold', 'rectangle', 120, 'big', 'Ferrero-rocher'], + ['white', 'rectangle', 120, 'big', 'Rafaello'], + ['white', 'jar', 600, 'big', 'Nutella'], + ['white', 'rectangle', 25, 'small', 'Duplo'], + ['brown', 'jar', 500, 'big', 'GoOn'], + ['brown', 'jar', 470, 'big', 'Active Orzechowe'], + ['red', 'jar', 250, 'medium', 'Strawberry Jam'], + ['black', 'jar', 250, 'medium', 'Blackberry Jam'], + ['orange', 'jar', 250, 'medium', 'Peach Jam'], +] +======= + return allProducts + + +def create_data_dict(): + products_as_dict = [] + + sweet = Sweets('Mars', 'czekoladowy', 'baton', 'sredni', 2.49) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Mars', 'czekoladowy', 'czekolada', 'duzy', 4.99) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Mars', 'czekoladowy', 'czekolada', 'ogromny', 11.26) + products_as_dict.append(vars(sweet)) + sweet = Sweets('M&M', 'czekoladowy', 'czekolada', 'duzy', 3.99) + products_as_dict.append(vars(sweet)) + sweet = Sweets('M&M', 'czekoladowy', 'baton', 'sredni', 2.89) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Nestle', 'bananowy', 'landrynka', 'maly', 0.39) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Nestle', 'truskawkowy', 'landrynka', 'maly', 0.39) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Nestle', 'cola', 'landrynka', 'maly', 0.49) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Wedel', 'czekoladowy', 'baton', 'sredni', 1.99) + products_as_dict.append(vars(sweet)) + sweet = Sweets('Maoam', 'truskawkowy', 'guma', 'maly', 0.25) + products_as_dict.append(vars(sweet)) + + return products_as_dict +>>>>>>> upstream/master diff --git a/field.py b/field.py index 99ade93..d90ffa6 100644 --- a/field.py +++ b/field.py @@ -1,4 +1,5 @@ import pygame +from shelf import Shelf class Field: @@ -14,6 +15,7 @@ class Field: self.is_occupied_by_agent = is_occupied_by_agent self.cost_of_travel = cost_of_travel self.neighbors = [] + self.shelves = [] # Te parametry są potrzebne do algorytmu A* self.g = 0 @@ -44,4 +46,8 @@ class Field: if self.y > 0 and board[self.y - 1][self.x].is_shelf == False: self.neighbors.append(board[self.y - 1][self.x]) if self.y < 9 and board[self.y + 1][self.x].is_shelf == False: - self.neighbors.append(board[self.y + 1][self.x]) \ No newline at end of file + self.neighbors.append(board[self.y + 1][self.x]) + + def addShelf(self): + shelf = Shelf(len(self.shelves)+1) + self.shelves.append(shelf) \ No newline at end of file diff --git a/main.py b/main.py index 6a0a9cc..f71fa65 100644 --- a/main.py +++ b/main.py @@ -62,7 +62,7 @@ def run(): next_step = path.pop() else: next_step = None - print(next_step, path) + # print(next_step, path) for row in board: for field in row: if not field.is_shelf: diff --git a/route-planning.md b/route-planning.md index ca850b4..a858ead 100644 --- a/route-planning.md +++ b/route-planning.md @@ -93,7 +93,6 @@ let winner = 0; let current = openSet[winner]; ``` - ### Definicja przyjętej heurystyki Jest to szacowana odległość od sprawdzanego pola do celu. Obliczana jest jako `Manhattan Distance`, ponieważ w naszym modelu Agent nie może poruszać się po skosie. diff --git a/shelf.py b/shelf.py new file mode 100644 index 0000000..3e318d7 --- /dev/null +++ b/shelf.py @@ -0,0 +1,11 @@ +import pygame + + +class Shelf: + + def __init__(self, id): + self.id = id + self.products = [] + + def addProduct(self, sweet): + self.products.append(sweet)