Compare commits
No commits in common. "master" and "master" have entirely different histories.
14
res/map.txt
@ -1,14 +1,14 @@
|
||||
MP--H---------------------
|
||||
RORRRRRRRRRRRRRRRRR---G---
|
||||
SZ--G------G------R---GGG-
|
||||
----G------G------R---G---
|
||||
-RRRG------GGGGGGGRRRRR---
|
||||
RRRRRRRRRRRRRRRRRRR---G---
|
||||
SZ--R------G------R---GGG-
|
||||
----R------G------R---G---
|
||||
-RRRR------GGGGGGGRRRRR---
|
||||
-R--G-------------R-------
|
||||
-R--GGGGGGGGGRRRRRRH------
|
||||
-R--GGGGGGGGGGGGGGRH------
|
||||
-R--G---G---GH----R-------
|
||||
-R--G---G---G-----RRRRRRR-
|
||||
-R--G---G---GH----RRRRRRR-
|
||||
-R--G-------H-----R-------
|
||||
-R--G-----G----G--R-------
|
||||
-R--G-----G----G--R-------
|
||||
-RRRRRRRRRRRRRRRRRRRRRRR--
|
||||
-RRRRRRRRRRRRRRRRRRRORRR--
|
||||
--------------------------
|
384
src/agent.py
@ -1,27 +1,6 @@
|
||||
import random
|
||||
import pygame as pg
|
||||
import heapq
|
||||
from decisiontree import decision
|
||||
from trashtype import trash_type_def
|
||||
import genetics
|
||||
|
||||
HOUSE_NUMBER = {'House_number': 0}
|
||||
|
||||
|
||||
class Node:
|
||||
def __init__(self, state, parent, cost):
|
||||
self.state = state
|
||||
self.parent = parent
|
||||
self.cost = cost
|
||||
|
||||
def __lt__(self, other):
|
||||
return self.cost < other.cost
|
||||
|
||||
|
||||
class State:
|
||||
def __init__(self, position, house_list):
|
||||
self.position = position
|
||||
self.house_list = house_list
|
||||
|
||||
|
||||
def vector_to_tuple(vector):
|
||||
@ -31,111 +10,10 @@ def vector_to_tuple(vector):
|
||||
|
||||
class HousePOI:
|
||||
def __init__(self):
|
||||
from simulation import Interface
|
||||
self.season = Interface.season.season
|
||||
self.day = Interface.day.day
|
||||
self.truck_fullness = None
|
||||
self.payment = None
|
||||
self.bin_fullness = None
|
||||
self.trash_type = None
|
||||
self.trash = 1
|
||||
self.dump_fullness = 0
|
||||
self.bins = None
|
||||
|
||||
|
||||
def discover_bins(self, bin_fullness, trash_type, payment):
|
||||
from simulation import Interface
|
||||
|
||||
season_autumn = 0
|
||||
season_spring = 0
|
||||
season_summer = 0
|
||||
season_winter = 0
|
||||
day_friday = 0
|
||||
day_monday = 0
|
||||
day_wednesday = 0
|
||||
trash_types_glass = 0
|
||||
trash_types_biological = 0
|
||||
trash_types_paper = 0
|
||||
trash_types_plastic = 0
|
||||
truck_fullness = 0
|
||||
|
||||
guessed_trash_type = trash_type_def(trash_type)
|
||||
|
||||
self.truck_fullness = Interface.truck_fullness.fullness
|
||||
self.payment = payment
|
||||
self.bin_fullness = bin_fullness
|
||||
self.trash_type = guessed_trash_type[0]
|
||||
|
||||
if self.season == 'autumn':
|
||||
season_autumn = 1
|
||||
if self.season == 'spring':
|
||||
season_spring = 1
|
||||
if self.season == 'summer':
|
||||
season_summer = 1
|
||||
if self.season == 'winter':
|
||||
season_winter = 1
|
||||
if self.day == 'friday':
|
||||
day_friday = 1
|
||||
if self.day == 'monday':
|
||||
day_monday = 1
|
||||
if self.day == 'wednesday':
|
||||
day_wednesday = 1
|
||||
if self.trash_type == 'glass':
|
||||
trash_types_glass = 1
|
||||
truck_fullness = self.truck_fullness["glass"]
|
||||
if self.trash_type == 'biological':
|
||||
trash_types_biological = 1
|
||||
truck_fullness = self.truck_fullness["biological"]
|
||||
if self.trash_type == 'paper':
|
||||
trash_types_paper = 1
|
||||
truck_fullness = self.truck_fullness["paper"]
|
||||
if self.trash_type == 'plastic':
|
||||
trash_types_plastic = 1
|
||||
truck_fullness = self.truck_fullness["plastic"]
|
||||
if truck_fullness < 1:
|
||||
truck_fullness = 0
|
||||
if truck_fullness == 1:
|
||||
truck_fullness = 1
|
||||
dec_tree = {'dump_fullness': [self.dump_fullness],
|
||||
'truck_fullness': [truck_fullness],
|
||||
'trash': [self.trash],
|
||||
'payment': [payment],
|
||||
'bin_fullness': [bin_fullness],
|
||||
'trash_types_glass': [trash_types_glass],
|
||||
'trash_types_mixed': [trash_types_biological],
|
||||
'trash_types_paper': [trash_types_paper],
|
||||
'trash_types_plastic': [trash_types_plastic],
|
||||
'season_autumn': [season_autumn],
|
||||
'season_spring': [season_spring],
|
||||
'season_summer': [season_summer],
|
||||
'season_winter': [season_winter],
|
||||
'day_friday': [day_friday],
|
||||
'day_monday': [day_monday],
|
||||
'day_wednesday': [day_wednesday]
|
||||
}
|
||||
outcome = decision(dec_tree)
|
||||
if outcome == 1:
|
||||
Interface.truck_fullness.fullness[trash_type] += 0.25 # 0.25
|
||||
|
||||
debug(dec_tree, outcome, trash_type, guessed_trash_type[0], guessed_trash_type[1], self.season, self.day, self.bin_fullness,
|
||||
self.truck_fullness)
|
||||
|
||||
|
||||
def debug(dec_tree, outcome, trash_type, guessed_trash_type, filename, season, day, bin_fullness, truck_fullness):
|
||||
HOUSE_NUMBER['House_number'] += 1
|
||||
print("Domek nr: " + str(HOUSE_NUMBER['House_number']))
|
||||
if outcome == 1:
|
||||
print("Odebrano śmieci")
|
||||
if outcome == 0:
|
||||
print("Nie odebrano śmieci")
|
||||
print("Pora: " + season)
|
||||
print("Dzień: " + day)
|
||||
print("Typ śmieci: " + trash_type)
|
||||
print("Nazwa pliku: " + trash_type + str(filename))
|
||||
print("Zaobserwowane: " + guessed_trash_type)
|
||||
print("Zapełnienie domu: " + str(bin_fullness))
|
||||
print(truck_fullness)
|
||||
print(dec_tree)
|
||||
print("####################################################################################")
|
||||
def discover_bins(self, bins):
|
||||
self.bins = bins
|
||||
|
||||
|
||||
class Agent:
|
||||
@ -148,44 +26,44 @@ class Agent:
|
||||
self.fullness = None
|
||||
self.weights = {}
|
||||
self.orientation = 90
|
||||
self.genetic_house_list = None
|
||||
|
||||
|
||||
# utworzenie grafu dróg
|
||||
roads_pos = [vector_to_tuple(pos) for pos in
|
||||
self.simulation.state.road_pos_g + self.simulation.state.road_pos_r]
|
||||
roads_pos = [vector_to_tuple(pos) for pos in self.simulation.state.road_pos_g + self.simulation.state.road_pos_r]
|
||||
roads_pos.sort()
|
||||
for index, pos in enumerate(roads_pos):
|
||||
if pos[0] < 0 or pos[0] >= 27 or pos[1] < 0 or pos[1] >= 14:
|
||||
continue
|
||||
for another_pos in roads_pos[index:]:
|
||||
if pos == another_pos or another_pos[0] < 0 or another_pos[0] >= 27 or another_pos[1] < 0 or \
|
||||
another_pos[1] >= 14:
|
||||
if pos == another_pos or another_pos[0] < 0 or another_pos[0] >= 27 or another_pos[1] < 0 or another_pos[1] >= 14:
|
||||
continue
|
||||
if ((abs(pos[0] - another_pos[0]) == 1 and abs(pos[1] - another_pos[1]) == 0) or (
|
||||
abs(pos[0] - another_pos[0]) == 0 and abs(pos[1] - another_pos[1]) == 1)):
|
||||
if ((abs(pos[0] - another_pos[0]) == 1 and abs(pos[1] - another_pos[1]) == 0) or (abs(pos[0] - another_pos[0]) == 0 and abs(pos[1] - another_pos[1]) == 1)):
|
||||
if pos not in self.graph.keys():
|
||||
self.graph[pos] = set()
|
||||
if another_pos not in self.graph.keys():
|
||||
self.graph[another_pos] = set()
|
||||
if another_pos in self.simulation.state.road_pos_r:
|
||||
weight = 1
|
||||
if another_pos in self.simulation.state.road_pos_r:
|
||||
weight = 2
|
||||
elif another_pos in self.simulation.state.road_pos_g:
|
||||
weight = 100
|
||||
weight = 3
|
||||
else:
|
||||
weight = 1
|
||||
self.graph[pos].add(another_pos)
|
||||
self.graph[another_pos].add(pos)
|
||||
self.weights[(pos, another_pos)] = weight
|
||||
self.weights[(pos,another_pos)] = weight
|
||||
self.weights[(another_pos, pos)] = weight
|
||||
|
||||
|
||||
|
||||
|
||||
# dołączenie domów i składowisk do grafu dróg
|
||||
entities = self.simulation.state.entities
|
||||
for entity in entities:
|
||||
entity_pos = vector_to_tuple(entity.position)
|
||||
for neighbour_pos in [(entity_pos[0] - 1, entity_pos[1]),
|
||||
(entity_pos[0] + 1, entity_pos[1]),
|
||||
(entity_pos[0], entity_pos[1] - 1),
|
||||
(entity_pos[0], entity_pos[1] + 1)]:
|
||||
for neighbour_pos in [(entity_pos[0]-1, entity_pos[1]),
|
||||
(entity_pos[0]+1, entity_pos[1]),
|
||||
(entity_pos[0], entity_pos[1]-1),
|
||||
(entity_pos[0], entity_pos[1]+1)]:
|
||||
if neighbour_pos[0] < 0 or neighbour_pos[0] >= 27 or neighbour_pos[1] < 0 or neighbour_pos[1] >= 14:
|
||||
continue
|
||||
if neighbour_pos in roads_pos:
|
||||
@ -199,9 +77,10 @@ class Agent:
|
||||
self.dumps[entity.trash_type] = vector_to_tuple(entity.position)
|
||||
if entity.entity_type == 'house':
|
||||
self.houses[vector_to_tuple(entity.position)] = HousePOI()
|
||||
|
||||
self.path = self.A_star()
|
||||
|
||||
self.path = self.a_star()
|
||||
pass
|
||||
|
||||
|
||||
def update(self):
|
||||
entities = self.simulation.state.entities
|
||||
@ -211,132 +90,141 @@ class Agent:
|
||||
self.fullness = entity.fullness
|
||||
self.orientation = entity.orientation
|
||||
|
||||
|
||||
def decide_move(self):
|
||||
if self.path:
|
||||
move_a = self.path[0]
|
||||
move = (move_a[0] - self.current_pos[0], move_a[1] - self.current_pos[1])
|
||||
|
||||
if self.orientation == 0:
|
||||
if move[0] == 0:
|
||||
if move[1] == -1:
|
||||
self.path.pop(0)
|
||||
return pg.Vector2(move)
|
||||
else:
|
||||
return 180
|
||||
elif move[1] == 0:
|
||||
if move[0] == -1:
|
||||
return 270
|
||||
else:
|
||||
return 90
|
||||
elif self.orientation == 90:
|
||||
if move[0] == 0:
|
||||
if move[1] == -1:
|
||||
return 0
|
||||
else:
|
||||
return 180
|
||||
elif move[1] == 0:
|
||||
if move[0] == -1:
|
||||
return 270
|
||||
else:
|
||||
self.path.pop(0)
|
||||
return pg.Vector2(move)
|
||||
elif self.orientation == 180:
|
||||
if move[0] == 0:
|
||||
if move[1] == -1:
|
||||
return 0
|
||||
else:
|
||||
self.path.pop(0)
|
||||
return pg.Vector2(move)
|
||||
elif move[1] == 0:
|
||||
if move[0] == -1:
|
||||
return 270
|
||||
else:
|
||||
return 90
|
||||
else:
|
||||
if move[0] == 0:
|
||||
if move[1] == -1:
|
||||
return 0
|
||||
else:
|
||||
return 180
|
||||
elif move[1] == 0:
|
||||
if move[0] == -1:
|
||||
self.path.pop(0)
|
||||
return pg.Vector2(move)
|
||||
else:
|
||||
return 90
|
||||
|
||||
|
||||
|
||||
move = self.path.pop
|
||||
|
||||
if self.orientation == 0:
|
||||
if move[0] != 0:
|
||||
if move[0] == 1:
|
||||
return 90
|
||||
else:
|
||||
return 270
|
||||
elif move[1] != 0:
|
||||
if move[1] == 1:
|
||||
return pg.Vector2(move)
|
||||
else:
|
||||
return 180
|
||||
elif self.orientation == 90:
|
||||
if move[0] != 0:
|
||||
if move[0] == 1:
|
||||
return pg.Vector2(move)
|
||||
else:
|
||||
return 270
|
||||
elif move[1] != 0:
|
||||
if move[1] == 1:
|
||||
return 0
|
||||
else:
|
||||
return 180
|
||||
elif self.orientation == 180:
|
||||
if move[0] != 0:
|
||||
if move[0] == 1:
|
||||
return 90
|
||||
else:
|
||||
return 270
|
||||
elif move[1] != 0:
|
||||
if move[1] == 1:
|
||||
return 0
|
||||
else:
|
||||
return pg.Vector2(move)
|
||||
else:
|
||||
return pg.Vector2(0, 0)
|
||||
if move[0] != 0:
|
||||
if move[0] == 1:
|
||||
return 90
|
||||
else:
|
||||
return pg.Vector2(move)
|
||||
elif move[1] != 0:
|
||||
if move[1] == 0:
|
||||
return 0
|
||||
else:
|
||||
return 180
|
||||
|
||||
def heuristic(self, start_pos, end_pos):
|
||||
return abs((end_pos[0] - start_pos[0])) + abs((end_pos[1] - start_pos[1]))
|
||||
|
||||
def successors(self, state):
|
||||
def weight_cost(self, start_pos, end_pos):
|
||||
return self.weights[(start_pos, end_pos)]
|
||||
|
||||
def get_move_cost(self, start_pos, end_pos):
|
||||
return self.heuristic(start_pos, end_pos) + self.weight_cost(start_pos, end_pos)
|
||||
|
||||
def get_start_state(self):
|
||||
entities = self.simulation.state.entities
|
||||
# orientation - self.orientation
|
||||
position = self.current_pos
|
||||
house_list = tuple(self.houses)
|
||||
start_state = (position, house_list)
|
||||
return start_state
|
||||
|
||||
def get_end_state(self):
|
||||
position = (0,1)
|
||||
house_list = ()
|
||||
end_state = (position, house_list)
|
||||
return end_state
|
||||
|
||||
def succesor(self, state):
|
||||
successors_pos = self.graph[state[0]]
|
||||
house_list = state[1]
|
||||
successors = []
|
||||
successors = ()
|
||||
for pos in successors_pos:
|
||||
if len(house_list) > 0:
|
||||
if house_list[0] == pos:
|
||||
house_list = list(house_list)
|
||||
house_list.pop(0)
|
||||
house_list = tuple(house_list)
|
||||
if pos in house_list:
|
||||
house_list = list(house_list)
|
||||
house_list.remove(pos)
|
||||
house_list = tuple(house_list)
|
||||
|
||||
successors.append((pos, tuple(house_list)))
|
||||
successors = list(successors)
|
||||
successors.append((pos, tuple(house_list)))
|
||||
successors = tuple(successors)
|
||||
else:
|
||||
successors = list(successors)
|
||||
successors.append((pos, tuple(house_list)))
|
||||
successors = tuple(successors)
|
||||
|
||||
return successors
|
||||
|
||||
def cost(self, current_node, succ_state):
|
||||
if succ_state[0] not in current_node.state[1]:
|
||||
cost = current_node.cost + self.weights[current_node.state[0], succ_state[0]]
|
||||
else:
|
||||
cost = float(1)
|
||||
return cost
|
||||
|
||||
def heuristic(self, succ_state, goal_state):
|
||||
position = succ_state[0]
|
||||
if len(succ_state[1]) != 0:
|
||||
estimated_cost = 0
|
||||
for house in succ_state[1]:
|
||||
estimated_cost += abs(position[0] - house[0]) + abs(position[1] - house[1])
|
||||
else:
|
||||
goal_position = goal_state[0]
|
||||
estimated_cost = abs(position[0] - goal_position[0]) + abs(position[1] - goal_position[1])
|
||||
return estimated_cost
|
||||
|
||||
def a_star(self):
|
||||
def A_star(self):
|
||||
fringe = []
|
||||
explored = set()
|
||||
self.genetic_house_list = genetics.genetic_algorithm(sorted(self.houses))
|
||||
initial_state = (self.current_pos, tuple(self.genetic_house_list))
|
||||
goal_state = (self.current_pos, ())
|
||||
start_node = Node(initial_state, None, 0)
|
||||
istate = self.get_start_state()
|
||||
goaltest = self.get_end_state()
|
||||
node = (istate, None)
|
||||
|
||||
heapq.heappush(fringe, start_node)
|
||||
heapq.heappush(fringe, (self.heuristic(istate[0], goaltest[0]), node))
|
||||
|
||||
while fringe:
|
||||
current_node = heapq.heappop(fringe)
|
||||
_, el = heapq.heappop(fringe)
|
||||
elem = el[0]
|
||||
parent = el[1]
|
||||
|
||||
if current_node.state == goal_state:
|
||||
if elem == goaltest:
|
||||
actions = []
|
||||
while current_node:
|
||||
actions.append(current_node.state[0])
|
||||
current_node = current_node.parent
|
||||
c = (4, 0) in actions
|
||||
return list(reversed(actions))
|
||||
while parent is not None:
|
||||
actions.append(elem[0])
|
||||
elem = parent
|
||||
actions.reverse()
|
||||
return actions
|
||||
|
||||
explored.add(current_node.state)
|
||||
explored.add(elem)
|
||||
|
||||
succ_states = self.successors(current_node.state)
|
||||
succs = self.succesor(elem)
|
||||
for succ in succs:
|
||||
|
||||
for succ_state in succ_states:
|
||||
if succ_state in explored:
|
||||
continue
|
||||
node = (succ, elem)
|
||||
p = self.heuristic(succ[0], goaltest[0]) + self.weight_cost(elem[0], succ[0])
|
||||
|
||||
g = self.cost(current_node, succ_state)
|
||||
h = self.heuristic(succ_state, goal_state)
|
||||
succ_cost = g + h
|
||||
succ_node = Node(succ_state, current_node, succ_cost)
|
||||
if succ not in explored and not any(tup[1][0] == succ for tup in fringe):
|
||||
heapq.heappush(fringe, (p,node))
|
||||
elif any(tup[1] == succ for tup in fringe):
|
||||
i = next(i for node in enumerate(fringe) if node[1][0] == succ)
|
||||
if fringe[i][0] > p:
|
||||
fringe[i] = (p,node)
|
||||
return False
|
||||
|
||||
|
||||
heapq.heappush(fringe, succ_node)
|
||||
|
||||
return None
|
||||
|
||||
def discover(self):
|
||||
if self.current_pos in self.houses.keys():
|
||||
@ -345,7 +233,5 @@ class Agent:
|
||||
if entity.entity_type == 'house' and vector_to_tuple(entity.position) == self.current_pos:
|
||||
current_house = entity
|
||||
break
|
||||
if current_house is not None and current_house.visited == False:
|
||||
current_house.visited = True
|
||||
self.houses[self.current_pos].discover_bins(current_house.bins[0], current_house.bins[1],
|
||||
current_house.bins[2])
|
||||
if current_house is not None:
|
||||
self.houses[self.current_pos].discover_bins(current_house.bins)
|
||||
|
@ -1,22 +0,0 @@
|
||||
import pandas as pd
|
||||
from sklearn import tree
|
||||
from sklearn.tree import DecisionTreeClassifier
|
||||
|
||||
|
||||
data = pd.read_csv('tree_data.csv')
|
||||
data_encoded = pd.get_dummies(data, columns=['trash_types', 'season', 'day'])
|
||||
|
||||
X = data_encoded.drop('decision', axis=1)
|
||||
y = data_encoded['decision']
|
||||
|
||||
clf = DecisionTreeClassifier()
|
||||
decision_tree = clf.fit(X, y)
|
||||
|
||||
with open('./tree_in_txt.txt', "w") as file:
|
||||
file.write(tree.export_text(decision_tree, feature_names=X.columns.tolist()))
|
||||
|
||||
|
||||
def decision(conditions):
|
||||
new_conditions = pd.DataFrame(conditions)
|
||||
new_decision = decision_tree.predict(new_conditions)
|
||||
return new_decision
|
@ -1,83 +0,0 @@
|
||||
import random
|
||||
|
||||
POPULATION_SIZE = 100
|
||||
MUTATION_RATE = 0.01
|
||||
NUM_GENERATIONS = 100
|
||||
|
||||
|
||||
|
||||
def generate_individual(houses):
|
||||
return random.sample(houses, len(houses))
|
||||
|
||||
def generate_population(houses, size):
|
||||
return [generate_individual(houses) for _ in range(size)]
|
||||
|
||||
def calculate_distance(house1, house2):
|
||||
x1, y1 = house1
|
||||
x2, y2 = house2
|
||||
return abs(x1 - x2) + abs(y1 - y2)
|
||||
|
||||
def calculate_total_distance(houses):
|
||||
total_distance = 0
|
||||
for i in range(len(houses) - 1):
|
||||
total_distance += calculate_distance(houses[i], houses[i+1])
|
||||
total_distance += calculate_distance(houses[-1], houses[0]) # Zamknięcie cyklu
|
||||
return total_distance
|
||||
|
||||
def select_parents(population, num_parents):
|
||||
parents = []
|
||||
for _ in range(num_parents):
|
||||
tournament = random.sample(population, 5)
|
||||
winner = min(tournament, key=calculate_total_distance)
|
||||
parents.append(winner)
|
||||
return parents
|
||||
|
||||
def crossover(parent1, parent2):
|
||||
child1 = [None] * len(parent1)
|
||||
child2 = [None] * len(parent1)
|
||||
start_index = random.randint(0, len(parent1) - 1)
|
||||
end_index = random.randint(start_index, len(parent1) - 1)
|
||||
child1[start_index:end_index+1] = parent1[start_index:end_index+1]
|
||||
child2[start_index:end_index+1] = parent2[start_index:end_index+1]
|
||||
|
||||
for i in range(len(parent1)):
|
||||
if parent2[i] not in child1:
|
||||
for j in range(len(parent2)):
|
||||
if child1[j] is None:
|
||||
child1[j] = parent2[i]
|
||||
break
|
||||
|
||||
for i in range(len(parent1)):
|
||||
if parent1[i] not in child2:
|
||||
for j in range(len(parent1)):
|
||||
if child2[j] is None:
|
||||
child2[j] = parent1[i]
|
||||
break
|
||||
|
||||
return child1, child2
|
||||
|
||||
def mutate(individual):
|
||||
index1, index2 = random.sample(range(len(individual)), 2)
|
||||
individual[index1], individual[index2] = individual[index2], individual[index1]
|
||||
|
||||
def genetic_algorithm(houses):
|
||||
population = generate_population(houses, POPULATION_SIZE)
|
||||
|
||||
for _ in range(NUM_GENERATIONS):
|
||||
fitness_scores = [calculate_total_distance(individual) for individual in population]
|
||||
|
||||
parents = select_parents(population, 2)
|
||||
|
||||
new_population = []
|
||||
for i in range(POPULATION_SIZE // 2):
|
||||
child1, child2 = crossover(parents[0], parents[1])
|
||||
mutate(child1)
|
||||
mutate(child2)
|
||||
new_population.extend([child1, child2])
|
||||
|
||||
population = new_population
|
||||
|
||||
best_individual = min(population, key=calculate_total_distance)
|
||||
|
||||
return best_individual
|
||||
|
@ -1,6 +1,5 @@
|
||||
from pathlib import Path
|
||||
from random import randint
|
||||
import random
|
||||
|
||||
import pygame as pg
|
||||
from agent import Agent
|
||||
@ -14,9 +13,9 @@ HOUSE_SPRITES = {0: HOUSE_WITHOUT_TRASH_SPRITE,
|
||||
1: HOUSE_WITH_TRASH_SPRITE}
|
||||
|
||||
TRUCK_SPRITE_R = pg.Vector2(2, 0)
|
||||
TRUCK_SPRITE_D = pg.Vector2(2, 1)
|
||||
TRUCK_SPRITE_L = pg.Vector2(2, 2)
|
||||
TRUCK_SPRITE_U = pg.Vector2(2, 3)
|
||||
TRUCK_SPRITE_D = pg.Vector2(2,1)
|
||||
TRUCK_SPRITE_L = pg.Vector2(2,2)
|
||||
TRUCK_SPRITE_U = pg.Vector2(2,3)
|
||||
|
||||
PAPER_DUMP_SPRITE = pg.Vector2(3, 0)
|
||||
PLASTIC_DUMP_SPRITE = pg.Vector2(3, 1)
|
||||
@ -27,24 +26,7 @@ DUMP_SPRITES = {'paper': PAPER_DUMP_SPRITE,
|
||||
'plastic': PLASTIC_DUMP_SPRITE,
|
||||
'mixed': MIXED_DUMP_SPRITE}
|
||||
|
||||
TRASH_TYPES = ['paper', 'plastic', 'glass', 'biological']
|
||||
DAYS = ['friday', 'monday', 'wednesday']
|
||||
SEASONS = ['autumn', 'spring', 'summer', 'winter']
|
||||
|
||||
|
||||
class Season:
|
||||
def __init__(self, season):
|
||||
self.season = season
|
||||
|
||||
|
||||
class Day:
|
||||
def __init__(self, day):
|
||||
self.day = day
|
||||
|
||||
|
||||
class TruckFullness:
|
||||
def __init__(self, fullness):
|
||||
self.fullness = fullness
|
||||
TRASH_TYPES = ['paper', 'plastic', 'glass', 'mixed']
|
||||
|
||||
|
||||
class Entity:
|
||||
@ -58,9 +40,12 @@ class TruckEntity(Entity):
|
||||
super().__init__(state, position)
|
||||
self.entity_type = 'truck'
|
||||
self.tile = TRUCK_SPRITE_R
|
||||
self.fullness = None
|
||||
self.fullness = {'paper': 0,
|
||||
'glass': 0,
|
||||
'plastic': 0,
|
||||
'mixed': 0}
|
||||
self.orientation = 90
|
||||
|
||||
|
||||
def rotate_img(self, orientation):
|
||||
self.orientation = orientation
|
||||
if orientation == 0:
|
||||
@ -91,11 +76,13 @@ class TruckEntity(Entity):
|
||||
|
||||
|
||||
class Bin:
|
||||
def __init__(self, items):
|
||||
self.items = items
|
||||
def __init__(self, size, trash_type):
|
||||
self.size = size
|
||||
self.trash_type = trash_type
|
||||
self.fullness = randint(0, 100)
|
||||
|
||||
def __getitem__(self, index):
|
||||
return self.items[index]
|
||||
def __str__(self):
|
||||
return self.trash_type + " bin"
|
||||
|
||||
|
||||
class HouseEntity(Entity):
|
||||
@ -103,8 +90,7 @@ class HouseEntity(Entity):
|
||||
super().__init__(state, position)
|
||||
self.tile = HOUSE_SPRITES[0]
|
||||
self.entity_type = 'house'
|
||||
self.visited = False
|
||||
self.bins = Bin([randint(0, 1), random.choice(TRASH_TYPES), randint(0, 1)])
|
||||
self.bins = [Bin(randint(1, 2), trash_type) for trash_type in TRASH_TYPES]
|
||||
|
||||
|
||||
class DumpEntity(Entity):
|
||||
@ -139,7 +125,7 @@ class SimulationState:
|
||||
if tile == "R":
|
||||
self.road_pos_r.append(pg.Vector2(x, y))
|
||||
if tile == "G":
|
||||
self.road_pos_g.append(pg.Vector2(x, y))
|
||||
self.road_pos_g.append(pg.Vector2(x,y))
|
||||
if tile == "H":
|
||||
self.houses_pos.append(pg.Vector2(x, y))
|
||||
self.entities.append(HouseEntity(self, pg.Vector2(x, y)))
|
||||
@ -179,7 +165,7 @@ class Layer:
|
||||
self.sim = sim
|
||||
self.texture_atlas = pg.image.load(texture_file)
|
||||
|
||||
def renderTile(self, surface, position, tile, orientation=90, rotate=False):
|
||||
def renderTile(self, surface, position, tile, orientation = 90, rotate=False):
|
||||
# pozycja na ekranie
|
||||
sprite_pos = position.elementwise() * self.sim.cell_size
|
||||
|
||||
@ -189,6 +175,7 @@ class Layer:
|
||||
int(pos_in_atlas.y),
|
||||
self.sim.cell_size.x,
|
||||
self.sim.cell_size.y)
|
||||
|
||||
|
||||
# render
|
||||
surface.blit(self.texture_atlas, sprite_pos, texture)
|
||||
@ -224,13 +211,6 @@ class StructureLayer(Layer):
|
||||
|
||||
|
||||
class Interface:
|
||||
truck_fullness = TruckFullness({'paper': 0,
|
||||
'glass': 0,
|
||||
'plastic': 0,
|
||||
'biological': 0})
|
||||
season = Season(random.choice(SEASONS))
|
||||
day = Day(random.choice(DAYS))
|
||||
|
||||
def __init__(self):
|
||||
pg.init()
|
||||
|
||||
@ -244,8 +224,8 @@ class Interface:
|
||||
# rendering
|
||||
self.cell_size = pg.Vector2(64, 64)
|
||||
texture_file = Path(r"..\res\tiles.png")
|
||||
self.layers = [StructureLayer(self, texture_file, self.state, self.state.road_pos_r, ROAD_SPRITE_R),
|
||||
StructureLayer(self, texture_file, self.state, self.state.road_pos_g, ROAD_SPRITE_G),
|
||||
self.layers = [StructureLayer(self, texture_file, self.state, self.state.road_pos_r, ROAD_SPRITE_R ),
|
||||
StructureLayer(self, texture_file, self.state, self.state.road_pos_g, ROAD_SPRITE_G ),
|
||||
EntityLayer(self, texture_file, self.state, self.state.entities)]
|
||||
|
||||
# okno
|
||||
@ -277,16 +257,16 @@ class Interface:
|
||||
if self.debug_mode:
|
||||
if event.key == pg.K_RIGHT:
|
||||
self.move_truck.x = 1
|
||||
|
||||
|
||||
if event.key == pg.K_LEFT:
|
||||
self.move_truck.x = -1
|
||||
|
||||
|
||||
if event.key == pg.K_DOWN:
|
||||
self.move_truck.y = 1
|
||||
|
||||
|
||||
if event.key == pg.K_UP:
|
||||
self.move_truck.y = -1
|
||||
|
||||
|
||||
if event.key == pg.K_d:
|
||||
self.agent.discover()
|
||||
|
||||
@ -296,10 +276,9 @@ class Interface:
|
||||
def update(self):
|
||||
self.state.update(self.move_truck)
|
||||
self.agent.update()
|
||||
self.agent.discover()
|
||||
'''if isinstance(self.move_truck, int):
|
||||
if isinstance(self.move_truck, int):
|
||||
self.state.update(self.move_truck)
|
||||
self.agent.update()'''
|
||||
self.agent.update()
|
||||
|
||||
def render(self):
|
||||
if not self.debug_mode:
|
||||
@ -319,5 +298,5 @@ class Interface:
|
||||
self.processAgentInput()
|
||||
self.update()
|
||||
self.render()
|
||||
self.clock.tick(50)
|
||||
pg.quit()
|
||||
self.clock.tick(24)
|
||||
pg.quit()
|
@ -1,48 +0,0 @@
|
||||
import tensorflow as tf
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import os
|
||||
import PIL
|
||||
import random
|
||||
from PIL import Image
|
||||
|
||||
|
||||
def trash_type_def(trash_type):
|
||||
img_num = 0
|
||||
img_height, img_width = 180, 180
|
||||
|
||||
if trash_type == 'biological':
|
||||
img_num = random.randint(1, 985)
|
||||
if trash_type == 'glass':
|
||||
img_num = random.randint(1, 501)
|
||||
if trash_type == 'paper':
|
||||
img_num = random.randint(1, 594)
|
||||
if trash_type == 'plastic':
|
||||
img_num = random.randint(1, 482)
|
||||
|
||||
filename = trash_type + str(img_num)
|
||||
class_names = ['biological', 'glass', 'paper', 'plastic']
|
||||
trash_classification_model = tf.keras.models.load_model('../trash-classification/m_with_data_augmentation.h5')
|
||||
test_image_path = "../trash-classification/trash/test/"+trash_type+"/"+filename+".jpg"
|
||||
|
||||
img = tf.keras.utils.load_img(
|
||||
test_image_path, target_size=(img_height, img_width)
|
||||
)
|
||||
img_array = tf.keras.utils.img_to_array(img)
|
||||
img_array = tf.expand_dims(img_array, 0)
|
||||
|
||||
predictions = trash_classification_model.predict(img_array)
|
||||
score = tf.nn.softmax(predictions[0])
|
||||
|
||||
name = class_names[np.argmax(score)]
|
||||
|
||||
file_path = "../trash-classification/trash/test/"+trash_type+"/"+filename+".jpg"
|
||||
img_show = Image.open(file_path)
|
||||
img_numpy_format = np.asarray(img_show)
|
||||
plt.imshow(img_numpy_format)
|
||||
plt.suptitle(filename)
|
||||
plt.draw()
|
||||
plt.pause(1)
|
||||
plt.close()
|
||||
|
||||
return [name, img_num]
|
67
src/tree.py
@ -1,67 +0,0 @@
|
||||
import csv
|
||||
import random
|
||||
import pandas as pd
|
||||
|
||||
truck_fullness = [0, 1]
|
||||
trash_types = ['paper', 'plastic', 'glass', 'mixed']
|
||||
payment = [0, 1]
|
||||
bin_fullness = [0, 1]
|
||||
day = ['monday', 'wednesday', 'friday']
|
||||
season = ['spring', 'summer', 'autumn', 'winter']
|
||||
dump_fullness = [0, 1]
|
||||
trash = [0, 1]
|
||||
# spring: monday = plastic, wednesday = glass, friday = biological & paper
|
||||
# summer: monday = glass, wednesday = biological & plastic, friday = paper
|
||||
# autumn: monday = biological & plastic, wednesday = glass, friday = paper
|
||||
# winter: monday = paper, wednesday = biological & plastic, friday = glass
|
||||
|
||||
with open('tree_data.csv', 'w', newline='') as csvfile:
|
||||
writer = csv.writer(csvfile)
|
||||
|
||||
writer.writerow(
|
||||
['dump_fullness', 'truck_fullness', 'trash', 'payment', 'bin_fullness', 'trash_types', 'season', 'day',
|
||||
'decision'])
|
||||
rows = set()
|
||||
|
||||
positives = [(0, 0, 1, 1, 1, 'glass', 'spring', 'wednesday', 1),
|
||||
(0, 0, 1, 1, 1, 'glass', 'summer', 'monday', 1),
|
||||
(0, 0, 1, 1, 1, 'glass', 'autumn', 'wednesday', 1),
|
||||
(0, 0, 1, 1, 1, 'glass', 'winter', 'friday', 1),
|
||||
|
||||
(0, 0, 1, 1, 1, 'paper', 'spring', 'friday', 1),
|
||||
(0, 0, 1, 1, 1, 'paper', 'summer', 'friday', 1),
|
||||
(0, 0, 1, 1, 1, 'paper', 'autumn', 'friday', 1),
|
||||
(0, 0, 1, 1, 1, 'paper', 'winter', 'monday', 1),
|
||||
|
||||
(0, 0, 1, 1, 1, 'plastic', 'spring', 'monday', 1),
|
||||
(0, 0, 1, 1, 1, 'plastic', 'summer', 'wednesday', 1),
|
||||
(0, 0, 1, 1, 1, 'plastic', 'autumn', 'monday', 1),
|
||||
(0, 0, 1, 1, 1, 'plastic', 'winter', 'wednesday', 1),
|
||||
|
||||
(0, 0, 1, 1, 1, 'mixed', 'spring', 'friday', 1),
|
||||
(0, 0, 1, 1, 1, 'mixed', 'summer', 'wednesday', 1),
|
||||
(0, 0, 1, 1, 1, 'mixed', 'autumn', 'monday', 1),
|
||||
(0, 0, 1, 1, 1, 'mixed', 'winter', 'wednesday', 1)]
|
||||
|
||||
for positive in positives:
|
||||
rows.add(positive)
|
||||
|
||||
while len(rows) < 200:
|
||||
rand_1 = random.choice(dump_fullness)
|
||||
rand_2 = random.choice(truck_fullness)
|
||||
rand_3 = random.choice(trash)
|
||||
rand_4 = random.choice(payment)
|
||||
rand_5 = random.choice(bin_fullness)
|
||||
rand_6 = random.choice(trash_types)
|
||||
rand_7 = random.choice(season)
|
||||
rand_8 = random.choice(day)
|
||||
|
||||
rows.add((rand_1, rand_2, rand_3, rand_4, rand_5, rand_6, rand_7, rand_8, 0))
|
||||
|
||||
rows_tuple = tuple(rows)
|
||||
|
||||
for elem in rows_tuple:
|
||||
writer.writerow(elem)
|
||||
|
||||
dt = pd.read_csv('tree_data.csv')
|
||||
print(dt.head())
|
@ -1,201 +0,0 @@
|
||||
dump_fullness,truck_fullness,trash,payment,bin_fullness,trash_types,season,day,decision
|
||||
0,0,0,1,0,glass,winter,wednesday,0
|
||||
1,1,1,0,1,mixed,spring,monday,0
|
||||
0,1,1,1,0,plastic,winter,monday,0
|
||||
1,0,1,1,0,glass,spring,monday,0
|
||||
1,1,1,0,0,paper,spring,wednesday,0
|
||||
0,1,0,1,1,plastic,spring,monday,0
|
||||
1,1,1,1,1,mixed,autumn,friday,0
|
||||
0,0,1,0,1,glass,autumn,friday,0
|
||||
1,0,0,1,1,glass,spring,monday,0
|
||||
0,0,0,0,0,paper,spring,friday,0
|
||||
1,1,0,1,0,paper,summer,friday,0
|
||||
1,1,1,0,0,mixed,spring,wednesday,0
|
||||
1,0,1,1,0,mixed,autumn,monday,0
|
||||
0,0,1,0,1,mixed,summer,wednesday,0
|
||||
1,0,1,0,0,glass,spring,monday,0
|
||||
1,1,1,0,0,paper,autumn,friday,0
|
||||
0,0,1,0,1,paper,summer,friday,0
|
||||
1,0,0,1,1,glass,autumn,wednesday,0
|
||||
1,1,1,1,0,glass,winter,wednesday,0
|
||||
0,0,0,0,0,plastic,summer,monday,0
|
||||
0,0,1,1,1,mixed,autumn,friday,0
|
||||
1,0,1,0,0,mixed,summer,friday,0
|
||||
1,0,0,1,0,paper,winter,friday,0
|
||||
1,1,1,0,1,paper,winter,wednesday,0
|
||||
0,0,1,1,1,glass,summer,wednesday,0
|
||||
1,0,0,0,0,glass,summer,friday,0
|
||||
0,0,0,1,0,glass,summer,wednesday,0
|
||||
1,0,1,1,0,paper,spring,friday,0
|
||||
1,1,1,1,1,paper,autumn,monday,0
|
||||
1,0,0,1,0,glass,winter,wednesday,0
|
||||
1,0,1,0,1,paper,spring,wednesday,0
|
||||
0,1,0,1,0,mixed,winter,wednesday,0
|
||||
1,1,1,1,1,paper,winter,friday,0
|
||||
1,0,1,0,0,glass,autumn,wednesday,0
|
||||
0,1,0,0,1,plastic,autumn,monday,0
|
||||
0,0,1,1,1,glass,winter,friday,1
|
||||
0,1,0,1,1,paper,spring,monday,0
|
||||
1,0,0,0,1,plastic,spring,monday,0
|
||||
0,0,1,1,1,mixed,autumn,monday,1
|
||||
0,1,1,0,1,glass,spring,monday,0
|
||||
0,0,1,1,0,paper,autumn,wednesday,0
|
||||
0,0,0,1,1,plastic,spring,friday,0
|
||||
1,0,1,1,0,plastic,summer,monday,0
|
||||
1,1,1,1,1,plastic,winter,friday,0
|
||||
0,0,0,1,1,mixed,autumn,friday,0
|
||||
1,0,1,0,0,paper,spring,wednesday,0
|
||||
0,0,0,1,1,glass,spring,monday,0
|
||||
0,1,1,0,0,plastic,summer,wednesday,0
|
||||
1,0,1,0,0,glass,summer,friday,0
|
||||
0,1,0,0,0,glass,winter,wednesday,0
|
||||
0,0,0,1,0,paper,summer,monday,0
|
||||
1,1,0,0,1,plastic,summer,friday,0
|
||||
1,0,0,0,0,plastic,spring,monday,0
|
||||
1,0,1,1,0,plastic,autumn,friday,0
|
||||
1,1,1,1,0,mixed,autumn,wednesday,0
|
||||
0,0,0,0,1,paper,autumn,monday,0
|
||||
0,0,1,1,0,glass,winter,friday,0
|
||||
0,1,0,1,0,glass,summer,wednesday,0
|
||||
1,1,0,0,0,plastic,summer,monday,0
|
||||
0,1,0,1,0,paper,spring,monday,0
|
||||
0,0,1,1,1,mixed,winter,wednesday,1
|
||||
0,0,1,0,0,plastic,spring,monday,0
|
||||
1,1,0,0,1,mixed,winter,monday,0
|
||||
0,0,1,1,1,mixed,summer,wednesday,1
|
||||
0,1,0,0,1,paper,winter,friday,0
|
||||
0,0,1,1,1,plastic,winter,monday,0
|
||||
1,0,1,0,0,glass,winter,monday,0
|
||||
0,0,1,0,0,mixed,summer,monday,0
|
||||
1,1,1,0,1,mixed,spring,friday,0
|
||||
1,0,1,1,1,mixed,spring,monday,0
|
||||
1,1,0,1,1,glass,autumn,friday,0
|
||||
0,1,0,0,1,plastic,spring,monday,0
|
||||
0,1,1,0,1,plastic,spring,monday,0
|
||||
0,0,1,1,1,plastic,autumn,monday,1
|
||||
1,0,0,1,0,glass,spring,wednesday,0
|
||||
1,1,1,0,0,plastic,autumn,monday,0
|
||||
0,1,0,1,1,plastic,spring,friday,0
|
||||
0,1,0,1,1,glass,autumn,wednesday,0
|
||||
1,0,0,0,1,mixed,winter,friday,0
|
||||
1,0,1,1,0,plastic,spring,monday,0
|
||||
0,0,1,0,1,plastic,summer,friday,0
|
||||
1,1,0,0,0,glass,spring,wednesday,0
|
||||
0,1,1,1,1,mixed,winter,wednesday,0
|
||||
1,1,0,1,0,mixed,winter,friday,0
|
||||
0,0,1,1,1,paper,spring,friday,1
|
||||
0,1,1,0,1,mixed,spring,friday,0
|
||||
1,1,1,0,0,glass,winter,monday,0
|
||||
1,1,1,0,1,glass,spring,monday,0
|
||||
1,0,0,1,1,plastic,spring,monday,0
|
||||
0,0,1,1,1,paper,autumn,friday,1
|
||||
0,0,0,0,1,paper,autumn,wednesday,0
|
||||
1,1,1,0,1,plastic,summer,monday,0
|
||||
0,1,1,1,1,paper,spring,monday,0
|
||||
0,1,1,1,1,plastic,spring,monday,0
|
||||
0,1,1,0,1,glass,autumn,wednesday,0
|
||||
0,0,1,1,1,paper,summer,friday,1
|
||||
1,1,1,1,1,mixed,winter,wednesday,0
|
||||
0,1,1,0,0,mixed,spring,friday,0
|
||||
1,1,0,0,0,paper,autumn,friday,0
|
||||
1,1,0,1,1,paper,winter,friday,0
|
||||
1,1,1,1,0,mixed,winter,monday,0
|
||||
1,1,0,0,0,plastic,summer,wednesday,0
|
||||
0,0,0,0,0,mixed,winter,wednesday,0
|
||||
1,1,1,1,0,paper,spring,monday,0
|
||||
1,1,1,0,0,plastic,winter,wednesday,0
|
||||
0,0,0,1,1,paper,summer,friday,0
|
||||
0,1,0,0,0,glass,autumn,friday,0
|
||||
0,1,0,0,0,plastic,spring,monday,0
|
||||
1,1,0,1,0,paper,spring,monday,0
|
||||
0,1,0,0,1,plastic,spring,wednesday,0
|
||||
0,1,0,1,0,mixed,spring,monday,0
|
||||
1,0,1,1,1,paper,summer,friday,0
|
||||
0,1,1,1,0,mixed,winter,friday,0
|
||||
0,0,1,0,0,plastic,autumn,friday,0
|
||||
1,1,0,1,0,paper,spring,friday,0
|
||||
1,0,1,0,1,mixed,winter,wednesday,0
|
||||
0,0,0,0,0,glass,autumn,monday,0
|
||||
1,0,1,1,1,mixed,autumn,friday,0
|
||||
1,1,0,1,1,paper,spring,monday,0
|
||||
1,1,1,0,0,glass,winter,wednesday,0
|
||||
0,0,1,1,1,glass,autumn,wednesday,1
|
||||
0,0,0,1,1,glass,spring,friday,0
|
||||
1,0,1,0,1,paper,winter,monday,0
|
||||
0,0,1,1,1,paper,winter,monday,1
|
||||
0,1,1,0,0,glass,summer,wednesday,0
|
||||
0,0,1,1,0,glass,spring,wednesday,0
|
||||
0,0,1,1,0,paper,spring,wednesday,0
|
||||
1,0,0,0,0,paper,summer,wednesday,0
|
||||
1,1,0,0,1,glass,autumn,monday,0
|
||||
1,1,0,0,1,paper,spring,monday,0
|
||||
0,0,0,1,1,plastic,spring,monday,0
|
||||
0,1,1,0,1,plastic,autumn,monday,0
|
||||
0,0,0,1,0,plastic,spring,wednesday,0
|
||||
0,1,1,1,0,glass,autumn,monday,0
|
||||
1,0,0,0,1,glass,summer,monday,0
|
||||
1,0,0,0,0,paper,winter,wednesday,0
|
||||
0,0,1,1,1,glass,summer,monday,1
|
||||
1,1,0,1,0,glass,summer,monday,0
|
||||
0,1,1,1,1,glass,winter,monday,0
|
||||
0,0,0,1,1,glass,winter,wednesday,0
|
||||
0,0,1,0,1,mixed,winter,friday,0
|
||||
0,1,0,1,1,paper,winter,monday,0
|
||||
0,0,1,1,1,mixed,spring,friday,1
|
||||
0,0,1,1,0,glass,winter,monday,0
|
||||
1,0,0,0,1,paper,summer,monday,0
|
||||
1,0,0,0,1,plastic,summer,wednesday,0
|
||||
0,1,1,1,1,plastic,winter,friday,0
|
||||
0,0,1,0,0,paper,autumn,friday,0
|
||||
0,0,1,1,1,plastic,summer,wednesday,1
|
||||
1,0,1,0,1,paper,winter,wednesday,0
|
||||
0,0,0,0,0,plastic,spring,wednesday,0
|
||||
1,0,1,0,0,glass,winter,wednesday,0
|
||||
1,0,1,1,1,plastic,summer,wednesday,0
|
||||
0,1,1,0,1,paper,summer,wednesday,0
|
||||
0,1,0,1,0,paper,winter,wednesday,0
|
||||
0,0,1,1,1,plastic,spring,monday,1
|
||||
0,1,1,1,0,paper,winter,wednesday,0
|
||||
0,1,1,1,0,glass,autumn,friday,0
|
||||
1,1,1,0,0,plastic,spring,monday,0
|
||||
0,0,1,0,1,mixed,spring,wednesday,0
|
||||
0,1,1,0,0,glass,summer,friday,0
|
||||
1,1,0,1,0,plastic,winter,monday,0
|
||||
0,0,0,1,0,paper,winter,wednesday,0
|
||||
1,0,1,0,1,plastic,summer,friday,0
|
||||
1,0,0,0,1,mixed,autumn,friday,0
|
||||
0,0,0,1,1,plastic,winter,friday,0
|
||||
1,0,0,0,0,plastic,winter,monday,0
|
||||
1,0,0,1,0,plastic,winter,friday,0
|
||||
1,0,0,0,1,glass,spring,monday,0
|
||||
0,0,0,1,1,plastic,autumn,friday,0
|
||||
0,1,0,1,1,glass,spring,friday,0
|
||||
0,0,0,1,1,mixed,spring,wednesday,0
|
||||
1,1,1,1,0,paper,autumn,wednesday,0
|
||||
0,0,1,1,1,mixed,winter,friday,0
|
||||
0,1,0,0,1,paper,summer,monday,0
|
||||
0,0,1,1,1,paper,summer,wednesday,0
|
||||
1,0,1,0,1,paper,autumn,wednesday,0
|
||||
0,1,1,1,1,mixed,spring,friday,0
|
||||
0,0,0,1,1,glass,winter,friday,0
|
||||
0,1,0,0,0,glass,winter,monday,0
|
||||
0,0,1,0,1,glass,autumn,wednesday,0
|
||||
0,0,0,1,0,plastic,summer,friday,0
|
||||
1,1,1,1,0,mixed,spring,wednesday,0
|
||||
1,0,1,0,1,plastic,autumn,friday,0
|
||||
0,1,1,0,1,mixed,autumn,monday,0
|
||||
0,1,0,1,1,plastic,winter,wednesday,0
|
||||
0,1,1,0,1,mixed,winter,friday,0
|
||||
1,0,0,0,1,plastic,summer,friday,0
|
||||
1,0,1,0,1,mixed,spring,friday,0
|
||||
1,1,1,1,0,paper,summer,monday,0
|
||||
1,0,1,0,1,paper,winter,friday,0
|
||||
0,1,1,0,1,paper,summer,friday,0
|
||||
0,0,1,1,1,plastic,winter,wednesday,1
|
||||
0,0,1,1,1,mixed,spring,monday,0
|
||||
0,1,1,0,1,paper,winter,wednesday,0
|
||||
1,1,1,1,0,plastic,spring,friday,0
|
||||
1,0,1,1,0,paper,summer,friday,0
|
||||
1,1,0,0,1,glass,autumn,friday,0
|
||||
0,0,1,1,1,glass,spring,wednesday,1
|
||||
1,1,0,1,1,paper,summer,friday,0
|
|
@ -1,52 +0,0 @@
|
||||
|--- payment <= 0.50
|
||||
| |--- class: 0
|
||||
|--- payment > 0.50
|
||||
| |--- trash <= 0.50
|
||||
| | |--- class: 0
|
||||
| |--- trash > 0.50
|
||||
| | |--- bin_fullness <= 0.50
|
||||
| | | |--- class: 0
|
||||
| | |--- bin_fullness > 0.50
|
||||
| | | |--- truck_fullness <= 0.50
|
||||
| | | | |--- dump_fullness <= 0.50
|
||||
| | | | | |--- trash_types_mixed <= 0.50
|
||||
| | | | | | |--- season_summer <= 0.50
|
||||
| | | | | | | |--- day_monday <= 0.50
|
||||
| | | | | | | | |--- class: 1
|
||||
| | | | | | | |--- day_monday > 0.50
|
||||
| | | | | | | | |--- season_winter <= 0.50
|
||||
| | | | | | | | | |--- class: 1
|
||||
| | | | | | | | |--- season_winter > 0.50
|
||||
| | | | | | | | | |--- trash_types_plastic <= 0.50
|
||||
| | | | | | | | | | |--- class: 1
|
||||
| | | | | | | | | |--- trash_types_plastic > 0.50
|
||||
| | | | | | | | | | |--- class: 0
|
||||
| | | | | | |--- season_summer > 0.50
|
||||
| | | | | | | |--- day_wednesday <= 0.50
|
||||
| | | | | | | | |--- class: 1
|
||||
| | | | | | | |--- day_wednesday > 0.50
|
||||
| | | | | | | | |--- trash_types_plastic <= 0.50
|
||||
| | | | | | | | | |--- class: 0
|
||||
| | | | | | | | |--- trash_types_plastic > 0.50
|
||||
| | | | | | | | | |--- class: 1
|
||||
| | | | | |--- trash_types_mixed > 0.50
|
||||
| | | | | | |--- day_wednesday <= 0.50
|
||||
| | | | | | | |--- season_winter <= 0.50
|
||||
| | | | | | | | |--- season_spring <= 0.50
|
||||
| | | | | | | | | |--- day_friday <= 0.50
|
||||
| | | | | | | | | | |--- class: 1
|
||||
| | | | | | | | | |--- day_friday > 0.50
|
||||
| | | | | | | | | | |--- class: 0
|
||||
| | | | | | | | |--- season_spring > 0.50
|
||||
| | | | | | | | | |--- day_monday <= 0.50
|
||||
| | | | | | | | | | |--- class: 1
|
||||
| | | | | | | | | |--- day_monday > 0.50
|
||||
| | | | | | | | | | |--- class: 0
|
||||
| | | | | | | |--- season_winter > 0.50
|
||||
| | | | | | | | |--- class: 0
|
||||
| | | | | | |--- day_wednesday > 0.50
|
||||
| | | | | | | |--- class: 1
|
||||
| | | | |--- dump_fullness > 0.50
|
||||
| | | | | |--- class: 0
|
||||
| | | |--- truck_fullness > 0.50
|
||||
| | | | |--- class: 0
|
Before Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 4.2 KiB |