nnaisense / evotorch

Advanced evolutionary computation library built directly on top of PyTorch, created at NNAISENSE.
https://evotorch.ai
Apache License 2.0
997 stars 62 forks source link

Fix division-by-zero while initializing CMAES #86

Closed engintoklu closed 11 months ago

engintoklu commented 1 year ago

While computing its default C decomposition frequency, under some conditions (e.g. with a problem of solution length 1000), initialization of CMAES failed due to division-by-zero (which later resulted in a failing attempt to convert inf to an integer). This pull request aims to fix this issue.

codecov[bot] commented 1 year ago

Codecov Report

Merging #86 (6130253) into master (9d31d59) will decrease coverage by 0.03%. The diff coverage is 87.50%.

@@            Coverage Diff             @@
##           master      #86      +/-   ##
==========================================
- Coverage   77.83%   77.81%   -0.03%     
==========================================
  Files          49       49              
  Lines        7332     7338       +6     
==========================================
+ Hits         5707     5710       +3     
- Misses       1625     1628       +3     
Files Changed Coverage Δ
src/evotorch/algorithms/cmaes.py 82.95% <87.50%> (+0.01%) :arrow_up:

... and 1 file with indirect coverage changes