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

Add BoundaryHandler and VelocityHandler #238

Merged
merged 79 commits into from
Feb 9, 2019
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
6f8844f
Update base classes to inherit from ABC (#218)
ljvmiranda921 Aug 14, 2018
ad86b71
Remove environments module (#217)
ljvmiranda921 Aug 14, 2018
2472ed2
Remove `_func` in single_obj function names (#222)
jarcelao Aug 14, 2018
eb05142
Merge branch 'master' into development
ljvmiranda921 Aug 14, 2018
85952da
Merge branch 'master' into development
ljvmiranda921 Aug 15, 2018
f9dc37c
Add fmt comments for black (#229)
whzup Aug 17, 2018
0ad254d
Add reporter module (#227)
ljvmiranda921 Aug 19, 2018
0f7d9d1
Add cost function decorator (#226)
whzup Aug 20, 2018
5961ea4
Fix plotters documentation (#236)
ljvmiranda921 Aug 31, 2018
0166cb4
[WIP] Create BoundHandler class
whzup Aug 31, 2018
91422ed
[WIP] Add documentation and implement Random
whzup Aug 31, 2018
1b3eca0
[WIP] Add RST files for the handlers module
whzup Sep 2, 2018
d9e0427
[WIP] Change BoundaryHandler inheritance
ljvmiranda921 Sep 8, 2018
6e37366
[WIP] Use dict instead of if-else for strats
ljvmiranda921 Sep 8, 2018
1f24922
[ci skip] [WIP] Update random and nearest
ljvmiranda921 Sep 8, 2018
89d1818
[WIP] Fix import problem in Reporter
ljvmiranda921 Sep 8, 2018
ab6aadb
[WIP] Automatically generate strategies dict
ljvmiranda921 Sep 8, 2018
f328def
[WIP] Minor updates in docstring
ljvmiranda921 Sep 8, 2018
9c9eb5d
Merge branch 'bound-handling' of github.com:whzup/pyswarms into bound…
whzup Sep 8, 2018
aa94d77
[WIP] Add __init__.py import
whzup Sep 8, 2018
73eefe6
[WIP] Add test file for the handlers
whzup Sep 8, 2018
f6e0b40
[WIP] Add fixture for BoundaryHandler
whzup Sep 8, 2018
40c17a3
[WIP] Add more fixtures for the Handler tests
whzup Sep 8, 2018
def011c
[WIP] Fix Random strategy
whzup Sep 9, 2018
b4f94cb
[WIP] Changes and Implementation of "resample"
whzup Sep 11, 2018
ea694e7
[WIP] Fix py34 incompatibility (#1)
ljvmiranda921 Sep 12, 2018
cf6bc98
[WIP] Implement "shrink" strategy and more
whzup Sep 12, 2018
80905d2
[WIP] Fix format error and run black
whzup Sep 12, 2018
516ee9e
[WIP] Implement "intermediate" and "periodic"
whzup Sep 12, 2018
b9164aa
[WIP] black formatting
whzup Sep 12, 2018
6c6108b
Add functions in the docstrings
whzup Sep 12, 2018
563ac89
[WIP] Add tests and fix errors
whzup Sep 13, 2018
0e2be5c
[WIP] Fix errors and format using black
whzup Sep 13, 2018
0ca39bd
[WIP] Integrate BoundaryHandler in the operators
whzup Sep 13, 2018
db1d922
Merge branch 'master' into development
ljvmiranda921 Sep 14, 2018
bf0d11c
Fix missing init_pos parameter in create_swarm (#249)
dfhljf Sep 14, 2018
1796362
Merge remote-tracking branch 'upstream/development' into bound-handling
whzup Sep 14, 2018
8d92ce5
[WIP] Add velocity handling strategies
whzup Sep 27, 2018
9745295
[WIP] Add Mixin and extend VelocityHandler
whzup Sep 30, 2018
b4c7e7a
[WIP] black and correction of documentation
whzup Sep 30, 2018
277d9c0
Refactor GeneralOptimizer if-else hierarchy (#232)
ljvmiranda921 Sep 10, 2018
ad80287
Refactor test abstractions (#240) (#241)
ljvmiranda921 Sep 12, 2018
0b36637
Add pytest-cov config file
ljvmiranda921 Sep 13, 2018
569c8a7
Add isort configuration
ljvmiranda921 Sep 29, 2018
a359feb
Fix merge conflict in .coveragerc
ljvmiranda921 Oct 3, 2018
e5d7d93
Add init_pos in Optimizer docstrings
ljvmiranda921 Oct 3, 2018
32cb893
Update test on decorators
ljvmiranda921 Oct 3, 2018
c289bdd
Fix docstring in Star topology
ljvmiranda921 Oct 4, 2018
d3ead5b
[WIP] Add zero strategy
whzup Oct 6, 2018
c289db1
[WIP] Add __apply_clamp helper method and clean up
whzup Oct 6, 2018
5b7121e
[WIP] Add test for out of bounds function
whzup Oct 6, 2018
efbc701
[WIP] Add assert_bounds and VH test structure
whzup Oct 19, 2018
2deb13f
[WIP] Work on tests
whzup Oct 19, 2018
f7e376a
Merge branch 'development' into refactor/general
ljvmiranda921 Oct 20, 2018
c29282e
[WIP] Expand VH tests and fix errors
whzup Oct 20, 2018
5a29fe7
[WIP] Remove .log from the reporter logging in VH
whzup Oct 20, 2018
0be0ba1
[WIP] Fix logging error
whzup Oct 20, 2018
7e4d04c
Merge pull request #246 from ljvmiranda921/refactor/general
ljvmiranda921 Oct 20, 2018
9eef072
Merge remote-tracking branch 'upstream/development' into bound-handling
whzup Oct 21, 2018
0ae5d78
[WIP] Fix integration into the operators
whzup Oct 21, 2018
8ee47b5
[WIP] Change default strategy to intermediate
whzup Oct 21, 2018
13f375f
[WIP] Fix some errors in the BH
whzup Oct 23, 2018
84ab37f
[WIP] Work on integration and on tests
whzup Oct 26, 2018
e04cf15
[WIP] Fix all the Boundary handling strategies
whzup Dec 14, 2018
b7885d4
[WIP] Introduce the handlers into the optimizers
whzup Dec 15, 2018
fd7ec98
[WIP] Improve documentation
whzup Dec 16, 2018
8669e6d
[WIP] Reformat changed files
whzup Dec 16, 2018
40becad
[WIP] Implement reflective strategy
whzup Dec 16, 2018
aed0dca
Fix bug in topologies (#253)
whzup Jan 28, 2019
2f56cf5
Add new targets for Makefile
ljvmiranda921 Jan 28, 2019
ff4558e
Use venv instead of env
ljvmiranda921 Jan 28, 2019
48b8042
Use pip-tools for creating dependencies
ljvmiranda921 Jan 28, 2019
20e88a9
Update setup.py to read directly from requirements
ljvmiranda921 Jan 28, 2019
c5a5157
Add requirements files to MANIFEST.in
ljvmiranda921 Jan 28, 2019
77e3fcd
Remove py34 support
ljvmiranda921 Jan 29, 2019
2bafd39
Update HISTORY.rst
ljvmiranda921 Jan 29, 2019
5fa4fa7
Merge branch 'development' into bound-handling
whzup Jan 30, 2019
a1127ed
Fix and update documentation for handlers
whzup Feb 7, 2019
fa4a2eb
Merge branch 'master' into bound-handling
ljvmiranda921 Feb 9, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ import pyswarms as ps

Suppose we want to find the minima of `f(x) = x^2` using global best
PSO, simply import the built-in sphere function,
`pyswarms.utils.functions.sphere_func()`, and the necessary optimizer:
`pyswarms.utils.functions.sphere()`, and the necessary optimizer:

```python
import pyswarms as ps
Expand All @@ -111,7 +111,7 @@ options = {'c1': 0.5, 'c2': 0.3, 'w':0.9}
# Call instance of PSO
optimizer = ps.single.GlobalBestPSO(n_particles=10, dimensions=2, options=options)
# Perform optimization
best_cost, best_pos = optimizer.optimize(fx.sphere_func, iters=100, verbose=3, print_step=25)
best_cost, best_pos = optimizer.optimize(fx.sphere, iters=100, verbose=3, print_step=25)
```
```s
>>> 2017-10-03 10:12:33,859 - pyswarms.single.global_best - INFO - Iteration 1/100, cost: 0.131244226714
Expand Down Expand Up @@ -170,7 +170,7 @@ options = {
# n_selection_iters is the number of iterations to run the searcher
# iters is the number of iterations to run the optimizer
g = RandomSearch(ps.single.LocalBestPSO, n_particles=40,
dimensions=20, options=options, objective_func=fx.sphere_func,
dimensions=20, options=options, objective_func=fx.sphere,
iters=10, n_selection_iters=100)

best_score, best_options = g.search()
Expand Down Expand Up @@ -202,7 +202,7 @@ 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=50, dimensions=2, options=options)
optimizer.optimize(fx.sphere_func, iters=100)
optimizer.optimize(fx.sphere, iters=100)
# Plot the cost
plot_cost_history(optimizer.cost_history)
plt.show()
Expand All @@ -216,7 +216,8 @@ We can also plot the animation...
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)
m = Mesher(func=fx.sphere_func,
limits=[(-1,1), (-1,1)])
# Adjust figure limits
d = Designer(limits=[(-1,1), (-1,1), (-0.1,1)],
label=['x-axis', 'y-axis', 'z-axis'])
Expand All @@ -225,7 +226,7 @@ d = Designer(limits=[(-1,1), (-1,1), (-0.1,1)],
In 2D,

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

![Contour](https://i.imgur.com/H3YofJ6.gif)
Expand Down
6 changes: 4 additions & 2 deletions docs/api/_pyswarms.utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ functionalities.

.. toctree::

pyswarms.utils.decorators
pyswarms.utils.functions
pyswarms.utils.search
pyswarms.utils.plotters
pyswarms.utils.environments
pyswarms.utils.reporter
pyswarms.utils.search

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

.. automodule:: pyswarms.utils.decorators
:members:
:undoc-members:
:show-inheritance:
17 changes: 0 additions & 17 deletions docs/api/pyswarms.utils.environments.rst

This file was deleted.

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

.. automodule:: pyswarms.utils.reporter.reporter
:members:
:undoc-members:
:show-inheritance:
:private-members:
:special-members: __init__

Loading