-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Index Error #42
Comments
Also tried it in Google Colab IndexError Traceback (most recent call last) 19 frames /usr/local/lib/python3.7/dist-packages/swarmlib/util/base_visualizer.py in replay(self, **kwargs) /usr/local/lib/python3.7/dist-packages/matplotlib/animation.py in init(self, fig, func, frames, init_func, fargs, save_count, cache_frame_data, **kwargs) /usr/local/lib/python3.7/dist-packages/matplotlib/animation.py in init(self, fig, interval, repeat_delay, repeat, event_source, *args, **kwargs) /usr/local/lib/python3.7/dist-packages/matplotlib/animation.py in init(self, fig, event_source, blit) /usr/local/lib/python3.7/dist-packages/matplotlib/animation.py in _setup_blit(self) /usr/local/lib/python3.7/dist-packages/matplotlib/animation.py in _post_draw(self, framedata, blit) /usr/local/lib/python3.7/dist-packages/matplotlib/backend_bases.py in draw_idle(self, *args, **kwargs) /usr/local/lib/python3.7/dist-packages/matplotlib/backends/backend_agg.py in draw(self) /usr/local/lib/python3.7/dist-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs) /usr/local/lib/python3.7/dist-packages/matplotlib/artist.py in draw_wrapper(artist, renderer) /usr/local/lib/python3.7/dist-packages/matplotlib/figure.py in draw(self, renderer) /usr/local/lib/python3.7/dist-packages/matplotlib/backend_bases.py in draw_event(self, renderer) /usr/local/lib/python3.7/dist-packages/matplotlib/cbook/init.py in process(self, s, *args, **kwargs) /usr/local/lib/python3.7/dist-packages/matplotlib/cbook/init.py in _exception_printer(exc) /usr/local/lib/python3.7/dist-packages/matplotlib/cbook/init.py in process(self, s, *args, **kwargs) /usr/local/lib/python3.7/dist-packages/matplotlib/animation.py in _start(self, *args) /usr/local/lib/python3.7/dist-packages/matplotlib/animation.py in _init_draw(self) /usr/local/lib/python3.7/dist-packages/swarmlib/util/base_visualizer.py in _init(self) /usr/local/lib/python3.7/dist-packages/matplotlib/collections.py in set_offsets(self, offsets) IndexError: index 0 is out of bounds for axis 1 with size 0 |
Also in Shell: swarm fireflies 14 |
Fixed the issue with downgrading matplotlib (3.5.2 -> 3.5.0) Now it works. |
| Python Version | swarmlib Version | OS |
| 3.8.13 | 0.14.1 | Windows 10 |
Description
Try to run the Firefly Algorithm and the test code
problem = FireflyProblem(function=FUNCTIONS['michalewicz'], firefly_number=20)
best_firefly = problem.solve()
problem.replay()
problem.replay() doesn't work:
IndexError Traceback (most recent call last)
--> problem.replay()
---> 25 self._visualizer.replay()
File ...\Miniconda3\envs\optimization\lib\site-packages\swarmlib\util\base_visualizer.py:85, in BaseVisualizer.replay(self, **kwargs)
82 frames = int(self.__intervals*self.__interval_ms/self.__frame_interval)
84 # iteration_number+1 for initialization frame
---> 85 _ = animation.FuncAnimation(self._fig, self._animate, frames=frames, interval=self.__frame_interval,
86 blit=True, init_func=self._init, repeat=self.__continuous, fargs=[frames])
88 plt.show()
File. ..\Miniconda3\envs\optimization\lib\site-packages\matplotlib\animation.py:1634, in FuncAnimation.init(self, fig, func, frames, init_func, fargs, save_count, cache_frame_data, **kwargs)
1631 # Needs to be initialized so the draw functions work without checking
1632 self._save_seq = []
-> 1634 super().init(fig, **kwargs)
...
--> 564 (np.asarray(self.convert_xunits(offsets[:, 0]), 'float'),
565 np.asarray(self.convert_yunits(offsets[:, 1]), 'float')))
566 self.stale = True
IndexError: index 0 is out of bounds for axis 1 with size 0
The text was updated successfully, but these errors were encountered: