dietmarwo / fast-cma-es

A Python 3 gradient-free optimization library
MIT License
122 stars 18 forks source link

[Question] Difference between Python/C++ functions #6

Closed timjim333 closed 2 years ago

timjim333 commented 3 years ago

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!

dietmarwo commented 3 years ago

Most algorithms are only in C++, but the ones which have a Python version (CMA-ES and DE) are identical to their Python counterparts. https://github.com/dietmarwo/fast-cma-es/blob/master/ODE.adoc is the newest tutorial showing all variants of parallelism. Only the Python variants support parallel function evaluation - should be used if the fitness function is very expensive. You should give BiteOpt a try. The fcmaes DE variant is much better than scipy DE if used with the parallel retry.
Is your EHVI-based acquisition function based on open source code ? I am always looking for new application examples. There is no reason to use the Python implementation if you are not interested in parallel function evaluation.

timjim333 commented 3 years ago

Just to give you an update on this front - I'm using my collaborators' framework KADAL. For 2D EHVI we have a python method implemented. For 3D EHVI, I wrapped the Uni of Leiden's KMAC code for Python (also implemented in KADAL). In pure python we also support parallel evaluation, hence why I was interested in getting fcmaes working with it!

dietmarwo commented 2 years ago

https://moda.liacs.nl/index.php?page=code looks very interesting. When I find some time i will try to compare with what I have added in the mean time regarding multi-objective optimization (https://github.com/dietmarwo/fast-cma-es/blob/master/fcmaes/mode.py and https://github.com/dietmarwo/fast-cma-es/blob/master/fcmaes/modecpp.py) and scheduling https://github.com/dietmarwo/fast-cma-es/blob/master/tutorials/Scheduling.adoc .

dietmarwo commented 2 years ago

Had a look at https://moda.liacs.nl/index.php?page=code , specially at https://moda.liacs.nl/code/KefalasEtAl2019-Supplement.zip . Implemented the same problem using fcmaes here https://github.com/dietmarwo/fast-cma-es/blob/master/examples/jobshop.py and described it here https://github.com/dietmarwo/fast-cma-es/blob/master/tutorials/JobShop.adoc . Maybe this is interesting to you. Will check https://github.com/flowdiagnosticsitb/KADAL next. Last year I wrote "Only the Python variants support parallel function evaluation" . this is not true for the C++ implementation of my new multiobjective optimizer https://github.com/dietmarwo/fast-cma-es/blob/master/fcmaes/decpp.py I used for the job shop problem.