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

MBH invalid search space bounds [BUG] #163

Open
alopezrivera opened this issue May 6, 2024 · 1 comment
Open

MBH invalid search space bounds [BUG] #163

alopezrivera opened this issue May 6, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@alopezrivera
Copy link

alopezrivera commented May 6, 2024

Describe the bug
I am running into an invalid search space bound error (Cannot generate a random real if the lower bound is larger than the upper bound, raised by the uniform_real_from_range_checks function declared in pagmo/utils/generic.hpp) when using the Monotonic Basin Hopping meta-algorithm, wrapping the NLOPT NEWUOA algorithm.

The bug happens after many successful iterations (196847 objective function evaluations as per the get_log method of the pg.mbh object), and I can consistently replicate it in my machine.

To Reproduce
Single-objective optimization using:

  1. Archipelago with
    • 64 islands
    • 10000 individuals in each island
    • Unconnected topology (pygmo.unconnected) - the error replicates as well when using other topologies such as pg.fully_connected
    • Evolution for 1 evolutionary period (archi.evolve(n=1))
  2. Problem search space is n-dimensional unit hypercube. Input is bounded to the unit hypercube by implementing the get_bounds method (see code block below) of the UDP
  3. MBH wrapping NLOPT NEWUOA algorithm

get_bounds implemented in my UDP:

    def get_bounds(self) -> list[list[float]]:
        """Search space bounds"""
        return ([0]*self.problem_dimension, [1]*self.problem_dimension)

Expected behavior
Optimization completes without raising errors.

Error log
The following error is raised after 196847 objective function evaluations:

Traceback (most recent call last):
File "<string>", line 1, in <module>
RuntimeError: The asynchronous evolution of a pythonic island of type 'Multiprocessing island' raised an error:
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
File "c:\Users\antonio.lopez\AppData\Local\miniconda3\envs\combinatorial\lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
File "c:\Users\antonio.lopez\AppData\Local\miniconda3\envs\combinatorial\lib\site-packages\pygmo\_py_islands.py", line 26, in _evolve_func_mp_pool
    new_pop = algo.evolve(pop)
ValueError: 
function: uniform_real_from_range_checks
where: D:\bld\pagmo_1684216380930\work\include\pagmo/utils/generic.hpp, 79
what: Cannot generate a random real if the lower bound is larger than the upper bound

"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "c:\Users\antonio.lopez\AppData\Local\miniconda3\envs\combinatorial\lib\site-packages\pygmo\_py_islands.py", line 246, in run_evolve
    return loads(res.get())
File "c:\Users\antonio.lopez\AppData\Local\miniconda3\envs\combinatorial\lib\multiprocessing\pool.py", line 774, in get
    raise self._value
ValueError: 
function: uniform_real_from_range_checks
where: D:\bld\pagmo_1684216380930\work\include\pagmo/utils/generic.hpp, 79
what: Cannot generate a random real if the lower bound is larger than the upper bound

Environment (please complete the following information):

  • OS: Windows 11 (version: 23H2)
  • Installation method: conda 24.1.1
  • Version: 2.19.5

Additional context
Can provide more information as needed.

@alopezrivera alopezrivera added the bug Something isn't working label May 6, 2024
@alopezrivera
Copy link
Author

I have run into the same bug when using MBH wrapping the Scipy CG optimizer. I will update this comment to include all inner optimizers with which I've ran into this problem:

  • NLOPT
    • NEWUOA
  • Scipy
    • CG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant