No project description provided
Project description
SLPso - Social Learning Particle Swarm Optimization
SLPso is a Python library that implements the Social Learning Particle Swarm Optimization (SL-PSO) algorithm for scalable optimization problems, as described in the following article:
About the Algorithm
A Social Learning Particle Swarm Optimization Algorithm for Scalable Optimization Authors: Ran Cheng and Yaochu Jin Journal: Information Sciences, Volume 291, Pages 43-60, Year 2015 DOI: 10.1016/j.ins.2014.08.039 URL to the Paper: Read the full paper
If you use the SLPso library in your research, please consider citing this library.
Reveal quote
SLPso - Social Learning Particle Swarm Optimization [Software]. (2023). Available at: https://github.com/vsg-root/slpso.
About SL-PSO
The Social Learning Particle Swarm Optimization is a population-based optimization algorithm inspired by the behavior of a swarm of particles. It leverages social interactions to enhance exploration of the search space and convergence to optimal solutions in scalable optimization problems.
- Restrigin Function
|
|
|
- Ackley Function
|
|
|
Installation
To get started with SLPso, you can install it via pip:
pip install slpso
Try your first SL-PSO program
>>> import numpy as np
>>> from slpso.slpso import SLPSO
>>> def custom_objective_function(positions: np.ndarray) -> np.ndarray:
"""
The custom objective function to be minimized.
Args:
positions (np.ndarray): An array of particle positions.
Returns:
np.ndarray: An array of fitness values.
"""
>>> return np.sum(positions ** 2, axis=1)
>>> # Create a custom random number generator
>>> rng = np.random.default_rng(seed=50) # Replace 40 with the desired seed
>>> lower_bound = -5.0 # Set the lower bound
>>> upper_bound = 5.0 # Set the upper bound
>>> slpso_optimizer = SLPSO(custom_objective_function,
rng=rng,
lower_bound=lower_bound,
upper_bound=upper_bound,
show_progress=False)
>>> global_best_position, global_best_value = slpso_optimizer.optimize()
>>> print("Global Best Position:", global_best_position)
>>> print("Global Best Value:", global_best_value)
Note: This library is not affiliated with or endorsed by the original researchers. It is an independent implementation of the SL-PSO algorithm for the convenience of users interested in applying it to their optimization problems. Please do not confuse this library with the work of the original authors.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file slpso-0.1.0.tar.gz.
File metadata
- Download URL: slpso-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.9 Linux/6.2.6-76060206-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93fe2393639e0642e2594f7877ec1679ab936771343aff7f7a54466b9fa0b044
|
|
| MD5 |
b38bee085ee08012952e8b3e2978f87b
|
|
| BLAKE2b-256 |
53bb0d97ef9263f0da95e121e253d583aa5dc7d8723a603dbd605699e6a289f9
|
File details
Details for the file slpso-0.1.0-py3-none-any.whl.
File metadata
- Download URL: slpso-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.9 Linux/6.2.6-76060206-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2ef3d82c43b2e6010ff348f61af0358e69357c86b9e9c191851b1a43e5ecb4b
|
|
| MD5 |
e0ebb79a1300df342f517732b7f7f3df
|
|
| BLAKE2b-256 |
c6b274a8e743e0237d9bcfe35bb7fe5ee60369d48868f97db9d8a26a7f16bc57
|