=====
slapy
=====
1. install
from pypi:
pip install snowland-algorithm
or
from source code:
download code from https://gitee.com/hoops/snowland-algorithm-python, you can choose a release version
pip install -r requirements.txt
python setup.py install
#. dirs
1. graph
a. dijkstra(v0.0.1+)
#. spfa(v0.0.1+)
#. swarm
a. pso(v0.0.1+)
#. gso(v0.0.2+)
#. fa(v0.0.3+)
#. cso(v0.0.6+)
#. ba(v0.0.6+)
#. sfla(v0.0.6+)
#. bas(v0.0.6+)
#. sa(v0.0.6+)
#. fwa(v0.0.6+)
#. cs(v0.0.7+)
#. bfo(v0.0.7+)
#. quick use
1. import package
>>> from slapy.swarm.package_name import engine_name
2. define the fitness function
example:
>>> fun = lambda x: np.cos(x[0]) + np.sin(x[0]) - x[0] * x[1]
note: arg need to be 1 X n vector
3. run the model
>>> engine = engine_name(your_args)
>>> engine.run()
4. show result
>>> x, y = engine.gbest.chromosome
>>> print('max value', fun(engine.gbest.chromosome))
>>> print('x:', x, 'y:', y)
There is a example for PSO.
>>> def fun(vars):
>>> # fitness function
>>> x, y = vars
>>> if 1 <= x <= 2 * np.pi and 1 <= y <= np.pi:
>>> return np.cos(x) + np.sin(x) - x * y
>>> else:
>>> return -2 - 4 * np.pi ** 2 # return a small float number can not reach
>>> if __name__ == '__main__':
>>> engine = PSOEngine(vmax=0.01, bound=[[1, 2 * np.pi]], min_fitness_value=-1, dim=2, fitness_function=fun, steps=100)
>>> engine.run()
>>> x, y = engine.gbest.chromosome
>>> print('max value', fun(engine.gbest.chromosome))
>>> print('x:', x, 'y:', y)
slapy
=====
1. install
from pypi:
pip install snowland-algorithm
or
from source code:
download code from https://gitee.com/hoops/snowland-algorithm-python, you can choose a release version
pip install -r requirements.txt
python setup.py install
#. dirs
1. graph
a. dijkstra(v0.0.1+)
#. spfa(v0.0.1+)
#. swarm
a. pso(v0.0.1+)
#. gso(v0.0.2+)
#. fa(v0.0.3+)
#. cso(v0.0.6+)
#. ba(v0.0.6+)
#. sfla(v0.0.6+)
#. bas(v0.0.6+)
#. sa(v0.0.6+)
#. fwa(v0.0.6+)
#. cs(v0.0.7+)
#. bfo(v0.0.7+)
#. quick use
1. import package
>>> from slapy.swarm.package_name import engine_name
2. define the fitness function
example:
>>> fun = lambda x: np.cos(x[0]) + np.sin(x[0]) - x[0] * x[1]
note: arg need to be 1 X n vector
3. run the model
>>> engine = engine_name(your_args)
>>> engine.run()
4. show result
>>> x, y = engine.gbest.chromosome
>>> print('max value', fun(engine.gbest.chromosome))
>>> print('x:', x, 'y:', y)
There is a example for PSO.
>>> def fun(vars):
>>> # fitness function
>>> x, y = vars
>>> if 1 <= x <= 2 * np.pi and 1 <= y <= np.pi:
>>> return np.cos(x) + np.sin(x) - x * y
>>> else:
>>> return -2 - 4 * np.pi ** 2 # return a small float number can not reach
>>> if __name__ == '__main__':
>>> engine = PSOEngine(vmax=0.01, bound=[[1, 2 * np.pi]], min_fitness_value=-1, dim=2, fitness_function=fun, steps=100)
>>> engine.run()
>>> x, y = engine.gbest.chromosome
>>> print('max value', fun(engine.gbest.chromosome))
>>> print('x:', x, 'y:', y)
Metadata
Release files for snowland-algorithm 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| snowland_algorithm-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Release files / snowland_algorithm-0.0.7-py3-none-any.whl
| Download URL | snowland_algorithm-0.0.7-py3-none-any.whl |
|---|---|
| Size | 84.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e94ee27ab012c51489dcfc72627a4f4ace565810fd90cc142a8ec0ba95959bb2
|
|
BLAKE2b-256 checksum How to use checksums |
f9886cbccd18ae6b9c5b983bcf9440704c4d03d3a9186671fd7ebb75e004e03e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.6
|
Security for snowland-algorithm 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.