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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
Here's a comprehensive Hugging Face model card for your Particle Swarm Optimization PyQt5 application:
|
| 5 |
+
|
| 6 |
+
```markdown
|
| 7 |
+
---
|
| 8 |
+
language:
|
| 9 |
+
- en
|
| 10 |
+
tags:
|
| 11 |
+
- optimization
|
| 12 |
+
- particle-swarm
|
| 13 |
+
- pso
|
| 14 |
+
- mathematical-optimization
|
| 15 |
+
- benchmark-functions
|
| 16 |
+
- pyqt5
|
| 17 |
+
- gui
|
| 18 |
+
- visualization
|
| 19 |
+
- metaheuristics
|
| 20 |
+
- evolutionary-computation
|
| 21 |
+
library_name: pyqt5
|
| 22 |
+
pipeline_tag: visualization
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
# Particle Swarm Optimization Visualizer
|
| 26 |
+
|
| 27 |
+
## Model Overview
|
| 28 |
+
|
| 29 |
+
A comprehensive PyQt5 application that implements Particle Swarm Optimization (PSO) to solve 20 different mathematical optimization problems with real-time 2D and 3D visualizations. Watch particles oscillate and converge towards optimal solutions across various benchmark functions.
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+

|
| 33 |
+

|
| 34 |
+
|
| 35 |
+
## Features
|
| 36 |
+
|
| 37 |
+
### 🎯 20 Optimization Problems
|
| 38 |
+
- **10 2D Benchmark Functions**: Sphere, Rosenbrock, Rastrigin, Ackley, Matyas, Himmelblau, Three-Hump Camel, Easom, Cross-in-Tray, Holder Table
|
| 39 |
+
- **10 3D Benchmark Functions**: Sphere 3D, Rosenbrock 3D, Rastrigin 3D, Ackley 3D, Sum of Different Powers, Rotated Hyper-Ellipsoid, Zakharov 3D, Dixon-Price, Levy 3D, Michalewicz 3D
|
| 40 |
+
|
| 41 |
+
### 📊 Real-time Visualizations
|
| 42 |
+
- **2D Contour Plots**: Particle movement over function landscapes
|
| 43 |
+
- **3D Surface Plots**: Interactive 3D optimization landscapes
|
| 44 |
+
- **Live Particle Tracking**: Watch particles oscillate and converge
|
| 45 |
+
- **Progress Monitoring**: Real-time optimization progress
|
| 46 |
+
|
| 47 |
+
### ⚙️ Customizable PSO Parameters
|
| 48 |
+
- Particle count (10-100)
|
| 49 |
+
- Iterations (10-500)
|
| 50 |
+
- Inertia weight (0.1-1.0)
|
| 51 |
+
- Cognitive parameter (0.1-2.0)
|
| 52 |
+
- Social parameter (0.1-2.0)
|
| 53 |
+
|
| 54 |
+
## Quick Start
|
| 55 |
+
|
| 56 |
+
### Installation
|
| 57 |
+
|
| 58 |
+
```bash
|
| 59 |
+
# Clone repository
|
| 60 |
+
git clone https://huggingface.co/TroglodyteDerivations/pso-pyqt5-visualizer
|
| 61 |
+
cd pso-pyqt5-visualizer
|
| 62 |
+
|
| 63 |
+
# Install dependencies
|
| 64 |
+
pip install -r requirements.txt
|
| 65 |
+
|
| 66 |
+
# Run the application
|
| 67 |
+
python app.py
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
### Requirements
|
| 71 |
+
|
| 72 |
+
```txt
|
| 73 |
+
numpy>=1.21.0
|
| 74 |
+
matplotlib>=3.5.0
|
| 75 |
+
PyQt5>=5.15.0
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
## Usage
|
| 79 |
+
|
| 80 |
+
1. **Select Equation**: Choose from 20 benchmark functions
|
| 81 |
+
2. **Configure Parameters**: Adjust PSO parameters as needed
|
| 82 |
+
3. **Run Optimization**: Click "Run PSO" to start
|
| 83 |
+
4. **Visualize**: Watch real-time particle movement
|
| 84 |
+
5. **Analyze**: Review optimization results
|
| 85 |
+
|
| 86 |
+
## Application Interface
|
| 87 |
+
|
| 88 |
+
### Control Panel
|
| 89 |
+
- Equation selection with detailed descriptions
|
| 90 |
+
- PSO parameter configuration
|
| 91 |
+
- Interactive controls (Run, Pause, Step, Reset)
|
| 92 |
+
- Real-time progress tracking
|
| 93 |
+
- Results display
|
| 94 |
+
|
| 95 |
+
### Visualization Panel
|
| 96 |
+
- **Top**: 2D contour plots with particle trajectories
|
| 97 |
+
- **Bottom**: 3D surface plots showing optimization landscape
|
| 98 |
+
- Real-time updates during optimization
|
| 99 |
+
|
| 100 |
+
## Benchmark Functions
|
| 101 |
+
|
| 102 |
+
### 2D Functions
|
| 103 |
+
| Function | Description | Global Minimum |
|
| 104 |
+
|----------|-------------|----------------|
|
| 105 |
+
| Sphere | f(x,y) = x² + y² | (0,0) |
|
| 106 |
+
| Rosenbrock | f(x,y) = 100(y-x²)² + (1-x)² | (1,1) |
|
| 107 |
+
| Rastrigin | Multi-modal function | (0,0) |
|
| 108 |
+
| Ackley | Many local minima | (0,0) |
|
| 109 |
+
| Himmelblau | Four equal minima | Multiple |
|
| 110 |
+
|
| 111 |
+
### 3D Functions
|
| 112 |
+
| Function | Dimensions | Complexity |
|
| 113 |
+
|----------|------------|------------|
|
| 114 |
+
| Sphere 3D | 3 | Unimodal |
|
| 115 |
+
| Rastrigin 3D | 3 | Multi-modal |
|
| 116 |
+
| Michalewicz | 3 | Many local minima |
|
| 117 |
+
| Levy 3D | 3 | Complex landscape |
|
| 118 |
+
|
| 119 |
+
## PSO Algorithm
|
| 120 |
+
|
| 121 |
+
### Mathematical Formulation
|
| 122 |
+
Particle velocity and position updates:
|
| 123 |
+
|
| 124 |
+
```
|
| 125 |
+
v_i(t+1) = w * v_i(t) + c1 * r1 * (pbest_i - x_i(t)) + c2 * r2 * (gbest - x_i(t))
|
| 126 |
+
x_i(t+1) = x_i(t) + v_i(t+1)
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
Where:
|
| 130 |
+
- `w`: Inertia weight
|
| 131 |
+
- `c1`, `c2`: Cognitive and social parameters
|
| 132 |
+
- `r1`, `r2`: Random numbers
|
| 133 |
+
- `pbest_i`: Particle's best position
|
| 134 |
+
- `gbest`: Global best position
|
| 135 |
+
|
| 136 |
+
### Key Features
|
| 137 |
+
- **Boundary Handling**: Particles bounce off boundaries
|
| 138 |
+
- **Velocity Clamping**: Prevents explosion
|
| 139 |
+
- **History Tracking**: Complete optimization history
|
| 140 |
+
- **Convergence Monitoring**: Real-time best value tracking
|
| 141 |
+
|
| 142 |
+
## Educational Value
|
| 143 |
+
|
| 144 |
+
This application serves as an excellent educational tool for:
|
| 145 |
+
- Understanding PSO algorithm behavior
|
| 146 |
+
- Visualizing optimization landscapes
|
| 147 |
+
- Comparing benchmark function characteristics
|
| 148 |
+
- Studying metaheuristic optimization
|
| 149 |
+
- Learning about multi-modal optimization
|
| 150 |
+
|
| 151 |
+
## Performance
|
| 152 |
+
|
| 153 |
+
### Optimization Capabilities
|
| 154 |
+
- **Convergence**: Rapid convergence on unimodal functions
|
| 155 |
+
- **Exploration**: Effective global search on multi-modal functions
|
| 156 |
+
- **Stability**: Robust performance across different landscapes
|
| 157 |
+
- **Scalability**: Handles 2D and 3D problems efficiently
|
| 158 |
+
|
| 159 |
+
### Visualization Performance
|
| 160 |
+
- **Smooth Animation**: 30+ FPS particle movement
|
| 161 |
+
- **Interactive Plots**: Zoom, pan, and rotate 3D views
|
| 162 |
+
- **Real-time Updates**: Instant parameter feedback
|
| 163 |
+
- **Memory Efficient**: Optimized for long runs
|
| 164 |
+
|
| 165 |
+
## Use Cases
|
| 166 |
+
|
| 167 |
+
### 🎓 Education
|
| 168 |
+
- Optimization algorithm courses
|
| 169 |
+
- Metaheuristic visualization
|
| 170 |
+
- Mathematical modeling classes
|
| 171 |
+
|
| 172 |
+
### 🔬 Research
|
| 173 |
+
- Algorithm benchmarking
|
| 174 |
+
- Parameter sensitivity analysis
|
| 175 |
+
- Optimization landscape study
|
| 176 |
+
|
| 177 |
+
### 💼 Industry
|
| 178 |
+
- Engineering optimization problems
|
| 179 |
+
- Machine learning hyperparameter tuning
|
| 180 |
+
- Financial modeling optimization
|
| 181 |
+
|
| 182 |
+
## Contributing
|
| 183 |
+
|
| 184 |
+
We welcome contributions! Areas for improvement:
|
| 185 |
+
- Additional benchmark functions
|
| 186 |
+
- Advanced PSO variants
|
| 187 |
+
- Export functionality
|
| 188 |
+
- Performance optimizations
|
| 189 |
+
- Additional visualization types
|
| 190 |
+
|
| 191 |
+
## Citation
|
| 192 |
+
|
| 193 |
+
If you use this application in your research or teaching, please cite:
|
| 194 |
+
|
| 195 |
+
```bibtex
|
| 196 |
+
@software{pso_pyqt5_visualizer,
|
| 197 |
+
title = {Particle Swarm Optimization PyQt5 Visualizer},
|
| 198 |
+
author = {Martin Rivera},
|
| 199 |
+
year = {2025},
|
| 200 |
+
url = {https://huggingface.co/TroglodyteDerivations/pso-pyqt5-visualizer}
|
| 201 |
+
}
|
| 202 |
+
```
|
| 203 |
+
|
| 204 |
+
## License
|
| 205 |
+
|
| 206 |
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
| 207 |
+
|
| 208 |
+
## Support
|
| 209 |
+
|
| 210 |
+
For issues and questions:
|
| 211 |
+
- Open an issue on Hugging Face
|
| 212 |
+
- Check the documentation
|
| 213 |
+
- Review example configurations
|
| 214 |
+
|
| 215 |
+
## Model Card Authors
|
| 216 |
+
|
| 217 |
+
[TroglodyteDerivations]
|
| 218 |
+
|
| 219 |
+
## Model Card Contact
|
| 220 |
+
|
| 221 |
+
[https://huggingface.co/TroglodyteDerivations/Particle_Swarm_Optimization_Visualizer_PyQt5/edit/main/README.md]
|
| 222 |
+
|
| 223 |
+
---
|
| 224 |
+
|
| 225 |
+
<div align="center">
|
| 226 |
+
|
| 227 |
+
**✨ Watch particles find optimal solutions in beautiful visualizations! ✨**
|
| 228 |
+
|
| 229 |
+
</div>
|
| 230 |
+
```
|
| 231 |
+
|
| 232 |
+
## Additional Files for Hugging Face
|
| 233 |
+
|
| 234 |
+
You should also create these files for your Hugging Face repository:
|
| 235 |
+
|
| 236 |
+
### `README.md` (same as above)
|
| 237 |
+
|
| 238 |
+
### `requirements.txt`
|
| 239 |
+
```txt
|
| 240 |
+
numpy>=1.21.0
|
| 241 |
+
matplotlib>=3.5.0
|
| 242 |
+
PyQt5>=5.15.0
|
| 243 |
+
```
|
| 244 |
+
|
| 245 |
+
### `app.py`
|
| 246 |
+
|
| 247 |
+
### `LICENSE`
|
| 248 |
+
```txt
|
| 249 |
+
MIT License
|
| 250 |
+
|
| 251 |
+
Copyright (c) 2025 [Martin Rivera]
|
| 252 |
+
|
| 253 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 254 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 255 |
+
in the Software without restriction, including without limitation the rights
|
| 256 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 257 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 258 |
+
furnished to do so, subject to the following conditions:
|
| 259 |
+
|
| 260 |
+
The above copyright notice and this permission notice shall be included in all
|
| 261 |
+
copies or substantial portions of the Software.
|
| 262 |
+
|
| 263 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 264 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 265 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 266 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 267 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 268 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 269 |
+
SOFTWARE.
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
### `.gitattributes`
|
| 273 |
+
```gitattributes
|
| 274 |
+
*.py filter=lfs diff=lfs merge=lfs -text
|
| 275 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 276 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 277 |
+
```
|
| 278 |
+
|
| 279 |
+
This model card provides comprehensive documentation for your PSO PyQt5 application and makes it ready for sharing on Hugging Face Hub!
|