You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import numpy as np
from pymoo.algorithms.soo.nonconvex.cmaes import CMAES
from pymoo.problems import get_problem
from pymoo.optimize import minimize
problem = get_problem("sphere")
algorithm = CMAES(x0=np.random.random(problem.n_var))
res = minimize(problem,
algorithm,
seed=1,
verbose=False)
print(f"Best solution found: \nX = {res.X}\nF = {res.F}\nCV= {res.CV}")
I have this error:
File "[...]\CMA_ES.py", line 11, in <module>
res = minimize(problem,
^^^^^^^^^^^^^^^^^
File "[...]\.venv\Lib\site-packages\pymoo\optimize.py", line 67, in minimize
res = algorithm.run()
^^^^^^^^^^^^^^^
File "[...]\.venv\Lib\site-packages\pymoo\core\algorithm.py", line 138, in run
self.next()
File "[...]\.venv\Lib\site-packages\pymoo\core\algorithm.py", line 159, in next
self.advance(infills=infills)
File "[...]\.venv\Lib\site-packages\pymoo\core\algorithm.py", line 214, in advance
self._initialize_advance(infills=infills, **kwargs)
File "[...]\.venv\Lib\site-packages\pymoo\algorithms\soo\nonconvex\cmaes.py", line 431, in _initialize_advance
self.next_X = next(self.es)
^^^^^^^^^^^^^
File "[...]\.venv\Lib\site-packages\pymoo\vendor\vendor_cmaes.py", line 128, in my_fmin
es = MyCMAEvolutionStrategy(x0, sigma_factor * sigma0, opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[...]\.venv\Lib\site-packages\cma\evolution_strategy.py", line 1503, in __init__
self.boundary_handler = self.boundary_handler(opts['bounds'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[...]\.venv\Lib\site-packages\cma\constraints_handler.py", line 259, in __init__
self.bounds_tf = BoxConstraintsLinQuadTransformation(self.to_dim_times_two(bounds))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[...]\.venv\Lib\site-packages\cma\transformations.py", line 262, in __init__
super(BoxConstraintsLinQuadTransformation, self).__init__(bounds)
File "[...]\.venv\Lib\site-packages\cma\transformations.py", line 123, in __init__
self.initialize()
File "[...]\.venv\Lib\site-packages\cma\transformations.py", line 271, in initialize
self._lb = array([self.bounds[min((i, max_i))][0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Unable to avoid copy while creating an array as requested.
If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x).
For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.
I'm on Windows 11, with python 3.12 and with this pip environment :
Thank you for your feedback!
As shown in the pip list, the current cma version is 3.2.2, which is the default version included with the latest pymoo installation (0.6.1.3).
If you have any further questions, please don’t hesitate to reach out!
Hello,
Firstly, a big thanks for this library! It is very useful.
When I run the example of CMA-ES (https://pymoo.org/algorithms/soo/cmaes.html) :
I have this error:
I'm on Windows 11, with python 3.12 and with this pip environment :
Is anyone can help me fixing this issue? Thanks in advance!
The text was updated successfully, but these errors were encountered: