Skip to content

Release v.0.1.5

Compare
Choose a tag to compare
@ljvmiranda921 ljvmiranda921 released this 11 Aug 07:12
· 381 commits to master since this release

Release notes

  • NEW: Easy graphics environment - #30, #31

Graphics Environment

This new plotting environment makes it easier to plot the costs and swarm movement in 2-d or 3-d planes. The PlotEnvironment class takes in the optimizer and its parameters as arguments. It then performs a fresh run to plot the cost and to create animations.

An example of usage can be seen below:

import pyswarms as ps
from pyswarms.utils.functions import single_obj as fx
from pyswarms.utils.environments import PlotEnvironment

# 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)

# Plot the cost
plt_env.plot_cost(figsize=(8,6));
plt.show()