Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare v.0.3.0 release #180

Merged
merged 45 commits into from
Aug 9, 2018
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3e36021
Modify if-else statements in generators
Jun 11, 2018
4e4b474
Merge pull request #128 from ljvmiranda921/better-lookup
Jun 11, 2018
767f5e5
Add DeprecationWarning to PlotEnvironment module
Jun 12, 2018
7caded4
Remove @property in history
Jun 12, 2018
5343a1c
Update test on optimizers
Jun 12, 2018
b128fa2
Mark environment tests as expected failures
Jun 12, 2018
78aaa12
Add plotters.py module
Jun 12, 2018
b8c86c2
Add formatters module
Jun 13, 2018
435db1c
Add tests for plotters module
Jun 12, 2018
054570e
Fix bad behavior in discrete swarm generation
Jun 13, 2018
a56c50e
Add plotters to docs index (#130)
Jun 13, 2018
d007009
Update docstrings in plotters.py (#130)
Jun 14, 2018
9a4aa45
Add demo and documentation for plotters
Jun 14, 2018
e533ad6
Merge branch 'feature-add-plotters'
Jun 14, 2018
8249ce2
[ci skip] Update README
Jun 14, 2018
adcf626
Merge pull request #135 from ljvmiranda921/feature-plotters-module
Jun 14, 2018
853772f
Merge branch 'master' into development
Jun 16, 2018
a863fb8
Format code using black (#139)
Jun 16, 2018
fbe052d
Add pre-commit hook configurations (#139)
Jun 16, 2018
297a403
Mention black in README and CONTRIBUTING (#139)
Jun 18, 2018
f59e73c
Merge pull request #137 from ljvmiranda921/format-code
Jun 18, 2018
2dd5966
Add PULL_REQUEST_TEMPLATE.md
Jun 18, 2018
b643bfd
Create Inverse Kinematics tutorial (#141)
whzup Jun 25, 2018
6bd896d
Add pyramid topology (#142)
whzup Jun 26, 2018
89f12cb
Add feature to pass args to objective function (#144)
bradahoward Jun 28, 2018
6051bfa
Create GeneralOptimizer class
whzup Jun 30, 2018
38546d6
Fix index error in the Pyramid class
whzup Jul 2, 2018
3d5e346
Merge pull request #151 from whzup/gen_opt
ljvmiranda921 Jul 5, 2018
cca8d3c
Add Random topology class (#155)
whzup Jul 14, 2018
c95661b
Add static/dynamic functionality for topologies (#164)
whzup Jul 17, 2018
b90c973
Add test for the neighbor_idx attribute of topologies (#171)
whzup Jul 18, 2018
966516b
Add plotter functionalities (#172)
jayspeidell Jul 18, 2018
4d0e69a
Add objective functions (#168)
jayspeidell Jul 18, 2018
a44443d
Fix bug in setup.py (#175)
whzup Jul 19, 2018
d8c39ef
Fix bug in topology classes (#176)
whzup Jul 23, 2018
6306812
Add Von Neumann topology (#177)
whzup Jul 23, 2018
c8541e3
Update docstrings and examples (#157)
whzup Jul 25, 2018
19cd9d9
Merge branch 'master' into development
ljvmiranda921 Jul 29, 2018
3a4c8c0
Update authors list (#181)
ljvmiranda921 Jul 29, 2018
7428b94
Clean up changes for v.0.3.0 (#189)
whzup Jul 30, 2018
63ef1ab
Update dependencies in requirements_dev.txt (#188)
ljvmiranda921 Jul 30, 2018
f7ce89d
Bump version to v.0.3.0 (#191)
ljvmiranda921 Jul 31, 2018
c29e260
Update image sources in README (#192)
ljvmiranda921 Jul 31, 2018
63abfb0
Update documentation for v.0.3.0 (#196)
whzup Aug 4, 2018
b96a08d
Update features.rst and HISTORY.rst (#199)
whzup Aug 8, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
ignore = E203, E266, E501, W503, F403, F401
max-line-length = 79
max-complexity = 18
select = B,C,E,F,W,T4,B9
37 changes: 37 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->

## Related Issue
<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Screenshots (if appropriate):

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the **CONTRIBUTING** document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.

10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3.6
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
hooks:
- id: flake8
12 changes: 9 additions & 3 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@ The package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypacka
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage

Development Lead
----------------
Maintainers
-----------

* Lester James V. Miranda (`@ljvmiranda921`_)
* Aaron Moser (`@whzup`_)
* Siobhán K. Cronin (`@SioKCronin`_)

Contributors
------------

* Carl-K (`@Carl-K`_)
* Siobhán K Cronin (`@SioKCronin`_)
* Andrew Jarcho (`@jazcap53`_)
* Charalampos Papadimitriou (`@CPapadim`_)
* Mamady Nabé (`@mamadyonline`_)
* Erik (`@slek120`_)
* Jay Speidell (`@jayspeidell`_)
* Bradahoward (`@bradahoward`_)
* Thomas (`@ThomasCES`_)

.. _`@ljvmiranda921`: https://github.com/ljvmiranda921
Expand All @@ -32,4 +35,7 @@ Contributors
.. _`@CPapadim`: https://github.com/CPapadim
.. _`@mamadyonline`: https://github.com/mamadyonline
.. _`@slek120`: https://github.com/slek120
.. _`@whzup`: https://github.com/whzup
.. _`@jayspeidell`: https://github.com/jayspeidell
.. _`@bradahoward`: https://github.com/bradahoward
.. _`@ThomasCES`: https://github.com/ThomasCES
6 changes: 4 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ Ready to contribute? Here's how to set up `pyswarms` for local development.

Now you can make your changes locally.

5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::
5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox. In addition, ensure that your code is formatted using black::

$ flake8 pyswarms tests
$ black pyswarms tests
$ python setup.py test or py.test
$ tox

To get flake8 and tox, just pip install them into your virtualenv.
To get flake8, black, and tox, just pip install them into your virtualenv. If you wish,
you can add pre-commit hooks for both flake8 and black to make all formatting easier.

6. Commit your changes and push your branch to GitHub::

Expand Down
53 changes: 41 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[![Documentation Status](https://readthedocs.org/projects/pyswarms/badge/?version=master)](https://pyswarms.readthedocs.io/en/master/?badge=development)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg )](https://raw.githubusercontent.com/ljvmiranda921/pyswarms/master/LICENSE)
[![DOI](http://joss.theoj.org/papers/10.21105/joss.00433/status.svg)](https://doi.org/10.21105/joss.00433)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
[![Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pyswarms/Issues)

PySwarms is an extensible research toolkit for particle swarm optimization
Expand Down Expand Up @@ -186,39 +187,67 @@ fresh run to plot the cost and create animation.
```python
import pyswarms as ps
from pyswarms.utils.functions import single_obj as fx
from pyswarms.utils.environments import PlotEnvironment
from pyswarms.utils.plotters import plot_cost_history
# Set-up optimizer
options = {'c1':0.5, 'c2':0.3, 'w':0.9}
optimizer = ps.single.GlobalBestPSO(n_particles=10, dimensions=3, options=options)
# Initialize plot environment
plt_env = PlotEnvironment(optimizer, fx.sphere_func, 1000)
optimizer = ps.single.GlobalBestPSO(n_particles=50, dimensions=2, options=options)
optimizer.optimize(fx.sphere_func, iters=100)
# Plot the cost
plt_env.plot_cost(figsize=(8,6));
plot_cost_history(optimizer.cost_history)
plt.show()
```

<img src="./docs/examples/output_9_0.png" width="460">
<img src="./docs/examples/output_8_0.png" width="460">

We can also plot the animation,
We can also plot the animation...

```python
plt_env.plot_particles2D(limits=((-1.2,1.2),(-1.2,1.2))
from pyswarms.utils.plotters.formatters import Mesher
from pyswarms.utils.plotters.formatters import Designer
# Plot the sphere function's mesh for better plots
m = Mesher(func=fx.sphere_func)
# Adjust figure limits
d = Designer(limits=[(-1,1), (-1,1), (-0.1,1)],
label=['x-axis', 'y-axis', 'z-axis'])
```

<img src="./docs/examples/output_3d.gif" width="460">
In 2D,

```python
plot_contour(pos_history=optimizer.pos_history, mesher=m, mark=(0,0))
```

![Contour](https://i.imgur.com/H3YofJ6.gif)

Or in 3D!

```python
pos_history_3d = m.compute_history_3d(optimizer.pos_history) # preprocessing
animation3d = plot_surface(pos_history=pos_history_3d,
mesher=m, designer=d,
mark=(0,0,0))
```

![Surface](https://i.imgur.com/kRb61Hx.gif)

## Contributing

PySwarms is currently maintained by a single person (me!) with the aid of a
few but very helpful contributors. We would appreciate it if you can lend a
hand with the following:
PySwarms is currently maintained by a small yet dedicated team:
- Lester James V. Miranda ([@ljvmiranda921](https://github.com/ljvmiranda921))
- Siobhán K. Cronin ([@SioKCronin](https://github.com/SioKCronin))
- Aaron Moser ([@whzup](https://github.com/whzup))

And we would appreciate it if you can lend a hand with the following:

* Find bugs and fix them
* Update documentation in docstrings
* Implement new optimizers to our collection
* Make utility functions more robust.

We would also like to acknowledge [all our
contributors](http://pyswarms.readthedocs.io/en/latest/authors.html), past and
present, for making this project successful!

If you wish to contribute, check out our [contributing guide].
Moreover, you can also see the list of features that need some help in our
[Issues] page.
Expand Down
9 changes: 5 additions & 4 deletions docs/api/_pyswarms.utils.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
Utilities
=========

This includes various utilities to help in optimization. In the future,
parameter search and plotting techniques will be incoroporated in this
module.
This includes various utilities to help in optimization. Some utilities
include benchmark objective functions, hyperparameter search, and plotting
functionalities.

.. toctree::

pyswarms.utils.functions
pyswarms.utils.search
pyswarms.utils.environments
pyswarms.utils.plotters
pyswarms.utils.environments
12 changes: 11 additions & 1 deletion docs/api/pyswarms.single.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,14 @@ pyswarms.single.local_best module
:undoc-members:
:show-inheritance:
:private-members:
:special-members: __init__
:special-members: __init__

pyswarms.single.general_optimizer module
---------------------------------

.. automodule:: pyswarms.single.general_optimizer
:members:
:undoc-members:
:show-inheritance:
:private-members:
:special-members: __init__
29 changes: 28 additions & 1 deletion docs/api/pyswarms.topology.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,31 @@ pyswarms.backend.topology.ring module
:members:
:undoc-members:
:show-inheritance:
:special-members: __init__
:special-members: __init__

pyswarms.backend.topology.von_neumann module
--------------------------------------

.. automodule:: pyswarms.backend.topology.von_neumann
:members:
:undoc-members:
:show-inheritance:
:special-members: __init__

pyswarms.backend.topology.pyramid module
--------------------------------------

.. automodule:: pyswarms.backend.topology.pyramid
:members:
:undoc-members:
:show-inheritance:
:special-members: __init__

pyswarms.backend.topology.random module
--------------------------------------

.. automodule:: pyswarms.backend.topology.random
:members:
:undoc-members:
:show-inheritance:
:special-members: __init__
4 changes: 4 additions & 0 deletions docs/api/pyswarms.utils.environments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ pyswarms.utils.environments package

.. automodule:: pyswarms.utils.environments

.. deprecated:: 0.2.1
This module will be deprecated in the next release. Please use
:mod:`pyswarms.utils.plotters` instead.

pyswarms.utils.environments.plot_environment module
----------------------------------------------------

Expand Down
20 changes: 20 additions & 0 deletions docs/api/pyswarms.utils.plotters.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pyswarms.utils.plotters package
================================

.. automodule:: pyswarms.utils.plotters

pyswarms.utils.plotters.plotters module
----------------------------------------

.. automodule:: pyswarms.utils.plotters.plotters
:members:
:undoc-members:
:show-inheritance:

pyswarms.utils.plotters.formatters module
------------------------------------------

.. automodule:: pyswarms.utils.plotters.formatters
:members:
:undoc-members:
:show-inheritance:
2 changes: 2 additions & 0 deletions docs/assets/inheritance.aux
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
\relax
\gdef \sa@multi@numpages {0}