adaptive-intelligent-robotics / QDax

Accelerated Quality-Diversity
https://qdax.readthedocs.io/en/latest/
MIT License
260 stars 42 forks source link

Fix reset_based scoring usage in brax env default definition function #109

Closed manon-but-yes closed 1 year ago

manon-but-yes commented 1 year ago

This PR aims to fix the way the reset_based scoring function is used in the create_default_brax_task_components function, which allows the creation of a default Brax environment.

The reset_based scoring function takes as input a reset function play_reset_fnand thus allows to define either deterministic or stochastic tasks. However, it has a second advantage compared to the usual scoring function: as it vmap the play_reset_fn, it works with any dimension of genotype to evaluate. Unlike the default scoring function that can only evaluate a fixed number of genotypes (of the same size as the init_states given as input).

The current create_default_brax_task_components takes as input a boolean is_reset_based and depending on it returns either the default scoring function or the reset_based scoring function. This commit uniformises this with the following changes:

codecov-commenter commented 1 year ago

Codecov Report

Merging #109 (f9f4d3e) into develop (46e82b6) will increase coverage by 0.10%. The diff coverage is 75.00%.

@@             Coverage Diff             @@
##           develop     #109      +/-   ##
===========================================
+ Coverage    90.69%   90.80%   +0.10%     
===========================================
  Files           84       84              
  Lines         4677     4677              
===========================================
+ Hits          4242     4247       +5     
+ Misses         435      430       -5     
Impacted Files Coverage Δ
tests/default_tasks_test/brax_task_test.py 97.14% <ø> (ø)
qdax/tasks/brax_envs.py 96.66% <75.00%> (+8.33%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more