dietmarwo / fast-cma-es Goto Github PK
View Code? Open in Web Editor NEWA Python 3 gradient-free optimization library
License: MIT License
A Python 3 gradient-free optimization library
License: MIT License
I've checked your fix to stall iterations handling. If stall_iterations is a value 0,1,2,3 (in documentation), you have to multiply it by 64. Please fix this. This applies to Java version as well, not only Python.
Orig:
if (stall_iterations > 0 && stallCount > stall_iterations*dim) {
stop = 2;
break;
}
Fixed:
if (stall_iterations > 0 && stallCount > stall_iterations*64*dim) {
stop = 2;
break;
}
Hey, I am trying to use fcmaes on my MacBook, but when importing GTOP problems from fcmaes.astro I face this error:
no suitable image was found. Did find:
/Users/maryamsmacbookpro/opt/anaconda3/lib/python3.9/site-packages/fcmaes/lib/libgtoplib.dll: unknown file type, first eight bytes: 0x4D 0x5A 0x90 0x00 0x03 0x00 0x00 0x00
I have searched a lot but none of the solutions did work. I'd be very thankful if you help me!
I see that biteopt stopping criteria is fixed
if (stallCount > 64*dim) {
stop = 2;
break;
}
it puts BiteOpt at a considerable disadvantage on complex problems. This should be switchable, and off by default. Also it would be better for stopping criteria specified as "stopc64dim", where "stopc" is an integer>0
Also please specify BiteOpt version in each instance its results are mentioned.
I'm using "evolopy" project on my windows 10, but I got this error in "fcmaes":
FileNotFoundError: Could not find module 'D:\anaconda\envs\ML\lib\site-packages\fcmaes\lib\libgtoplib.dll' (or one of its dependencies).
However, I truly found this file in the right directory. Is that a bug on Windows? How can I deal with it? Must I use linux instead? Thx.
Hi, I'm trying to use fcmaes on Debian stable (10) but I get an error GLIBCXX_3.4.26 not found
.
I guess libacmalib.so
needs a more recent GCC but my GCC is not very old (8.3). Is it possible to have a more portable pre-built .so
file, or its source code ?
Here is what I've done:
$ sudo apt install intel-mkl
$ virtualenv env -p python3
$ source env/bin/activate
(env) $ pip install fcmaes
(env) $ python
Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from fcmaes import cmaescpp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/toto/test-fcmaes/env/lib/python3.7/site-packages/fcmaes/cmaescpp.py", line 129, in <module>
libcmalib = ct.cdll.LoadLibrary(basepath + '/lib/libacmalib.so')
File "/usr/lib/python3.7/ctypes/__init__.py", line 434, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.7/ctypes/__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/toto/test-fcmaes/env/lib/python3.7/site-packages/fcmaes/lib/libacmalib.so)
It seems that CMA Cpp completely ignores x0 /guess as this code shows:
fast-cma-es/_fcmaescpp/acmaesoptimizer.cpp
Lines 163 to 165 in 7952d2b
Since guess is not evaluated, its value is assumed to be DBL_MAX, which means that it gets quickly removed.
What should happen is that guess
is evaluated in the initialization and bestValue
updated accordingly. And even better interface would allow to specify guessValue
since this is often the best solution found in a previous iteration and we may wish to avoid evaluating it again.
Hi, not an issue, just a question here!
First, thanks for what looks like a great library! I'm currently using SciPy's DE for the optimisation of an EHVI-based acquisition function - it's been working ok but is running fairly slowly for a 22-variable problem. Looking at your benchmarks and testing, I'm tempted to try out this library, as my next project will probably study 35-40 variables.
I was wondering, in your tests, you switch between calling the python and C++ versions of the functions. Are there any differences between them, other than the implementation language? I'm interested in the DE->CMA process, could I just call the C++ implementation (for speed)?
Thanks!
Hi Dietmar,
I installed fast-cma-es on Windows 11 following the instructions in README (X64 C++ runtime libraries were also installed).
Tried a small optimization:
import numpy as np
from scipy.optimize import Bounds
from fcmaes import cmaescpp, cmaes
def obj(x):
return np.sum(x**2)
bounds = Bounds([-1, -1], [1, 1])
result = cmaescpp.minimize(obj, bounds)
print(result)
and got the following result:
success: False
status: -1
fun: 1.7976931348623157e+308
x: None
nit: 0
nfev: 0
The python algorithm works (cmaes). Output:
success: True
status: 4
fun: 3.7194596397089263e-19
x: [ 5.707e-10 -2.152e-10]
nit: 78
nfev: 1209
What do you think could be the cause? Thanks :)
Required package loguru is not installed automatically by pip in the 1.6.3 version.
I tested with python 3.9 and 3.11:
starting from a fresh virtual environment
~$ pip install fcmaes
~$ pip list
Package Version
------------- -------
fcmaes 1.5.9
joblib 1.3.2
numpy 1.26.0
pip 23.2.1
scikit-learn 1.3.1
scipy 1.11.3
setuptools 68.2.0
threadpoolctl 3.2.0
wheel 0.41.2
>>> from fcmaes import cmaes
ModuleNotFoundError: No module named 'loguru'
Although loguru is specified as "required" in setup.py, it is not mentioned in the wheel on PyPi.
In the METADATA file of the wheel, we can read the dependencies:
"Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: scikit-learn
Requires-Dist: threadpoolctl"
Of course, for now, I could install loguru manually to solve the issue.
I suppose the same issue will arise with missing numba package.
Hi! I tried to install fcmaes through both pip and conda, but it gave me this error
Output exceeds the [size limit](command:workbench.action.openSettings?%5B%22notebook.output.textLineLimit%22%5D). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?91caeebd-c551-49fc-8a5d-5196a5210d61)
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
[/Users/ivy/src/experiments/squares/square-fcmaes.ipynb](https://file+.vscode-resource.vscode-cdn.net/Users/ivy/src/experiments/squares/square-fcmaes.ipynb) Cell 1 in 1
----> [1](vscode-notebook-cell:/Users/ivy/src/experiments/squares/square-fcmaes.ipynb#W0sZmlsZQ%3D%3D?line=0) from fcmaes.optimizer import logger
[2](vscode-notebook-cell:/Users/ivy/src/experiments/squares/square-fcmaes.ipynb#W0sZmlsZQ%3D%3D?line=1) from fcmaes import retry
File [/opt/homebrew/Caskroom/miniforge/base/envs/petri/lib/python3.9/site-packages/fcmaes/optimizer.py:16](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Caskroom/miniforge/base/envs/petri/lib/python3.9/site-packages/fcmaes/optimizer.py:16)
13 import ctypes as ct
14 import multiprocessing as mp
---> 16 from fcmaes import cmaes, de, cmaescpp, decpp, dacpp, gcldecpp, lcldecpp, ldecpp, csmacpp, bitecpp
18 _logger = None
20 def logger(logfile = 'optimizer.log'):
File [/opt/homebrew/Caskroom/miniforge/base/envs/petri/lib/python3.9/site-packages/fcmaes/cmaescpp.py:19](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Caskroom/miniforge/base/envs/petri/lib/python3.9/site-packages/fcmaes/cmaescpp.py:19)
17 from scipy.optimize import OptimizeResult
18 from fcmaes.cmaes import _check_bounds
---> 19 from fcmaes.decpp import mo_call_back_type, callback, libcmalib
21 os.environ['MKL_DEBUG_CPU_TYPE'] = '5'
23 def minimize(fun,
24 bounds=None,
25 x0=None,
(...)
34 normalize = True,
35 update_gap = None):
...
--> 374 self._handle = _dlopen(self._name, mode)
375 else:
376 self._handle = handle
OSError: dlopen([/opt/homebrew/Caskroom/miniforge/base/envs/petri/lib/python3.9/site-packages/fcmaes/lib/libacmalib.dll](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Caskroom/miniforge/base/envs/petri/lib/python3.9/site-packages/fcmaes/lib/libacmalib.dll), 0x0006): tried: '[/opt/homebrew/Caskroom/miniforge/base/envs/petri/lib/python3.9/site-packages/fcmaes/lib/libacmalib.dll](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Caskroom/miniforge/base/envs/petri/lib/python3.9/site-packages/fcmaes/lib/libacmalib.dll)' (not a mach-o file), '[/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Caskroom/miniforge/base/envs/petri/lib/python3.9/site-packages/fcmaes/lib/libacmalib.dll](https://file+.vscode-resource.vscode-cdn.net/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Caskroom/miniforge/base/envs/petri/lib/python3.9/site-packages/fcmaes/lib/libacmalib.dll)' (no such file), '[/opt/homebrew/Caskroom/miniforge/base/envs/petri/lib/python3.9/site-packages/fcmaes/lib/libacmalib.dll](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Caskroom/miniforge/base/envs/petri/lib/python3.9/site-packages/fcmaes/lib/libacmalib.dll)' (not a mach-o file
Is there some other way to install on M1 macs or is this just not supported? Thanks :)
Dear Mr. Wolf,
Im a student from Kaiserslautern, Germany and I
d like to involve your seemingly well done piece of work here in my diploma thesis. It is about direct benchmarking quantum solver results with proper up-to-date solvers on common hardware. As I read about MIT license here, am I allowed to use your code here to work with and publish it. Of course you as author will be called in the final thesis then. In that case, please tell me the correct source to mention for the job shop solver.
With kind regards,
Luca Graebenteich
Thank you for the OptaPy comparison for Employee Scheduling problem.
Can you upload the JSON representation of the employee scheduling problem mentioned in the tutorial so we do not have to run the OptaPy solution.
Or even better would be to have an example with one of the nurse rostering benchmark problems.
Minimal steps to reproduce :
run python in a terminal (I am currently using python 3.9.7)
in the python terminal, run from fcmaes import mode
Error :
zsh: illegal hardware instruction python
Side note :
if I run the python terminal from a bash terminal (instead of zsh), I get
Illegal instruction: 4
If yo have any idea on how to fix this, that would be great :)
While de_cma_py
seems to work fine, when I try running de_cma
, I get a flood of SystemError: null argument to internal routine
on some iteration runs - it's hard to tell where it comes from (I suspect it's from the C++ CMA, and not the DE code). Other times, I'll see a flood of TypeError: object of type 'Process' has no len()
errors but this is also intermittent. Do you have any thoughts on where this might be coming from?
Thanks and regards,
Tim
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.