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

feat: Add torch-based CMA-ES implementation #41

Merged
merged 4 commits into from
Jan 17, 2023
Merged

feat: Add torch-based CMA-ES implementation #41

merged 4 commits into from
Jan 17, 2023

Conversation

NaturalGradient
Copy link
Collaborator

This pull request:

  • Refactors the existing evotorch.algorithms.cmaes.CMAES, which is simply a wrapper for pycma to evotorch.algorithms.pycmaes.PyCMAES.
  • Introduces a new, torch-based, implementation of CMAES under the name evotorch.algorithms.cmaes.CMAES. This aims to faithfully reimplement the most recent version of pycma, while also benefiting from the evotorch ecosystem e.g. vectorized, GPU based, working with torch tensors for compatibility with other features.
  • Introduces evotorch.algorithms.restarters, which provides basic functionality for meta-algorithms that wrap around a SearchAlgorithm class + parameterization, and allow automatic restarting of the algorithm. This creates basic functionality for the eventual re-implementation e.g. of IPOP-CMA-ES and BIPOP-CMA-ES, and equivalent algorithms for XNES, SNES etc.
  • Adds the is_terminated flag to all SearchAlgorithm classes, that will allow the user to define their own general functionality for detecting termination states that should trigger restarts. Currently, this value defaults to False, but in the future it is intended to add example termination states to the new CMAES implementation.

@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2022

Codecov Report

Merging #41 (f8d776f) into master (d3e3f0a) will increase coverage by 24.02%.
The diff coverage is 49.83%.

@@             Coverage Diff             @@
##           master      #41       +/-   ##
===========================================
+ Coverage   52.97%   77.00%   +24.02%     
===========================================
  Files          43       47        +4     
  Lines        6233     6532      +299     
===========================================
+ Hits         3302     5030     +1728     
+ Misses       2931     1502     -1429     
Impacted Files Coverage Δ
src/evotorch/algorithms/restarter/__init__.py 0.00% <0.00%> (ø)
...rc/evotorch/algorithms/restarter/modify_restart.py 0.00% <0.00%> (ø)
src/evotorch/algorithms/restarter/restart.py 0.00% <0.00%> (ø)
src/evotorch/algorithms/pycmaes.py 21.83% <21.83%> (ø)
src/evotorch/algorithms/searchalgorithm.py 86.38% <66.66%> (+47.55%) ⬆️
src/evotorch/algorithms/cmaes.py 83.92% <82.66%> (+62.58%) ⬆️
src/evotorch/algorithms/__init__.py 100.00% <100.00%> (ø)
src/evotorch/decorators.py 100.00% <0.00%> (ø)
src/evotorch/tools/__init__.py 100.00% <0.00%> (ø)
src/evotorch/neuroevolution/net/__init__.py 100.00% <0.00%> (ø)
... and 26 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@NaturalGradient NaturalGradient changed the title Draft: Add torch-based CMA-ES implementation Add torch-based CMA-ES implementation Dec 20, 2022
@Higgcz Higgcz changed the title Add torch-based CMA-ES implementation feat: Add torch-based CMA-ES implementation Jan 2, 2023
@Higgcz Higgcz added this to the 0.4.0 milestone Jan 17, 2023
@Higgcz Higgcz merged commit b92d9bb into master Jan 17, 2023
@Higgcz Higgcz deleted the feature/cmaes branch January 17, 2023 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants