Genetics Algorithms

This commit is contained in:
s473633 2023-06-19 11:25:43 +02:00
parent f96f8229a9
commit e7358998ef
9 changed files with 353 additions and 1 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,6 +3,7 @@ import pygame as pg
import heapq
from decisiontree import decision
from trashtype import trash_type_def
import genetics
HOUSE_NUMBER = {'House_number': 0}
@ -40,6 +41,7 @@ class HousePOI:
self.trash = 1
self.dump_fullness = 0
def discover_bins(self, bin_fullness, trash_type, payment):
from simulation import Interface
@ -146,6 +148,7 @@ 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
@ -299,7 +302,8 @@ class Agent:
def a_star(self):
fringe = []
explored = set()
initial_state = (self.current_pos, tuple(self.houses))
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)

95
src/genetics.py Normal file
View File

@ -0,0 +1,95 @@
import random
# Parametry algorytmu genetycznego
POPULATION_SIZE = 100
MUTATION_RATE = 0.01
NUM_GENERATIONS = 100
# Generowanie początkowej populacji
def generate_individual(houses):
return random.sample(houses, len(houses))
def generate_population(houses, size):
return [generate_individual(houses) for _ in range(size)]
# Obliczanie odległości między domkami
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
# Selekcja rodziców za pomocą turniejowej metody
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
# Krzyżowanie rodziców
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]
# Uzupełnienie brakujących domków z drugiego rodzica
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
# Mutacja: zamiana dwóch losowych domków
def mutate(individual):
index1, index2 = random.sample(range(len(individual)), 2)
individual[index1], individual[index2] = individual[index2], individual[index1]
# Algorytm genetyczny
def genetic_algorithm(houses):
population = generate_population(houses, POPULATION_SIZE)
for _ in range(NUM_GENERATIONS):
# Obliczanie wartości przystosowania (odległości) dla każdego osobnika
fitness_scores = [calculate_total_distance(individual) for individual in population]
# Wybór rodziców do reprodukcji
parents = select_parents(population, 2)
# Tworzenie nowej populacji za pomocą krzyżowania i mutacji
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
# Znalezienie najlepszego osobnika
best_individual = min(population, key=calculate_total_distance)
return best_individual

201
src/tree_data.csv Normal file
View File

