You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
💦 Lem In is an algorithmic project about a [maximum flow problem](https://en.wikipedia.org/wiki/Maximum_flow_problem#:~:text=In%20optimization%20theory%2C%20maximum%20flow,such%20as%20the%20circulation%20problem.) in graph theory.
8
+
💦 Lem In is an **algorithmic project** about a [maximum flow problem](https://en.wikipedia.org/wiki/Maximum_flow_problem#:~:text=In%20optimization%20theory%2C%20maximum%20flow,such%20as%20the%20circulation%20problem.) in graph theory.
9
9
10
-
The goal is to find the **optimal flow of ants through an anthill** while minimizing the number of rounds to cross the anthill.
10
+
The goal is to find the **optimal flow of ants through an anthill** while minimizing the number of rounds to cross it.
11
+
12
+
**Check that video** (from another student) to visualize what it is all about 💁🏼♀️
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>
11
17
12
18
## Ant farm description:
13
19
@@ -29,14 +35,14 @@ in the following format:
29
35
-**number** of ants
30
36
- Ant farm **description**
31
37
32
-
There is **always a "start" room and an "end" room**. These rooms are preceded by a #start or #end comment.
38
+
There is **always a "start" room and an "end" room**. These rooms are preceded by a `#start` or `#end` comment.
33
39
34
40
At the beginning, all ants are inside the **"start room"**.
35
41
**The goal is to bring them to the "end room"**.
36
42
37
43
## Solution: improved Breadth-First Search (BFS)
38
44
39
-
The solution can be one or multiple paths.
45
+
The solution can be one or multiple paths. If you have only one ant, you'll need only one path but if there is more than one ant, you might consider finding more paths 🔎
40
46
41
47
To find the best (and good number of) paths, I used an algorithm inspired by **[Breadth-first search](https://en.wikipedia.org/wiki/Breadth-first_search)**
42
48
@@ -53,9 +59,14 @@ However, this solution is flawed because it may prevent the program to find mult
53
59
54
60
For example, this solution is not optimal because a BFS find **only one path** when the most efficient solution would be to find two paths.
55
61
56
-
### ✅ Bradth-first search + backtracking
62
+
### ✅ Modified Bradth-first search
63
+
64
+
When looking for more than one path, we decided to **modify the BFS algorith** and **allow using a occupied room to find more path**.
65
+
**The rule is:**
66
+
- As long as we can find a new path without an occupied room, let's avoid occupied room.
67
+
- But when we have no choice, let's make a try.
68
+
- When we find a new solution (new path configuration), let's compare both solutions to find the most optimal one.
57
69
58
-
We decided to modify the BFS algorithm and **allow backtracking on a room already included in a path**. As a result, we can find the maximum number of available path we need to solve the issue.
0 commit comments