File size: 8,258 Bytes
6072b24 f9fcc04 6072b24 f9fcc04 6072b24 |
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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
---
license: mit
---
Here's a comprehensive Hugging Face model card for your Particle Swarm Optimization PyQt5 application:
```markdown
---
language:
- en
tags:
- optimization
- particle-swarm
- pso
- mathematical-optimization
- benchmark-functions
- pyqt5
- gui
- visualization
- metaheuristics
- evolutionary-computation
library_name: pyqt5
pipeline_tag: visualization
---
# Particle Swarm Optimization Visualizer
## Model Overview
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.


## Features
### 🎯 20 Optimization Problems
- **10 2D Benchmark Functions**: Sphere, Rosenbrock, Rastrigin, Ackley, Matyas, Himmelblau, Three-Hump Camel, Easom, Cross-in-Tray, Holder Table
- **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
### 📊 Real-time Visualizations
- **2D Contour Plots**: Particle movement over function landscapes
- **3D Surface Plots**: Interactive 3D optimization landscapes
- **Live Particle Tracking**: Watch particles oscillate and converge
- **Progress Monitoring**: Real-time optimization progress
### ⚙️ Customizable PSO Parameters
- Particle count (10-100)
- Iterations (10-500)
- Inertia weight (0.1-1.0)
- Cognitive parameter (0.1-2.0)
- Social parameter (0.1-2.0)
## Quick Start
### Installation
```bash
# Clone repository
git clone https://huggingface.co/TroglodyteDerivations/pso-pyqt5-visualizer
cd pso-pyqt5-visualizer
# Install dependencies
pip install -r requirements.txt
# Run the application
python app.py
```
### Requirements
```txt
numpy>=1.21.0
matplotlib>=3.5.0
PyQt5>=5.15.0
```
## Usage
1. **Select Equation**: Choose from 20 benchmark functions
2. **Configure Parameters**: Adjust PSO parameters as needed
3. **Run Optimization**: Click "Run PSO" to start
4. **Visualize**: Watch real-time particle movement
5. **Analyze**: Review optimization results
## Application Interface


### Control Panel
- Equation selection with detailed descriptions
- PSO parameter configuration
- Interactive controls (Run, Pause, Step, Reset)
- Real-time progress tracking
- Results display
### Visualization Panel
- **Top**: 2D contour plots with particle trajectories
- **Bottom**: 3D surface plots showing optimization landscape
- Real-time updates during optimization
## Benchmark Functions
### 2D Functions
| Function | Description | Global Minimum |
|----------|-------------|----------------|
| Sphere | f(x,y) = x² + y² | (0,0) |
| Rosenbrock | f(x,y) = 100(y-x²)² + (1-x)² | (1,1) |
| Rastrigin | Multi-modal function | (0,0) |
| Ackley | Many local minima | (0,0) |
| Himmelblau | Four equal minima | Multiple |
### 3D Functions
| Function | Dimensions | Complexity |
|----------|------------|------------|
| Sphere 3D | 3 | Unimodal |
| Rastrigin 3D | 3 | Multi-modal |
| Michalewicz | 3 | Many local minima |
| Levy 3D | 3 | Complex landscape |
## PSO Algorithm
### Mathematical Formulation
Particle velocity and position updates:
```
v_i(t+1) = w * v_i(t) + c1 * r1 * (pbest_i - x_i(t)) + c2 * r2 * (gbest - x_i(t))
x_i(t+1) = x_i(t) + v_i(t+1)
```
Where:
- `w`: Inertia weight
- `c1`, `c2`: Cognitive and social parameters
- `r1`, `r2`: Random numbers
- `pbest_i`: Particle's best position
- `gbest`: Global best position
### Key Features
- **Boundary Handling**: Particles bounce off boundaries
- **Velocity Clamping**: Prevents explosion
- **History Tracking**: Complete optimization history
- **Convergence Monitoring**: Real-time best value tracking
## Educational Value
This application serves as an excellent educational tool for:
- Understanding PSO algorithm behavior
- Visualizing optimization landscapes
- Comparing benchmark function characteristics
- Studying metaheuristic optimization
- Learning about multi-modal optimization
## Performance
### Optimization Capabilities
- **Convergence**: Rapid convergence on unimodal functions
- **Exploration**: Effective global search on multi-modal functions
- **Stability**: Robust performance across different landscapes
- **Scalability**: Handles 2D and 3D problems efficiently
### Visualization Performance
- **Smooth Animation**: 30+ FPS particle movement
- **Interactive Plots**: Zoom, pan, and rotate 3D views
- **Real-time Updates**: Instant parameter feedback
- **Memory Efficient**: Optimized for long runs
## Use Cases
### 🎓 Education
- Optimization algorithm courses
- Metaheuristic visualization
- Mathematical modeling classes
### 🔬 Research
- Algorithm benchmarking
- Parameter sensitivity analysis
- Optimization landscape study
### 💼 Industry
- Engineering optimization problems
- Machine learning hyperparameter tuning
- Financial modeling optimization
## Contributing
We welcome contributions! Areas for improvement:
- Additional benchmark functions
- Advanced PSO variants
- Export functionality
- Performance optimizations
- Additional visualization types
## Citation
If you use this application in your research or teaching, please cite:
```bibtex
@software{pso_pyqt5_visualizer,
title = {Particle Swarm Optimization PyQt5 Visualizer},
author = {Martin Rivera},
year = {2025},
url = {https://huggingface.co/TroglodyteDerivations/pso-pyqt5-visualizer}
}
```
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Support
For issues and questions:
- Open an issue on Hugging Face
- Check the documentation
- Review example configurations
## Model Card Authors
[TroglodyteDerivations]
## Model Card Contact
[https://huggingface.co/TroglodyteDerivations/Particle_Swarm_Optimization_Visualizer_PyQt5/edit/main/README.md]
---
<div align="center">
**✨ Watch particles find optimal solutions in beautiful visualizations! ✨**
</div>
```
## Additional Files for Hugging Face
You should also create these files for your Hugging Face repository:
### `README.md` (same as above)
### `requirements.txt`
```txt
numpy>=1.21.0
matplotlib>=3.5.0
PyQt5>=5.15.0
```
### `app.py`
### `LICENSE`
```txt
MIT License
Copyright (c) 2025 [Martin Rivera]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
### `.gitattributes`
```gitattributes
*.py filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
```
This model card provides comprehensive documentation for your PSO PyQt5 application and makes it ready for sharing on Hugging Face Hub! |