The searcher
Particle Swarm Optimization
Moves the routers towards better positions.
Like 20 friends searching a dark field for the best phone signal, who keep telling each other the best spot found so far.
Introduction
Soft Computing mini project · BMS College of Engineering
Wi-Fi router placement using Particle Swarm Optimization and fuzzy logic
Presented by
Shrilaxmi Heralagi & Sneha Uday
Use the arrow keys, or swipe on a phone
The problem
A router in the wrong place leaves some rooms with weak Wi-Fi. FuzzyFi finds where to put two routers on a hostel floor, so that as much of the floor as possible gets a good signal.
Why soft computing?
vs
Walls make the score jump suddenly, so no simple formula gives the best position. Soft computing finds a very good answer quickly, instead of a perfect answer slowly.
The two techniques
The searcher
Moves the routers towards better positions.
Like 20 friends searching a dark field for the best phone signal, who keep telling each other the best spot found so far.
The judge
Rates how good the signal is at each spot.
Instead of only good or bad, a spot can be 30% weak and 70% medium, the way people describe things.
Everything else, like the signal formula, the server and the drawing, is normal programming.
Signal model · signal_model.py
signal = −30 − 30 × log10(distance) − 6 × walls
Example: a spot 10 m from a router, through 2 walls: −30 − 30 × log10(10) − 6 × 2 = −72 dBm. Closer to 0 is stronger. Each spot uses whichever router gives it the stronger signal.
Fuzzy logic · Step 1
Each number gets a percentage for each group, called its membership. The groups overlap, so a spot can belong to two groups at once.
With one hard cut-off, −64 dBm could be good and −66 dBm bad, although they are almost the same. Fuzzy logic avoids this sudden jump.
The example spot: −72 dBm and 2 walls.
Fuzzy logic · Step 2
A rule is only as true as its weaker condition, so AND takes the smaller of the two percentages. For the example spot, four rules apply.
| If signal is | And walls are | Then quality is | Strength for the example |
|---|---|---|---|
| Strong | Few | Excellent (100) | min(0.00, 0.67) = 0.00 |
| Strong | Many | Good (70) | min(0.00, 0.33) = 0.00 |
| Medium | Few | Good (70) | min(0.53, 0.67) = 0.53 |
| Medium | Many | Fair (40) | min(0.53, 0.33) = 0.33 |
| Weak | Few | Fair (40) | min(0.47, 0.67) = 0.47 |
| Weak | Many | Poor (10) | min(0.47, 0.33) = 0.33 |
Walls are used twice on purpose. The formula lowers the signal for each wall, and fuzzy logic then treats a spot behind many walls as less reliable.
Fuzzy logic · Step 3
Each rule votes for its output number, and stronger rules count for more. The final rating is the weighted average. Because the outputs are fixed numbers, this is a Sugeno-style fuzzy system.
rating = sum of (strength × output) ÷ sum of strengths
(0.53 × 70 + 0.33 × 40 + 0.47 × 40 + 0.33 × 10) ÷ 1.67 = 72.7 ÷ 1.67 = 43.6
Particle Swarm Optimization · pso.py
Particle Swarm Optimization
new speed = 0.7 × old speed + 1.5 × r1 × (own best − position) + 1.5 × r2 × (swarm best − position)
new position = position + new speed
| Part | Value | Meaning |
|---|---|---|
| Inertia | 0.7 | Keeps part of the old speed, so a particle keeps exploring |
| Own pull | 1.5 | Pull towards the particle's own best |
| Swarm pull | 1.5 | Pull towards the swarm's best |
| r1, r2 | 0 to 1 | Random, so particles do not all move the same way |
Position 10, speed 1, own best 12, swarm best 14, r1 = 0.4, r2 = 0.6.
Speed: 0.7 + 1.2 + 3.6 = 5.5
Position: 10 + 5.5 = 15.5
It went past the swarm's best. That is normal, and it helps the swarm explore nearby.
Implementation · Python, Flask, HTML/CSS/JS
For every particle, every iteration
All the soft computing runs in Python. The browser only draws the results.
Results
Over 10 runs, PSO scored 82.5 to 83.5 and gave 94% to 99% of the floor a good signal. 100 random placements average 66.0 and 65%. A spot counts as good from a rating of 55.
Conclusion
Questions?
Soft Computing · BMS College of Engineering