This repository is built on top of QDax library and Uncertain Quality Diversity.
The goal for the agent(ant) is to run as fast as possible, even when it's damaged.
- Left: Robot walking without damage
- Middle: Damage on Front-left leg
- Right: Recovered walking gait that adapts to the damage
For MAP creation, this project incorporates certain QD algorithms as the following:
- MAPElites
- DCRL-ME (from MAP-Elites with Descriptor-Conditioned Gradients and Archive Distillation into a Single Policy)
For tackling uncertainties in the QD environments, our method uses multi-evaluation sampling where each of the following sampling mechanism is wrapped in a container that can be easily swapped during runtime:
- MAPElites sampling
- Archive Sampling (AS) (from Uncertain Quality-Diversity: Evaluation methodology and new methods for Quality-Diversity in Uncertain Domains)
- Extract MAPElites (from Extract-QD Framework: A Generic Approach forQuality-Diversity in Noisy, Stochastic or Uncertain Domains)
For damage recovery, our method implements Intelligent Trial and Error using Bayesian Optimisation.
- always upgrade pip before running pip install:
pip install --upgrade pip
- Jax cuda version is set by default for its efficiency in running evaluations in parallel, install the dependencies using:
pip install -r requirements.txt
- Though it's advised to run on gpu, adaptation experiments can be run on cpu (very slow) with the following:
export JAX_PLATFORMS=cpu python main.py
- Default parameters are stored in
./config.json - Shell command will override default parameters
- Must specify running algo by setting the flag
--algo_type <op>,<op>currently only supports mapelites or dcrl
Before executing any code, make sure one's under the project directory:
cd <path-to-repository>For batched jobs, it's advised to run on gpu servers using shell commands, please refer to <hpc_train.sh> and <hpc_adapt.sh> under scripts/. All runtime results will be summarised in outputs/<hpc> by default.
qsub scripts/hpc_train.sh # local runs: ./scripts/hpc_train.shThe mode flag needs to be specified using --mode training in hpc_train.sh.
Model path needs to be explicitly set in hpc_adapt.sh for job submission.
qsub scripts/hpc_adapt.sh # local runs: ./scripts/hpc_adapt.shThe plot results will be presented under evaluations/.
python utils/evaluations.py- Vanilla MAP-Elites:
--container MAP-Elites_Sampling --dropout-rate 0 - MAP-Elites Sampling:
--container MAP-Elites_Sampling --num-samples 10 - Archive Sampling:
--container Archive-Sampling --num-samples 2 --depth 2 - Extract MAP-Elites:
--container Extract-MAP-Elites --num-samples 2 --depth 8
- batched_rewards: evaluates all cells in the archive, without any inf/nan values
- repertoire.fitnesses: with empty cells are portrayed as -inf


