Skip to content

Bounds cause Overflow Error in generate_swarm() if too far apart #535

@assunc

Description

@assunc

Describe the bug
If max_bounds - min_bounds > abs(sys.float_info.max), the function np.random.uniform(low=min_bounds, high=max_bounds, size=(n_particles, dimensions)) in line 81 of generators.py throws an OverflowError: Range exceeds valid bounds

Expected behavior
The generate_swarm() function should handle all bounds ranges

Environment (please complete the following information):

  • OS: Windows 11
  • PySwarms Version 1.3.0
  • Python Version 3.11

Additional context
Its really a problem with the np.random.uniform function from numpy but there are ways around it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions