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

Having Issue in optimizer #512

Open
Shrey261 opened this issue Mar 27, 2023 · 1 comment
Open

Having Issue in optimizer #512

Shrey261 opened this issue Mar 27, 2023 · 1 comment

Comments

@Shrey261
Copy link

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • OS: [e.g. Linux]
  • Version [e.g. Ubuntu 16.04]
  • PySwarms Version [e.g. v.0.2.0]
  • Python Version [e.g. 3.6.X]

Additional context
Add any other context about the problem here.
File "c:\Users\Shrey Chauhan\Documents\Project\Optimization of PLS using PSO.py", line 27, in
optimizer = ps.single.GlobalBestPSO(n_particles=n_particles, dimensions=dimensions, options=options, bounds=bounds)
File "C:\Users\Shrey Chauhan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyswarms\single\global_best.py", line 124, in init
super(GlobalBestPSO, self).init(
File "C:\Users\Shrey Chauhan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyswarms\base\base_single.py", line 110, in init
self.reset()
File "C:\Users\Shrey Chauhan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyswarms\base\base_single.py", line 190, in reset
self.swarm = create_swarm(
File "C:\Users\Shrey Chauhan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyswarms\backend\generators.py", line 236, in create_swarm
position = generate_swarm(
File "C:\Users\Shrey Chauhan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyswarms\backend\generators.py", line 76, in generate_swarm
np.array(lb)[np.newaxis, :], n_particles, axis=0
IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed
How Can I resolve this error?
Can you please help me with this.

@scimax
Copy link

scimax commented Mar 29, 2023

Hi Shreay261,

I'm not an expert on the PSO module, but at least just from looking at your issue I would say your issue cannot be addressed without any minimum working example which results in this traceback. Without any code there is no chance to say whether the input parameters are wrong or there is a bug in the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants