--- 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. ![Screenshot 2025-11-03 at 2.01.25 PM](https://cdn-uploads.huggingface.co/production/uploads/68401f649e3f451260c68974/rHMP2HOOh15LyGkVba9fs.png) ![Screenshot 2025-11-03 at 2.02.02 PM](https://cdn-uploads.huggingface.co/production/uploads/68401f649e3f451260c68974/Pxszkv7-fFKqGqfqp5ROG.png) ## 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 ![Screenshot 2025-11-03 at 2.02.38 PM](https://cdn-uploads.huggingface.co/production/uploads/68401f649e3f451260c68974/iX8438Y8ar-t4XDojBjcl.png) ![Screenshot 2025-11-03 at 2.03.29 PM](https://cdn-uploads.huggingface.co/production/uploads/68401f649e3f451260c68974/sk8V-Zup4ZHHWFe5dr55n.png) ### 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] ---
**✨ Watch particles find optimal solutions in beautiful visualizations! ✨**
``` ## 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!