File size: 5,104 Bytes
ed69de8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146



![flux_krea_00365_](https://cdn-uploads.huggingface.co/production/uploads/68401f649e3f451260c68974/Er62mlciwE7gxap16wOk_.png)

---
license: mit
tags:
- pathfinding
- simulation
- reinforcement-learning
- pyqt5
- autonomous-agents
- ai-education
- vacuum-cleaner
- search-algorithms
- bfs
- a-star
- manhattan-distance
- euclidean-distance
- chebyshev-distance
- turn-cost
- performance-metrics
- >-
  - turn-cost - performance-metrics - algorithm-comparison - visualization-tool
  - educational-software - python - artificial-intelligence -
  robotics-simulation - grid-world - obstacle-avoidance -
  multi-algorithm-framework - heuristic-evaluation - computational-efficiency -
  node-expansion - path-optimization - interactive-learning -
  real-time-simulation - gui-application - academic-project - research-tool -
  algorithm-visualization - performance-analysis - turn-penalty - cost-analysis
  - exploration-strategies - search-techniques - autonomous-navigation -
  intelligent-agents - simulation-environment
- >-
  - path-planning - heuristic-search - comparative-analysis -
  educational-resource - ai-simulation - robotics-education -
  algorithm-benchmarking - performance-metrics - visualization-framework -
  interactive-demonstration - learning-tool - academic-resource -
  simulation-software - ai-visualization - pathfinding-algorithms -
  search-methods - heuristic-functions - turn-cost-modeling -
  performance-evaluation - algorithm-testing - simulation-platform -
  educational-application - ai-demonstration - robotics-simulation -
  autonomous-systems - intelligent-systems - search-strategies -
  path-optimization - performance-comparison - heuristic-performance -
  algorithm-efficiency - simulation-tool - visualization-software -
  educational-software - ai-education - robotics-education -
  pathfinding-visualization - algorithm-visualization -
  performance-visualization - turn-cost-visualization -
  multi-algorithm-comparison - interactive-simulation - real-time-visualization
  - gui-simulation - pyqt5-application - python-simulation - grid-simulation -
  obstacle-navigation - dirty-cell-cleaning - autonomous-cleaning -
  vacuum-simulation - search-algorithm-comparison - heuristic-comparison
---
---
title: Vacuum Cleaner Search Simulation
emoji: ๐Ÿ 
colorFrom: blue
colorTo: green
pinned: false
license: mit
---

# Vacuum Cleaner Search Simulation

An interactive simulation that demonstrates various search algorithms for vacuum cleaner pathfinding in a grid environment.

## ๐ŸŽฏ Overview

This application visualizes how different search algorithms navigate through a grid to find and clean dirty cells while avoiding obstacles. The simulation compares the performance of BFS and A* search with different heuristics.

## ๐Ÿง  Features

- **Multiple Search Algorithms**:
  - BFS (Breadth-First Search)
  - A* with Manhattan distance heuristic
  - A* with Euclidean distance heuristic  
  - A* with Chebyshev distance heuristic

- **Interactive Controls**:
  - Reset environment
  - Step-by-step simulation
  - Auto-run mode
  - Turn cost toggle (adds cost for direction changes)

- **Real-time Metrics**:
  - Steps taken and total cost
  - Nodes explored and expanded
  - Computation time
  - Algorithm performance comparison

## ๐ŸŽฎ How to Use

1. **Setup the Environment**:
   - The grid automatically generates with obstacles (blue) and dirty cells (red)
   - The vacuum starts at a random clean position

2. **Choose Algorithm**:
   - Select from the dropdown menu (BFS, A* Manhattan, A* Euclidean, A* Chebyshev)

3. **Configure Options**:
   - Toggle "Turn Cost" to enable/disable penalty for direction changes
   - Turn cost adds +0.5 for each 90ยฐ direction change

4. **Run Simulation**:
   - Click **Next** to advance one step
   - Click **Run** for continuous automatic execution
   - Click **Stop** to pause automatic execution
   - Click **Reset** to generate a new environment

## ๐Ÿ—๏ธ Technical Details

### Search Algorithms

- **BFS**: Explores all directions equally, guarantees shortest path
- **A* Manhattan**: Uses city-block distance heuristic (`|x1-x2| + |y1-y2|`)
- **A* Euclidean**: Uses straight-line distance heuristic
- **A* Chebyshev**: Uses chessboard distance heuristic (`max(|x1-x2|, |y1-y2|)`)

### Cell Types

- ๐ŸŸก **Yellow**: Clean cells
- ๐Ÿ”ด **Red**: Dirty cells (need cleaning)
- ๐Ÿ”ต **Blue**: Obstacles (block movement)
- ๐ŸŸข **Green**: Explored cells
- ๐ŸŸ  **Orange**: Current path

### Performance Metrics

- **Nodes Explored**: Total unique positions visited
- **Nodes Expanded**: Total nodes processed by algorithm
- **Computation Time**: Time taken to find paths
- **Turn Cost**: Additional cost from direction changes

## ๐Ÿ“Š Algorithm Comparison

The application tracks and compares:
- Average nodes expanded per run
- Average computation time
- Efficiency across different heuristics

Typically:
- **BFS** explores more nodes but finds optimal paths
- **A* Euclidean** is often most efficient for direct paths
- **A* Chebyshev** may explore more nodes in grid environments

## ๐Ÿš€ Local Development