Release v.0.1.5
Release notes
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()