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 wrong defaults of SteadyStateGA #87

Closed engintoklu closed 11 months ago

engintoklu commented 1 year ago

While initializing SteadyStateGA, if the operators argument was not given (or was given as an empty list) and if re_evaluate was given as True (which is the default), SteadyStateGA was making the wrong default assumption that the parent solutions do not have to be evaluated before the children. This wrong assumption caused the tournament selection phases of the cross-over operators to fail, as they encountered unevaluated parents.

This pull request fixes this wrong assumption. When operators is empty (which means that the operators are to be added later via use(...) method), and re_evaluate is True, the default assumption of SteadyStateGA will now be that the parents need to be evaluated first.

codecov[bot] commented 1 year ago

Codecov Report

Merging #87 (5b0db91) into master (9d31d59) will decrease coverage by 0.04%. The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master      #87      +/-   ##
==========================================
- Coverage   77.83%   77.80%   -0.04%     
==========================================
  Files          49       49              
  Lines        7332     7334       +2     
==========================================
- Hits         5707     5706       -1     
- Misses       1625     1628       +3     
Files Changed Coverage Δ
src/evotorch/algorithms/ga.py 66.66% <50.00%> (-0.19%) :arrow_down:

... and 1 file with indirect coverage changes