Skip to content

Commit

Permalink
Add nslc_cma_imp to sphere example (#482)
Browse files Browse the repository at this point in the history
## Description

<!-- Provide a brief description of the PR's purpose here. -->

An experimental algorithm that combines a ProximityArchive with local
competition with an EvolutionStrategyEmitter.

## Status

- [x] I have read the guidelines in

[CONTRIBUTING.md](https://github.com/icaros-usc/pyribs/blob/master/CONTRIBUTING.md)
- [x] I have formatted my code using `yapf`
- [x] I have tested my code by running `pytest`
- [x] I have linted my code with `pylint`
- [x] I have added a one-line description of my change to the changelog
in
      `HISTORY.md`
- [x] This PR is ready to go
  • Loading branch information
btjanaka authored Jul 2, 2024
1 parent 56d4291 commit 4f7b4e9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#### Documentation

- Add novelty search with CMA-ES to sphere example ({pr}`478`)
- Add novelty search with CMA-ES to sphere example ({pr}`478`, {pr}`482`)

#### Improvements

Expand Down
36 changes: 36 additions & 0 deletions examples/sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
GradientArborescenceEmitter using ImprovementRanker.
- `ns_cma`: Novelty Search with CMA-ES; implemented using a ProximityArchive
with EvolutionStrategyEmitter. Results are stored in a passive GridArchive.
- `nslc_cma_imp`: EvolutionStrategyEmitter with a ProximityArchive with local
competition turned on. Thus, the archive returns two-stage improvement
information that is fed to the EvolutionStrategyEmitter just like in CMA-ME.
The parameters for each algorithm are stored in CONFIG. The parameters
reproduce the experiments presented in the paper in which each algorithm is
Expand Down Expand Up @@ -608,6 +611,8 @@
"archive": {
"class": ProximityArchive,
"kwargs": {
# Hyperparameters from Density Descent paper:
# https://arxiv.org/abs/2312.11331
"k_neighbors": 15,
"novelty_threshold": 0.037 * 512,
}
Expand All @@ -627,6 +632,37 @@
"kwargs": {}
}
},
"nslc_cma_imp": {
"dim": 100,
"iters": 5000,
"archive_dims": (100, 100),
"use_result_archive": True,
"is_dqd": False,
"batch_size": 36,
"archive": {
"class": ProximityArchive,
"kwargs": {
"k_neighbors": 15,
# Note: This is untuned.
"novelty_threshold": 0.037 * 100,
"local_competition": True,
}
},
"emitters": [{
"class": EvolutionStrategyEmitter,
"kwargs": {
"sigma0": 0.5,
"ranker": "2imp",
"selection_rule": "filter",
"restart_rule": "no_improvement"
},
"num_emitters": 15
}],
"scheduler": {
"class": Scheduler,
"kwargs": {}
}
},
}


Expand Down
1 change: 1 addition & 0 deletions tests/examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ python examples/sphere.py cma_mega_adam --dim 20 --itrs 10 --outdir "${SPHERE_OU
python examples/sphere.py cma_mae --dim 20 --itrs 10 --learning_rate 0.01 --outdir "${SPHERE_OUTPUT}"
python examples/sphere.py cma_maega --dim 20 --itrs 10 --learning_rate 0.01 --outdir "${SPHERE_OUTPUT}"
python examples/sphere.py ns_cma --dim 20 --itrs 10 --outdir "${SPHERE_OUTPUT}"
python examples/sphere.py nslc_cma_imp --dim 20 --itrs 10 --outdir "${SPHERE_OUTPUT}"

# lunar_lander.py
install_deps examples/lunar_lander.py
Expand Down

0 comments on commit 4f7b4e9

Please sign in to comment.