@ -0,0 +1,201 @@
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 dump_fullness truck_fullness trash payment bin_fullness trash_types season day decision
2 0 0 0 1 0 glass winter wednesday 0
3 1 1 1 0 1 mixed spring monday 0
4 0 1 1 1 0 plastic winter monday 0
5 1 0 1 1 0 glass spring monday 0
6 1 1 1 0 0 paper spring wednesday 0
7 0 1 0 1 1 plastic spring monday 0
8 1 1 1 1 1 mixed autumn friday 0
9 0 0 1 0 1 glass autumn friday 0
10 1 0 0 1 1 glass spring monday 0
11 0 0 0 0 0 paper spring friday 0
12 1 1 0 1 0 paper summer friday 0
13 1 1 1 0 0 mixed spring wednesday 0
14 1 0 1 1 0 mixed autumn monday 0
15 0 0 1 0 1 mixed summer wednesday 0
16 1 0 1 0 0 glass spring monday 0
17 1 1 1 0 0 paper autumn friday 0
18 0 0 1 0 1 paper summer friday 0
19 1 0 0 1 1 glass autumn wednesday 0
20 1 1 1 1 0 glass winter wednesday 0
21 0 0 0 0 0 plastic summer monday 0
22 0 0 1 1 1 mixed autumn friday 0
23 1 0 1 0 0 mixed summer friday 0
24 1 0 0 1 0 paper winter friday 0
25 1 1 1 0 1 paper winter wednesday 0
26 0 0 1 1 1 glass summer wednesday 0
27 1 0 0 0 0 glass summer friday 0
28 0 0 0 1 0 glass summer wednesday 0
29 1 0 1 1 0 paper spring friday 0
30 1 1 1 1 1 paper autumn monday 0
31 1 0 0 1 0 glass winter wednesday 0
32 1 0 1 0 1 paper spring wednesday 0
33 0 1 0 1 0 mixed winter wednesday 0
34 1 1 1 1 1 paper winter friday 0
35 1 0 1 0 0 glass autumn wednesday 0
36 0 1 0 0 1 plastic autumn monday 0
37 0 0 1 1 1 glass winter friday 1
38 0 1 0 1 1 paper spring monday 0
39 1 0 0 0 1 plastic spring monday 0
40 0 0 1 1 1 mixed autumn monday 1
41 0 1 1 0 1 glass spring monday 0
42 0 0 1 1 0 paper autumn wednesday 0
43 0 0 0 1 1 plastic spring friday 0
44 1 0 1 1 0 plastic summer monday 0
45 1 1 1 1 1 plastic winter friday 0
46 0 0 0 1 1 mixed autumn friday 0
47 1 0 1 0 0 paper spring wednesday 0
48 0 0 0 1 1 glass spring monday 0
49 0 1 1 0 0 plastic summer wednesday 0
50 1 0 1 0 0 glass summer friday 0
51 0 1 0 0 0 glass winter wednesday 0
52 0 0 0 1 0 paper summer monday 0
53 1 1 0 0 1 plastic summer friday 0
54 1 0 0 0 0 plastic spring monday 0
55 1 0 1 1 0 plastic autumn friday 0
56 1 1 1 1 0 mixed autumn wednesday 0
57 0 0 0 0 1 paper autumn monday 0
58 0 0 1 1 0 glass winter friday 0
59 0 1 0 1 0 glass summer wednesday 0
60 1 1 0 0 0 plastic summer monday 0
61 0 1 0 1 0 paper spring monday 0
62 0 0 1 1 1 mixed winter wednesday 1
63 0 0 1 0 0 plastic spring monday 0
64 1 1 0 0 1 mixed winter monday 0
65 0 0 1 1 1 mixed summer wednesday 1
66 0 1 0 0 1 paper winter friday 0
67 0 0 1 1 1 plastic winter monday 0
68 1 0 1 0 0 glass winter monday 0
69 0 0 1 0 0 mixed summer monday 0
70 1 1 1 0 1 mixed spring friday 0
71 1 0 1 1 1 mixed spring monday 0
72 1 1 0 1 1 glass autumn friday 0
73 0 1 0 0 1 plastic spring monday 0
74 0 1 1 0 1 plastic spring monday 0
75 0 0 1 1 1 plastic autumn monday 1
76 1 0 0 1 0 glass spring wednesday 0
77 1 1 1 0 0 plastic autumn monday 0
78 0 1 0 1 1 plastic spring friday 0
79 0 1 0 1 1 glass autumn wednesday 0
80 1 0 0 0 1 mixed winter friday 0
81 1 0 1 1 0 plastic spring monday 0
82 0 0 1 0 1 plastic summer friday 0
83 1 1 0 0 0 glass spring wednesday 0
84 0 1 1 1 1 mixed winter wednesday 0
85 1 1 0 1 0 mixed winter friday 0
86 0 0 1 1 1 paper spring friday 1
87 0 1 1 0 1 mixed spring friday 0
88 1 1 1 0 0 glass winter monday 0
89 1 1 1 0 1 glass spring monday 0
90 1 0 0 1 1 plastic spring monday 0
91 0 0 1 1 1 paper autumn friday 1
92 0 0 0 0 1 paper autumn wednesday 0
93 1 1 1 0 1 plastic summer monday 0
94 0 1 1 1 1 paper spring monday 0
95 0 1 1 1 1 plastic spring monday 0
96 0 1 1 0 1 glass autumn wednesday 0
97 0 0 1 1 1 paper summer friday 1
98 1 1 1 1 1 mixed winter wednesday 0
99 0 1 1 0 0 mixed spring friday 0
100 1 1 0 0 0 paper autumn friday 0
101 1 1 0 1 1 paper winter friday 0
102 1 1 1 1 0 mixed winter monday 0
103 1 1 0 0 0 plastic summer wednesday 0
104 0 0 0 0 0 mixed winter wednesday 0
105 1 1 1 1 0 paper spring monday 0
106 1 1 1 0 0 plastic winter wednesday 0
107 0 0 0 1 1 paper summer friday 0
108 0 1 0 0 0 glass autumn friday 0
109 0 1 0 0 0 plastic spring monday 0
110 1 1 0 1 0 paper spring monday 0
111 0 1 0 0 1 plastic spring wednesday 0
112 0 1 0 1 0 mixed spring monday 0
113 1 0 1 1 1 paper summer friday 0
114 0 1 1 1 0 mixed winter friday 0
115 0 0 1 0 0 plastic autumn friday 0
116 1 1 0 1 0 paper spring friday 0
117 1 0 1 0 1 mixed winter wednesday 0
118 0 0 0 0 0 glass autumn monday 0
119 1 0 1 1 1 mixed autumn friday 0
120 1 1 0 1 1 paper spring monday 0
121 1 1 1 0 0 glass winter wednesday 0
122 0 0 1 1 1 glass autumn wednesday 1
123 0 0 0 1 1 glass spring friday 0
124 1 0 1 0 1 paper winter monday 0
125 0 0 1 1 1 paper winter monday 1
126 0 1 1 0 0 glass summer wednesday 0
127 0 0 1 1 0 glass spring wednesday 0
128 0 0 1 1 0 paper spring wednesday 0
129 1 0 0 0 0 paper summer wednesday 0
130 1 1 0 0 1 glass autumn monday 0
131 1 1 0 0 1 paper spring monday 0
132 0 0 0 1 1 plastic spring monday 0
133 0 1 1 0 1 plastic autumn monday 0
134 0 0 0 1 0 plastic spring wednesday 0
135 0 1 1 1 0 glass autumn monday 0
136 1 0 0 0 1 glass summer monday 0
137 1 0 0 0 0 paper winter wednesday 0
138 0 0 1 1 1 glass summer monday 1
139 1 1 0 1 0 glass summer monday 0
140 0 1 1 1 1 glass winter monday 0
141 0 0 0 1 1 glass winter wednesday 0
142 0 0 1 0 1 mixed winter friday 0
143 0 1 0 1 1 paper winter monday 0
144 0 0 1 1 1 mixed spring friday 1
145 0 0 1 1 0 glass winter monday 0
146 1 0 0 0 1 paper summer monday 0
147 1 0 0 0 1 plastic summer wednesday 0
148 0 1 1 1 1 plastic winter friday 0
149 0 0 1 0 0 paper autumn friday 0
150 0 0 1 1 1 plastic summer wednesday 1
151 1 0 1 0 1 paper winter wednesday 0
152 0 0 0 0 0 plastic spring wednesday 0
153 1 0 1 0 0 glass winter wednesday 0
154 1 0 1 1 1 plastic summer wednesday 0
155 0 1 1 0 1 paper summer wednesday 0
156 0 1 0 1 0 paper winter wednesday 0
157 0 0 1 1 1 plastic spring monday 1
158 0 1 1 1 0 paper winter wednesday 0
159 0 1 1 1 0 glass autumn friday 0
160 1 1 1 0 0 plastic spring monday 0
161 0 0 1 0 1 mixed spring wednesday 0
162 0 1 1 0 0 glass summer friday 0
163 1 1 0 1 0 plastic winter monday 0
164 0 0 0 1 0 paper winter wednesday 0
165 1 0 1 0 1 plastic summer friday 0
166 1 0 0 0 1 mixed autumn friday 0
167 0 0 0 1 1 plastic winter friday 0
168 1 0 0 0 0 plastic winter monday 0
169 1 0 0 1 0 plastic winter friday 0
170 1 0 0 0 1 glass spring monday 0
171 0 0 0 1 1 plastic autumn friday 0
172 0 1 0 1 1 glass spring friday 0
173 0 0 0 1 1 mixed spring wednesday 0
174 1 1 1 1 0 paper autumn wednesday 0
175 0 0 1 1 1 mixed winter friday 0
176 0 1 0 0 1 paper summer monday 0
177 0 0 1 1 1 paper summer wednesday 0
178 1 0 1 0 1 paper autumn wednesday 0
179 0 1 1 1 1 mixed spring friday 0
180 0 0 0 1 1 glass winter friday 0
181 0 1 0 0 0 glass winter monday 0
182 0 0 1 0 1 glass autumn wednesday 0
183 0 0 0 1 0 plastic summer friday 0
184 1 1 1 1 0 mixed spring wednesday 0
185 1 0 1 0 1 plastic autumn friday 0
186 0 1 1 0 1 mixed autumn monday 0
187 0 1 0 1 1 plastic winter wednesday 0
188 0 1 1 0 1 mixed winter friday 0
189 1 0 0 0 1 plastic summer friday 0
190 1 0 1 0 1 mixed spring friday 0
191 1 1 1 1 0 paper summer monday 0
192 1 0 1 0 1 paper winter friday 0
193 0 1 1 0 1 paper summer friday 0
194 0 0 1 1 1 plastic winter wednesday 1
195 0 0 1 1 1 mixed spring monday 0
196 0 1 1 0 1 paper winter wednesday 0
197 1 1 1 1 0 plastic spring friday 0
198 1 0 1 1 0 paper summer friday 0
199 1 1 0 0 1 glass autumn friday 0
200 0 0 1 1 1 glass spring wednesday 1
201 1 1 0 1 1 paper summer friday 0

