Skip to content

Commit 1b0b162

Browse files
authored
Add wrapper for Nevergrad PSO optimizer (#579)
1 parent 4a9ddcc commit 1b0b162

11 files changed

+237
-0
lines changed

.tools/envs/testenv-linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ dependencies:
2929
- annotated-types # dev, tests
3030
- iminuit # dev, tests
3131
- pip: # dev, tests, docs
32+
- nevergrad # dev, tests
3233
- DFO-LS>=1.5.3 # dev, tests
3334
- Py-BOBYQA # dev, tests
3435
- fides==0.7.4 # dev, tests

.tools/envs/testenv-numpy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ dependencies:
2727
- annotated-types # dev, tests
2828
- iminuit # dev, tests
2929
- pip: # dev, tests, docs
30+
- nevergrad # dev, tests
3031
- DFO-LS>=1.5.3 # dev, tests
3132
- Py-BOBYQA # dev, tests
3233
- fides==0.7.4 # dev, tests

.tools/envs/testenv-others.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ dependencies:
2727
- annotated-types # dev, tests
2828
- iminuit # dev, tests
2929
- pip: # dev, tests, docs
30+
- nevergrad # dev, tests
3031
- DFO-LS>=1.5.3 # dev, tests
3132
- Py-BOBYQA # dev, tests
3233
- fides==0.7.4 # dev, tests

.tools/envs/testenv-pandas.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ dependencies:
2727
- annotated-types # dev, tests
2828
- iminuit # dev, tests
2929
- pip: # dev, tests, docs
30+
- nevergrad # dev, tests
3031
- DFO-LS>=1.5.3 # dev, tests
3132
- Py-BOBYQA # dev, tests
3233
- fides==0.7.4 # dev, tests

docs/source/algorithms.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3984,6 +3984,65 @@ iminuit).
39843984
- Values greater than 1 specify the maximum number of restart attempts.
39853985
```
39863986

3987+
(nevergrad-algorithms)=
3988+
3989+
## Nevergrad Optimizers
3990+
3991+
optimagic supports some algorithms from the
3992+
[Nevergrad](https://facebookresearch.github.io/nevergrad/index.html) library. To use
3993+
these optimizers, you need to have
3994+
[the nevergrad package](https://github.com/facebookresearch/nevergrad) installed.
3995+
(`pip install nevergrad`).
3996+
3997+
```{eval-rst}
3998+
.. dropdown:: nevergrad_pso
3999+
4000+
.. code-block::
4001+
4002+
"nevergrad_pso"
4003+
4004+
Minimize a scalar function using the Particle Swarm Optimization (PSO) algorithm.
4005+
4006+
The Particle Swarm Optimization algorithm was originally proposed by
4007+
:cite:`Kennedy1995`. The implementation in Nevergrad is based on
4008+
:cite:`Zambrano2013`.
4009+
4010+
Particle Swarm Optimization (PSO) solves a problem by having a population of
4011+
candidate solutions, here dubbed particles, and moving these particles around in the
4012+
search-space according to simple mathematical formulae over the particle's position
4013+
and velocity. Each particle's movement is influenced by its local best known
4014+
position (termed "cognitive" component), but is also guided toward the best known
4015+
positions (termed "social" component) in the search-space, which are updated as
4016+
better positions are found by other particles. This is expected to move the swarm
4017+
toward the best solutions.
4018+
4019+
- **transform** (str): The transform to use to map from PSO optimization space to
4020+
R-space. Available options are:
4021+
- "arctan" (default)
4022+
- "identity"
4023+
- "gaussian"
4024+
- **population_size** (int): Population size of the particle swarm.
4025+
- **n_cores** (int): Number of cores to use.
4026+
- **seed** (int): Seed used by the internal random number generator.
4027+
- **stopping.maxfun** (int): Maximum number of function evaluations.
4028+
- **inertia** (float): Inertia weight. Denoted by :math:`\omega`.
4029+
Default is 0.7213475204444817. To prevent divergence, the value must be smaller
4030+
than 1. It controls the influence of the particle's previous velocity on its
4031+
movement.
4032+
- **cognitive** (float): Cognitive coefficient. Denoted by :math:`\phi_p`.
4033+
Default is 1.1931471805599454. Typical values range from 1.0 to 3.0. It controls
4034+
the influence of its own best known position on the particle's movement.
4035+
- **social** (float): Social coefficient. Denoted by :math:`\phi_g`.
4036+
Default is 1.1931471805599454. Typical values range from 1.0 to 3.0. It controls
4037+
the influence of the swarm's best known position on the particle's movement.
4038+
- **quasi_opp_init** (bool): Whether to use quasi-opposition initialization.
4039+
Default is False.
4040+
- **speed_quasi_opp_init** (bool): Whether to use quasi-opposition initialization
4041+
for speed. Default is False.
4042+
- **special_speed_quasi_opp_init** (bool): Whether to use special quasi-opposition
4043+
initialization for speed. Default is False.
4044+
```
4045+
39874046
## References
39884047

39894048
```{eval-rst}

docs/source/refs.bib

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,4 +906,25 @@ @article{JAMES1975343
906906
author = {F. James and M. Roos}
907907
}
908908

909+
@InProceedings{Kennedy1995,
910+
author={Kennedy, J. and Eberhart, R.},
911+
booktitle={Proceedings of ICNN'95 - International Conference on Neural Networks},
912+
title={Particle swarm optimization},
913+
year={1995},
914+
volume={4},
915+
pages={1942-1948 vol.4},
916+
keywords={Particle swarm optimization;Birds;Educational institutions;Marine animals;Testing;Humans;Genetic algorithms;Optimization methods;Artificial neural networks;Performance evaluation},
917+
doi={10.1109/ICNN.1995.488968},
918+
}
919+
920+
@InProceedings{Zambrano2013,
921+
author = {Zambrano-Bigiarini, Mauricio and Clerc, Maurice and Rojas, Rodrigo},
922+
booktitle = {2013 IEEE Congress on Evolutionary Computation},
923+
title = {Standard Particle Swarm Optimisation 2011 at CEC-2013: A baseline for future PSO improvements},
924+
year = {2013},
925+
pages = {2337-2344},
926+
keywords = {Optimization;Standards;Benchmark testing;Topology;Algorithm design and analysis;Convergence;Equations;particle swarm optimization;SPSO-2011;CEC-2013;random topology;rotational invariance;benchmark testing;evolutionary computation;optimization},
927+
doi = {10.1109/CEC.2013.6557848},
928+
}
929+
909930
@Comment{jabref-meta: databaseType:bibtex;}

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ dependencies:
3939
- annotated-types # dev, tests
4040
- iminuit # dev, tests
4141
- pip: # dev, tests, docs
42+
- nevergrad # dev, tests
4243
- DFO-LS>=1.5.3 # dev, tests
4344
- Py-BOBYQA # dev, tests
4445
- fides==0.7.4 # dev, tests

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,5 +380,6 @@ module = [
380380
"annotated_types",
381381
"pdbp",
382382
"iminuit",
383+
"nevergrad",
383384
]
384385
ignore_missing_imports = true

0 commit comments

Comments
 (0)