facebookresearch / nevergrad

A Python toolbox for performing gradient-free optimization
https://facebookresearch.github.io/nevergrad/
MIT License
3.9k stars 350 forks source link

examples of DE algorithm #1504

Closed beeevita closed 10 months ago

beeevita commented 1 year ago

Are there any examples of differential evolution usage?

Thanks for replying.

teytaud commented 10 months ago

Hello! Just pick up any example and put DE as an algorithm. Then you can try also many of the DE variants. For example, import nevergrad as ng import numpy as np ng.optimizers.registry["DE"](5, 1000).minimize(lambda x: np.linalg.norm(x-np.array(range(5)))) Array{(5,)}:[-0.01746634 0.99310113 2.0081899 2.99205557 4.00086407]

and you can use "TwoPointsDE" or many other DE

['DE', 'TwoPointsDE', 'VoronoiDE', 'RotatedTwoPointsDE', 'LhsDE', 'QrDE', 'QODE', 'SPQODE', 'QOTPDE', 'LQOTPDE', 'LQODE', 'SODE', 'NoisyDE', 'AlmostRotationInvariantDE', 'RotationInvariantDE', 'DiscreteDE', 'RecMutDE', 'MutDE', 'NLOPT_LN_NELDERMEAD', 'TinyLhsDE', 'TinyQODE', 'ASCMADEthird', 'MetaModelDE', 'MetaModelQODE', 'NeuralMetaModelDE', 'SVMMetaModelDE', 'RFMetaModelDE', 'MetaModelTwoPointsDE', 'NeuralMetaModelTwoPointsDE', 'SVMMetaModelTwoPointsDE', 'RFMetaModelTwoPointsDE', 'GeneticDE', 'MemeticDE', 'QNDE', 'OpoDE', 'OpoTinyDE']