Closed engintoklu closed 3 months ago
Attention: Patch coverage is 71.42857%
with 4 lines
in your changes missing coverage. Please review.
Project coverage is 76.73%. Comparing base (
5c58566
) to head (b74ca43
). Report is 1 commits behind head on master.:exclamation: Current head b74ca43 differs from pull request most recent head d600411
Please upload reports for the commit d600411 to get more accurate results.
Files | Patch % | Lines |
---|---|---|
src/evotorch/algorithms/ga.py | 76.92% | 3 Missing :warning: |
src/evotorch/tools/misc.py | 0.00% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This pull request adds an example notebook which demonstrates how one can declare and solve an optimization problem that has its
dtype
set asobject
, and therefore has a custom solution structure.While working on the example notebook, one bug, and one genetic algorithm-related shortcoming have been identified and fixed.
The bug was preventing one from instantiating a new
ObjectArray
with the help ofevotorch.tools.as_tensor(..., dtype=object)
. This bug is fixed by this pull request.The shortcoming was as follows: when the user defined a custom mutation operator using a regular function,
GeneticAlgorithm
assumed that the regular function would return a new batch of solutions whose length is equal to the number of solutions it received. This was an unnecessary restriction, and therefore, gets fixed with this pull request.