diff --git a/src/__pycache__/a_star.cpython-38.pyc b/src/__pycache__/a_star.cpython-38.pyc new file mode 100644 index 0000000..d9d4868 Binary files /dev/null and b/src/__pycache__/a_star.cpython-38.pyc differ diff --git a/src/__pycache__/bfs.cpython-38.pyc b/src/__pycache__/bfs.cpython-38.pyc new file mode 100644 index 0000000..734d034 Binary files /dev/null and b/src/__pycache__/bfs.cpython-38.pyc differ diff --git a/src/a_star.py b/src/a_star.py index 2f58549..5f055cd 100644 --- a/src/a_star.py +++ b/src/a_star.py @@ -1,14 +1,15 @@ - +Sh = 200 +St = 10 WAREHOUSE_MAP = [ - [0, 0, 0, 10, 10, 0, 0, 0, 0], - [0, 10, 0, 10, 0, 10, 0, 0, 0], - [0, 10, 0, 0, 0, 200, 200, 200, 200], - [0, 0, 10, 0, 0, 0, 0, 0, 0], - [0, 0, 10, 0, 0, 200, 200, 200, 200], - [0, 0, 10, 10, 0, 0, 0, 0, 0], - [10, 0, 0, 0, 10, 200, 200, 200, 200], - [0, 0, 10, 10, 10, 0, 0, 0, 0], - [0, 10, 0, 0, 0, 200, 200, 200, 200], + [0, 0, 0, St, St, 0, 0, 0, 0], + [0, St, 0, St, 0, St, 0, 0, 0], + [0, St, 0, 0, 0, Sh, Sh, Sh, Sh], + [0, 0, St, 0, 0, 0, 0, 0, 0], + [0, 0, St, 0, 0, Sh, Sh, Sh, Sh], + [0, 0, St, St, 0, 0, 0, 0, 0], + [St, 0, 0, 0, St, Sh, Sh, Sh, Sh], + [0, 0, St, St, St, 0, 0, 0, 0], + [0, St, 0, 0, 0, Sh, Sh, Sh, Sh], ] diff --git a/src/main.py b/src/main.py index 6137488..47e3f5a 100644 --- a/src/main.py +++ b/src/main.py @@ -2,7 +2,7 @@ import pygame import random import time -from src.a_star import a_star_search, WAREHOUSE_MAP +from src.a_star import a_star_search, WAREHOUSE_MAP, St from src.bfs import breadth_first_search pygame.init() @@ -45,7 +45,7 @@ def generate_package(a, b): image_list = ['img/package_grocery.png', 'img/package_explosive.png', 'img/package.png', 'img/package_builders.png'] p1 = Package((a, b), rand_x, name_list[rand_y - 1], image_list[rand_y - 1]) return p1 - + class Package: def __init__(self, pos, content, content_size, pack_image): @@ -197,25 +197,21 @@ Package_list = [ ] -print(a_star_search((6, 8), (0, 0), "down")) - -#agent.path = breadth_first_search(agent.pos_coord, agent.goal, agent.agent_direction) +#print(a_star_search((6, 8), (0, 0), "down")) agent.path = a_star_search((agent.pos_coord[1], agent.pos_coord[0]), (0, 0), agent.agent_direction) - -#print(agent.path) - # Pętla służąca do tworzenia plam oleju na podstawie mapy magazynu Stain_list = [] for index_x in range(9): for index_y in range(9): - if WAREHOUSE_MAP[index_x][index_y] == 10: + if WAREHOUSE_MAP[index_x][index_y] == St: Stain_list.append(Stain((index_y, index_x))) + running = True while running: - + for event in pygame.event.get(): if event.type == pygame.QUIT: running = False diff --git a/src/training_data/scripts/data/training_list_id3.csv b/src/training_data/scripts/data/training_list_id3.csv new file mode 100644 index 0000000..3465b91 --- /dev/null +++ b/src/training_data/scripts/data/training_list_id3.csv @@ -0,0 +1,200 @@ +10,2,2,0,0,4,0 +1,1,4,0,0,5,1 +5,1,10,0,0,10,0 +2,1,2,0,0,3,1 +1,4,9,3,5,3,0 +1,4,2,4,5,2,0 +5,2,7,0,0,1,1 +1,3,4,0,0,7,1 +1,1,2,0,0,4,1 +2,4,8,3,4,2,1 +1,2,2,0,2,3,1 +5,3,5,4,0,3,1 +9,3,3,0,0,2,0 +6,1,1,0,0,5,1 +2,1,3,0,0,1,1 +1,3,8,0,0,6,1 +5,2,1,3,1,5,1 +3,4,1,5,4,5,0 +3,4,7,5,5,1,0 +3,3,2,0,0,10,0 +1,2,6,0,0,8,1 +9,4,8,5,4,1,0 +6,4,3,3,5,5,1 +2,2,9,0,0,3,0 +5,4,2,3,5,5,1 +4,3,6,3,0,9,0 +5,4,2,4,3,4,1 +4,4,1,5,5,2,0 +5,3,3,0,0,1,1 +5,2,3,0,0,7,1 +2,2,1,5,0,4,1 +1,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9,0 +6,3,4,0,0,4,1 +2,1,2,0,0,1,1 +9,3,1,0,0,4,0 +4,1,6,0,0,3,1 +4,2,7,0,0,5,1 +4,2,7,0,0,3,1 +4,2,5,0,1,2,1 +4,1,2,0,0,1,1 +1,1,9,0,0,4,0 +2,3,5,0,0,2,1 +5,1,7,0,0,2,1 +1,2,1,0,0,1,1 +2,3,5,0,0,8,0 +3,3,5,0,0,4,1 +4,4,9,5,5,10,0 +3,2,3,1,0,4,1 +1,1,7,0,0,4,1 +2,2,4,0,0,10,0 +7,4,1,3,2,3,0 +9,1,1,0,0,1,1 +4,1,7,0,0,4,1 +5,1,5,0,0,1,1 +3,2,2,3,2,2,1 +2,1,7,0,0,5,1 +1,2,3,0,2,4,1 +9,2,5,0,0,2,0 +4,3,8,5,0,5,0 +2,2,6,4,0,1,1 +3,3,4,0,2,3,1 +1,3,5,0,0,4,1 +2,4,4,3,3,9,0 +1,2,6,0,0,2,1 \ No newline at end of file diff --git a/src/training_data/scripts/data/training_list_id3.txt b/src/training_data/scripts/data/training_list_id3.txt index 9a5152e..8a5892c 100644 --- a/src/training_data/scripts/data/training_list_id3.txt +++ b/src/training_data/scripts/data/training_list_id3.txt @@ -1,3 +1,4 @@ +# DICT 1-groceries 2-builders 3-electronics 4-dangerous # POZIOM WAGI(1-10), TYP, STOPIEN ROZMIARU(1-10), STOPIEN LATWOPALNOSCI(0-5), STOPIEN WYBUCHOWOSCI(0-5), POZIOM CENY(1-10), PRZYJETY DO MAGAZYNU(tak, nie) # SZYMON \/ #|WAGA|TYP|WYMIAR|LATWOPALNOSC|WYBUCHOWOSC|CENA|PRZYJETY_DO_MAGAZYNU @@ -131,46 +132,46 @@ # BOGDAN \/ #|WAGA|TYP|WYMIAR|LATWOPALNOSC|WYBUCHOWOSC|CENA|PRZYJETY_DO_MAGAZYNU # -1 builders 10 2 0 3 -3 electronics 2 2 0 5 -3 groceries 10 0 0 1 -10 groceries 7 0 0 4 -7 dangerous 2 3 3 4 -8 builders 7 2 0 4 +1 builders 10 2 0 3 nie +3 electronics 2 2 0 5 tak +3 groceries 10 0 0 1 tak +10 groceries 7 0 0 4 nie +7 dangerous 2 3 3 4 nie +8 builders 7 2 0 4 tak 4 electronics 1 0 0 10 -5 builders 1 0 0 9 -6 electronics 4 0 0 4 -2 groceries 2 0 0 1 -9 electronics 1 0 0 4 -4 groceries 6 0 0 3 -4 builders 7 0 0 5 -4 builders 7 0 0 3 -4 builders 5 0 1 2 -4 groceries 2 0 0 1 -1 groceries 9 0 0 4 -2 electronics 5 0 0 2 -5 groceries 7 0 0 2 -1 builders 1 0 0 1 -2 electronics 5 0 0 8 -3 electronics 5 0 0 4 -4 dangerous 9 5 5 10 -3 builders 3 1 0 4 -1 groceries 7 0 0 4 -2 builders 4 0 0 10 -7 dangerous 1 3 2 3 -9 groceries 1 0 0 1 -4 groceries 7 0 0 4 -5 groceries 5 0 0 1 -3 builders 2 3 2 2 -2 groceries 7 0 0 5 -1 builders 3 0 2 4 -9 builders 5 0 0 2 -4 electronics 8 5 0 5 -2 builders 6 4 0 1 -3 electronics 4 0 2 3 -1 electronics 5 0 0 4 -2 dangerous 4 3 3 9 -1 builders 6 0 0 2 +5 builders 1 0 0 9 nie +6 electronics 4 0 0 4 tak +2 groceries 2 0 0 1 tak +9 electronics 1 0 0 4 nie +4 groceries 6 0 0 3 tak +4 builders 7 0 0 5 tak +4 builders 7 0 0 3 tak +4 builders 5 0 1 2 tak +4 groceries 2 0 0 1 tak +1 groceries 9 0 0 4 nie +2 electronics 5 0 0 2 tak +5 groceries 7 0 0 2 tak +1 builders 1 0 0 1 tak +2 electronics 5 0 0 8 nie +3 electronics 5 0 0 4 tak +4 dangerous 9 5 5 10 nie +3 builders 3 1 0 4 tak +1 groceries 7 0 0 4 tak +2 builders 4 0 0 10 nie +7 dangerous 1 3 2 3 nie +9 groceries 1 0 0 1 tak +4 groceries 7 0 0 4 tak +5 groceries 5 0 0 1 tak +3 builders 2 3 2 2 tak +2 groceries 7 0 0 5 tak +1 builders 3 0 2 4 tak +9 builders 5 0 0 2 nie +4 electronics 8 5 0 5 nie +2 builders 6 4 0 1 tak +3 electronics 4 0 2 3 tak +1 electronics 5 0 0 4 tak +2 dangerous 4 3 3 9 nie +1 builders 6 0 0 2 tak # MACIEJ \/ #|WAGA|TYP|WYMIAR|LATWOPALNOSC|WYBUCHOWOSC|CENA|PRZYJETY_DO_MAGAZYNU # diff --git a/src/training_data/scripts/data/training_list_id3_for_csv.txt b/src/training_data/scripts/data/training_list_id3_for_csv.txt new file mode 100644 index 0000000..d27ce23 --- /dev/null +++ b/src/training_data/scripts/data/training_list_id3_for_csv.txt @@ -0,0 +1,201 @@ +weight type size inflammability explosiveness prize allowed_in +10 2 2 0 0 4 0 +1 1 4 0 0 5 1 +5 1 10 0 0 10 0 +2 1 2 0 0 3 1 +1 4 9 3 5 3 0 +1 4 2 4 5 2 0 +5 2 7 0 0 1 1 +1 3 4 0 0 7 1 +1 1 2 0 0 4 1 +2 4 8 3 4 2 1 +1 2 2 0 2 3 1 +5 3 5 4 0 3 1 +9 3 3 0 0 2 0 +6 1 1 0 0 5 1 +2 1 3 0 0 1 1 +1 3 8 0 0 6 1 +5 2 1 3 1 5 1 +3 4 1 5 4 5 0 +3 4 7 5 5 1 0 +3 3 2 0 0 10 0 +1 2 6 0 0 8 1 +9 4 8 5 4 1 0 +6 4 3 3 5 5 1 +2 2 9 0 0 3 0 +5 4 2 3 5 5 1 +4 3 6 3 0 9 0 +5 4 2 4 3 4 1 +4 4 1 5 5 2 0 +5 3 3 0 0 1 1 +5 2 3 0 0 7 1 +2 2 1 5 0 4 1 +1 1 7 0 0 5 1 +3 2 4 2 0 5 1 +9 2 4 0 0 3 0 +10 1 5 0 0 3 0 +5 4 10 3 5 5 0 +4 3 3 0 0 4 1 +1 2 3 2 0 9 1 +4 1 3 0 0 2 1 +10 3 3 0 0 3 0 +10 2 1 0 0 5 0 +4 4 5 3 2 2 0 +2 3 1 0 0 4 1 +8 4 7 5 4 7 0 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 8 0 +3 3 5 0 0 4 1 +4 4 9 5 5 10 0 +3 2 3 1 0 4 1 +1 1 7 0 0 4 1 +2 2 4 0 0 10 0 +7 4 1 3 2 3 0 +9 1 1 0 0 1 1 +4 1 7 0 0 4 1 +5 1 5 0 0 1 1 +3 2 2 3 2 2 1 +2 1 7 0 0 5 1 +1 2 3 0 2 4 1 +9 2 5 0 0 2 0 +4 3 8 5 0 5 0 +2 2 6 4 0 1 1 +3 3 4 0 2 3 1 +1 3 5 0 0 4 1 +2 4 4 3 3 9 0 +1 2 6 0 0 2 1 diff --git a/src/tree.py b/src/tree.py new file mode 100644 index 0000000..39c121d --- /dev/null +++ b/src/tree.py @@ -0,0 +1,52 @@ +import joblib +import matplotlib.pyplot as plt +import pandas +from sklearn import tree +from sklearn.tree import DecisionTreeClassifier + +columns = ["weight", "type", "size", "inflammability", "explosiveness", "prize", "allowed_in"] +attributes = ["weight", "type", "size", "inflammability", "explosiveness", "prize"] +decisions = ["allowed_in"] + + +def learning_tree(): + dataset = pandas.read_csv('./training_data/scripts/data/training_list_id3.csv', header=None, names=columns) + dataset.head() + x = dataset[attributes] + y = dataset.allowed_in + + decision_tree = DecisionTreeClassifier() + decision_tree = decision_tree.fit(x, y) + + return decision_tree + + +def making_decision(decision_tree, weight, type, size, inflammability, explosiveness, prize): + decision = decision_tree.predict([[weight, type, size, inflammability, explosiveness, prize]]) + return decision + + +def save_all(decision_tree): + save_tree_to_png(decision_tree) + save_tree_to_txt(decision_tree) + save_tree_to_structure(decision_tree) + + +def save_tree_to_txt(decision_tree): + with open('tree/tree_in_txt.txt', "w") as file: + file.write(tree.export_text(decision_tree)) + + +def save_tree_to_png(decision_tree): + fig = plt.figure(figsize=(25, 20)) + _ = tree.plot_tree(decision_tree, feature_names=attributes, filled=True) + fig.savefig('tree/decision_tree.png') + + +def save_tree_to_structure(decision_tree): + joblib.dump(decision_tree, 'tree/tree_model') + + +def load_tree_from_structure(file): + return joblib.load(file) + diff --git a/src/tree/decision_tree.png b/src/tree/decision_tree.png new file mode 100644 index 0000000..8577b06 Binary files /dev/null and b/src/tree/decision_tree.png differ diff --git a/src/tree/tree_in_txt.txt b/src/tree/tree_in_txt.txt new file mode 100644 index 0000000..012f0fa --- /dev/null +++ b/src/tree/tree_in_txt.txt @@ -0,0 +1,142 @@ +|--- feature_3 <= 2.50 +| |--- feature_5 <= 9.50 +| | |--- feature_0 <= 8.50 +| | | |--- feature_2 <= 7.50 +| | | | |--- feature_5 <= 7.50 +| | | | | |--- feature_2 <= 2.50 +| | | | | | |--- feature_1 <= 2.50 +| | | | | | | |--- class: 1 +| | | | | | |--- feature_1 > 2.50 +| | | | | | | |--- feature_2 <= 1.50 +| | | | | | | | |--- class: 1 +| | | | | | | |--- feature_2 > 1.50 +| | | | | | | | |--- feature_5 <= 3.00 +| | | | | | | | | |--- class: 1 +| | | | | | | | |--- feature_5 > 3.00 +| | | | | | | | | |--- feature_3 <= 1.00 +| | | | | | | | | | |--- class: 0 +| | | | | | | | | |--- feature_3 > 1.00 +| | | | | | | | | | |--- class: 1 +| | | | | |--- feature_2 > 2.50 +| | | | | | |--- class: 1 +| | | | |--- feature_5 > 7.50 +| | | | | |--- feature_3 <= 0.50 +| | | | | | |--- feature_2 <= 2.50 +| | | | | | | |--- class: 0 +| | | | | | |--- feature_2 > 2.50 +| | | | | | | |--- feature_0 <= 3.50 +| | | | | | | | |--- feature_2 <= 5.50 +| | | | | | | | | |--- class: 0 +| | | | | | | | |--- feature_2 > 5.50 +| | | | | | | | | |--- class: 1 +| | | | | | | |--- feature_0 > 3.50 +| | | | | | | | |--- class: 1 +| | | | | |--- feature_3 > 0.50 +| | | | | | |--- class: 1 +| | | |--- feature_2 > 7.50 +| | | | |--- feature_1 <= 2.50 +| | | | | |--- feature_2 <= 9.50 +| | | | | | |--- class: 0 +| | | | | |--- feature_2 > 9.50 +| | | | | | |--- feature_5 <= 2.00 +| | | | | | | |--- class: 1 +| | | | | | |--- feature_5 > 2.00 +| | | | | | | |--- class: 0 +| | | | |--- feature_1 > 2.50 +| | | | | |--- feature_2 <= 9.00 +| | | | | | |--- class: 1 +| | | | | |--- feature_2 > 9.00 +| | | | | | |--- class: 0 +| | |--- feature_0 > 8.50 +| | | |--- feature_5 <= 1.50 +| | | | |--- class: 1 +| | | |--- feature_5 > 1.50 +| | | | |--- feature_5 <= 6.50 +| | | | | |--- feature_2 <= 4.50 +| | | | | | |--- feature_1 <= 1.50 +| | | | | | | |--- feature_0 <= 9.50 +| | | | | | | | |--- class: 0 +| | | | | | | |--- feature_0 > 9.50 +| | | | | | | | |--- class: 1 +| | | | | | |--- feature_1 > 1.50 +| | | | | | | |--- class: 0 +| | | | | |--- feature_2 > 4.50 +| | | | | | |--- feature_1 <= 2.50 +| | | | | | | |--- class: 0 +| | | | | | |--- feature_1 > 2.50 +| | | | | | | |--- feature_4 <= 1.00 +| | | | | | | | |--- class: 1 +| | | | | | | |--- feature_4 > 1.00 +| | | | | | | | |--- class: 0 +| | | | |--- feature_5 > 6.50 +| | | | | |--- class: 1 +| |--- feature_5 > 9.50 +| | |--- feature_4 <= 0.50 +| | | |--- class: 0 +| | |--- feature_4 > 0.50 +| | | |--- class: 1 +|--- feature_3 > 2.50 +| |--- feature_3 <= 4.50 +| | |--- feature_2 <= 8.50 +| | | |--- feature_0 <= 1.50 +| | | | |--- feature_1 <= 3.50 +| | | | | |--- feature_5 <= 3.00 +| | | | | | |--- class: 1 +| | | | | |--- feature_5 > 3.00 +| | | | | | |--- class: 0 +| | | | |--- feature_1 > 3.50 +| | | | | |--- class: 0 +| | | |--- feature_0 > 1.50 +| | | | |--- feature_0 <= 6.50 +| | | | | |--- feature_0 <= 4.50 +| | | | | | |--- feature_5 <= 7.00 +| | | | | | | |--- feature_0 <= 2.50 +| | | | | | | | |--- class: 1 +| | | | | | | |--- feature_0 > 2.50 +| | | | | | | | |--- feature_2 <= 6.00 +| | | | | | | | | |--- feature_4 <= 2.50 +| | | | | | | | | | |--- feature_1 <= 3.00 +| | | | | | | | | | | |--- class: 1 +| | | | | | | | | | |--- feature_1 > 3.00 +| | | | | | | | | | | |--- class: 0 +| | | | | | | | | |--- feature_4 > 2.50 +| | | | | | | | | | |--- class: 1 +| | | | | | | | |--- feature_2 > 6.00 +| | | | | | | | | |--- feature_3 <= 3.50 +| | | | | | | | | | |--- class: 0 +| | | | | | | | | |--- feature_3 > 3.50 +| | | | | | | | | | |--- feature_0 <= 3.50 +| | | | | | | | | | | |--- class: 0 +| | | | | | | | | | |--- feature_0 > 3.50 +| | | | | | | | | | | |--- class: 1 +| | | | | | |--- feature_5 > 7.00 +| | | | | | | |--- class: 0 +| | | | | |--- feature_0 > 4.50 +| | | | | | |--- class: 1 +| | | | |--- feature_0 > 6.50 +| | | | | |--- feature_5 <= 2.50 +| | | | | | |--- feature_4 <= 4.50 +| | | | | | | |--- class: 1 +| | | | | | |--- feature_4 > 4.50 +| | | | | | | |--- class: 0 +| | | | | |--- feature_5 > 2.50 +| | | | | | |--- class: 0 +| | |--- feature_2 > 8.50 +| | | |--- class: 0 +| |--- feature_3 > 4.50 +| | |--- feature_0 <= 2.50 +| | | |--- feature_2 <= 2.50 +| | | | |--- class: 1 +| | | |--- feature_2 > 2.50 +| | | | |--- class: 0 +| | |--- feature_0 > 2.50 +| | | |--- feature_4 <= 0.50 +| | | | |--- feature_0 <= 5.50 +| | | | | |--- class: 0 +| | | | |--- feature_0 > 5.50 +| | | | | |--- feature_0 <= 8.00 +| | | | | | |--- class: 1 +| | | | | |--- feature_0 > 8.00 +| | | | | | |--- class: 0 +| | | |--- feature_4 > 0.50 +| | | | |--- class: 0 diff --git a/src/tree/tree_model b/src/tree/tree_model new file mode 100644 index 0000000..4d057f3 Binary files /dev/null and b/src/tree/tree_model differ