From dfe2e5041423ad9720cb3741457bcb052fbac39d Mon Sep 17 00:00:00 2001 From: shaaqu Date: Mon, 18 May 2020 17:24:03 +0200 Subject: [PATCH 1/6] create Shelf --- .idea/misc.xml | 2 +- .idea/workspace.xml | 29 +++++++++++++++++++++++------ .idea/wozek.iml | 2 +- shelf.py | 12 ++++++++++++ 4 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 shelf.py diff --git a/.idea/misc.xml b/.idea/misc.xml index 52c15d7..8656114 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 95a134d..fcf7da5 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,10 +2,10 @@ - + + - - + + @@ -29,6 +34,7 @@ + @@ -120,15 +135,17 @@ - + + - - + + \ No newline at end of file diff --git a/.idea/wozek.iml b/.idea/wozek.iml index 85c7612..fa80a76 100644 --- a/.idea/wozek.iml +++ b/.idea/wozek.iml @@ -4,7 +4,7 @@ - + diff --git a/shelf.py b/shelf.py new file mode 100644 index 0000000..eb9e8f7 --- /dev/null +++ b/shelf.py @@ -0,0 +1,12 @@ +import pygame + +class Shelf: + + def __init__(self, id, field): + self.id = id + self.field = field + self.products = [] + + def addProduct(self, sweet): + self.products.append(sweet) + From 8ec5e96e8cd6caba84277c279cc65a6860638f22 Mon Sep 17 00:00:00 2001 From: shaaqu Date: Mon, 18 May 2020 17:33:48 +0200 Subject: [PATCH 2/6] create addShelf method in Field class --- .idea/workspace.xml | 19 +++++++++++++++---- field.py | 8 +++++++- shelf.py | 5 ++--- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index fcf7da5..5c1c2d0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,10 +2,9 @@ - - - + + @@ -143,6 +150,10 @@ + + + diff --git a/field.py b/field.py index 033612c..c425d69 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 @@ -41,4 +43,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/shelf.py b/shelf.py index eb9e8f7..3e318d7 100644 --- a/shelf.py +++ b/shelf.py @@ -1,12 +1,11 @@ import pygame + class Shelf: - def __init__(self, id, field): + def __init__(self, id): self.id = id - self.field = field self.products = [] def addProduct(self, sweet): self.products.append(sweet) - From 88cc968b0abb1317b7de1537775f23a4e5207c22 Mon Sep 17 00:00:00 2001 From: shaaqu Date: Mon, 18 May 2020 19:16:36 +0200 Subject: [PATCH 3/6] changed CreateDataSweets to lowercase --- .idea/workspace.xml | 21 ++++++++++++++++----- Assiging/feature_hashing.py | 6 ++++++ data.py | 2 +- 3 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 Assiging/feature_hashing.py diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 5c1c2d0..a22380b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,9 @@ + - - + + + + @@ -122,7 +125,7 @@ - + 1589815443652 @@ -131,7 +134,14 @@ - @@ -152,7 +162,8 @@ - diff --git a/Assiging/feature_hashing.py b/Assiging/feature_hashing.py new file mode 100644 index 0000000..b225e0a --- /dev/null +++ b/Assiging/feature_hashing.py @@ -0,0 +1,6 @@ +from sklearn.feature_extraction import FeatureHasher +from data import create_data_sweets + +data = create_data_sweets() + + diff --git a/data.py b/data.py index 8d55fcd..c101d40 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) From bfd63cb1dcdc0714f7c847a9608883f01d64afcf Mon Sep 17 00:00:00 2001 From: shaaqu Date: Mon, 18 May 2020 19:39:40 +0200 Subject: [PATCH 4/6] create datadict --- .idea/workspace.xml | 44 ++++++++++++++++++++++++++++++++----- Assiging/datadict.py | 28 +++++++++++++++++++++++ Assiging/feature_hashing.py | 5 ++--- data.py | 2 +- 4 files changed, 70 insertions(+), 9 deletions(-) create mode 100644 Assiging/datadict.py diff --git a/.idea/workspace.xml b/.idea/workspace.xml index a22380b..bdc85db 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,9 @@ - + + - + + + + @@ -163,10 +195,12 @@ - + diff --git a/Assiging/datadict.py b/Assiging/datadict.py new file mode 100644 index 0000000..844b4b8 --- /dev/null +++ b/Assiging/datadict.py @@ -0,0 +1,28 @@ +from sweets import Sweets + + +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/Assiging/feature_hashing.py b/Assiging/feature_hashing.py index b225e0a..0b999c9 100644 --- a/Assiging/feature_hashing.py +++ b/Assiging/feature_hashing.py @@ -1,6 +1,5 @@ from sklearn.feature_extraction import FeatureHasher -from data import create_data_sweets - -data = create_data_sweets() + +print(f.toarray()) \ No newline at end of file diff --git a/data.py b/data.py index c101d40..659a169 100644 --- a/data.py +++ b/data.py @@ -25,4 +25,4 @@ def create_data_sweets(): sweet = Sweets('Maoam', 'truskawkowy', 'guma', 'maly', 0.25) allProducts.append(sweet) - return allProducts \ No newline at end of file + return allProducts From 0630d99a4804666953d2e82f51c110d0471cd610 Mon Sep 17 00:00:00 2001 From: shaaqu Date: Mon, 18 May 2020 19:43:25 +0200 Subject: [PATCH 5/6] moved create_data_dict to data file; deleted datadict file --- .idea/workspace.xml | 2 +- Assiging/datadict.py | 28 ---------------------------- Assiging/feature_hashing.py | 6 +++--- data.py | 27 +++++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 32 deletions(-) delete mode 100644 Assiging/datadict.py diff --git a/.idea/workspace.xml b/.idea/workspace.xml index bdc85db..e8d76cf 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -200,7 +200,7 @@ - + diff --git a/Assiging/datadict.py b/Assiging/datadict.py deleted file mode 100644 index 844b4b8..0000000 --- a/Assiging/datadict.py +++ /dev/null @@ -1,28 +0,0 @@ -from sweets import Sweets - - -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/Assiging/feature_hashing.py b/Assiging/feature_hashing.py index 0b999c9..479b42f 100644 --- a/Assiging/feature_hashing.py +++ b/Assiging/feature_hashing.py @@ -1,5 +1,5 @@ from sklearn.feature_extraction import FeatureHasher +from data import create_data_dict - - -print(f.toarray()) \ No newline at end of file +data = create_data_dict() +print(data) \ No newline at end of file diff --git a/data.py b/data.py index 659a169..ac9ddb2 100644 --- a/data.py +++ b/data.py @@ -26,3 +26,30 @@ def create_data_sweets(): allProducts.append(sweet) 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 From cd6a2191f7688a008022f339ac0383e2018fad90 Mon Sep 17 00:00:00 2001 From: Tomek Date: Tue, 19 May 2020 12:20:50 +0200 Subject: [PATCH 6/6] sprwdzenie poprawnosci dzialania mojego lokalnego repozytorum --- route-planning.md | 1 - 1 file changed, 1 deletion(-) 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.