52
src/tree_in_txt.txt Normal file
View File

@ -0,0 +1,52 @@
|--- dump_fullness <= 0.50
| |--- truck_fullness <= 0.50
| | |--- trash <= 0.50
| | | |--- class: 0
| | |--- trash > 0.50
| | | |--- payment <= 0.50
| | | | |--- class: 0
| | | |--- payment > 0.50
| | | | |--- bin_fullness <= 0.50
| | | | | |--- class: 0
| | | | |--- bin_fullness > 0.50
| | | | | |--- trash_types_mixed <= 0.50
| | | | | | |--- season_summer <= 0.50
| | | | | | | |--- trash_types_plastic <= 0.50
| | | | | | | | |--- class: 1
| | | | | | | |--- trash_types_plastic > 0.50
| | | | | | | | |--- season_winter <= 0.50
| | | | | | | | | |--- class: 1
| | | | | | | | |--- season_winter > 0.50
| | | | | | | | | |--- day_wednesday <= 0.50
| | | | | | | | | | |--- class: 0
| | | | | | | | | |--- day_wednesday > 0.50
| | | | | | | | | | |--- class: 1
| | | | | | |--- 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
| | | | | | | | |--- day_monday <= 0.50
| | | | | | | | | |--- season_spring <= 0.50
| | | | | | | | | | |--- class: 0
| | | | | | | | | |--- season_spring > 0.50
| | | | | | | | | | |--- class: 1
| | | | | | | | |--- day_monday > 0.50
| | | | | | | | | |--- season_spring <= 0.50
| | | | | | | | | | |--- class: 1
| | | | | | | | | |--- season_spring > 0.50
| | | | | | | | | | |--- class: 0
| | | | | | | |--- season_winter > 0.50
| | | | | | | | |--- class: 0
| | | | | | |--- day_wednesday > 0.50
| | | | | | | |--- class: 1
| |--- truck_fullness > 0.50
| | |--- class: 0
|--- dump_fullness > 0.50
| |--- class: 0