Differential evolution
In evolutionary computation, differential evolution (DE) is a method that optimizes a problem by iteratively trying to improve a candidate solution with regard to a given measure of quality. Such methods are commonly known as metaheuristics as they make few or no assumptions about the problem being optimized and can search very large spaces of candidate solutions. However, metaheuristics such as DE do not guarantee an optimal solution is ever found.
DE is used for multidimensional real-valued functions but does not use the gradient of the problem being optimized, which means DE does not require for the optimization problem to be differentiable as is required by classic optimization methods such as gradient descent and quasi-newton methods. DE can therefore also be used on optimization problems that are not even continuous, are noisy, change over time, etc.[1]
DE optimizes a problem by maintaining a population of candidate solutions and creating new candidate solutions by combining existing ones according to its simple formulae, and then keeping whichever candidate solution has the best score or fitness on the optimization problem at hand. In this way the optimization problem is treated as a black box that merely provides a measure of quality given a candidate solution and the gradient is therefore not needed.
DE is originally due to Storn and Price.[2][3] Books have been published on theoretical and practical aspects of using DE in parallel computing, multiobjective optimization, constrained optimization, and the books also contain surveys of application areas.[4][5][6]
Contents
Algorithm
A basic variant of the DE algorithm works by having a population of candidate solutions (called agents). These agents are moved around in the search-space by using simple mathematical formulae to combine the positions of existing agents from the population. If the new position of an agent is an improvement it is accepted and forms part of the population, otherwise the new position is simply discarded. The process is repeated and by doing so it is hoped, but not guaranteed, that a satisfactory solution will eventually be discovered.
Formally, let be the cost function which must be minimized or fitness function which must be maximized. The function takes a candidate solution as argument in the form of a vector of real numbers and produces a real number as output which indicates the fitness of the given candidate solution. The gradient of
is not known. The goal is to find a solution
for which
for all
in the search-space, which would mean
is the global minimum. Maximization can be performed by considering the function
instead.
Let designate a candidate solution (agent) in the population. The basic DE algorithm can then be described as follows:
- Initialize all agents
with random positions in the search-space.
- Until a termination criterion is met (e.g. number of iterations performed, or adequate fitness reached), repeat the following:
- For each agent
in the population do:
- Pick three agents
, and
from the population at random, they must be distinct from each other as well as from agent
- Pick a random index
(
being the dimensionality of the problem to be optimized).
- Compute the agent's potentially new position
as follows:
- For each
, pick a uniformly distributed number
- If
or
then set
otherwise set
- (In essence, the new position is outcome of binary crossover of agent
with intermediate agent
.)
- For each
- If
then replace the agent in the population with the improved candidate solution, that is, replace
with
in the population.
- Pick three agents
- For each agent
- Pick the agent from the population that has the highest fitness or lowest cost and return it as the best found candidate solution.
Note that is called the differential weight and
is called the crossover probability, both these parameters are selectable by the practitioner along with the population size
see below.
Parameter selection



The choice of DE parameters and
can have a large impact on optimization performance. Selecting the DE parameters that yield good performance has therefore been the subject of much research. Rules of thumb for parameter selection were devised by Storn et al.[3][4] and Liu and Lampinen.[7] Mathematical convergence analysis regarding parameter selection was done by Zaharie.[8] Meta-optimization of the DE parameters was done by Pedersen [9][10] and Zhang et al.[11]
Variants
Variants of the DE algorithm are continually being developed in an effort to improve optimization performance. Many different schemes for performing crossover and mutation of agents are possible in the basic algorithm given above, see e.g.[3] More advanced DE variants are also being developed with a popular research trend being to perturb or adapt the DE parameters during optimization, see e.g. Price et al.,[4] Liu and Lampinen,[12] Qin and Suganthan,[13] Civicioglu [14] and Brest et al.[15] There are also some work in making a hybrid optimization method using DE combined with other optimizers. [16]
Sample code
The following is a specific pseudocode implementation of differential evolution, written similar to the Java language. For more generalized pseudocode, please see the listing in the Algorithm section above.
//definition of one individual in population
public class Individual {
//normally DifferentialEvolution uses floating point variables
float data1, data2
//but using integers is possible too
int data3
}
public class DifferentialEvolution {
//Variables
//linked list that has our population inside
LinkedList<Individual> population=new LinkedList<Individual>()
//New instance of Random number generator
Random random=new Random()
int PopulationSize=20
//differential weight [0,2]
float F=1
//crossover probability [0,1]
float CR=0.5
//dimensionality of problem, means how many variables problem has. this case 3 (data1,data2,data3)
int N=3;
//This function tells how well given individual performs at given problem.
public float fitnessFunction(Individual in) {
...
return fitness
}
//this is main function of program
public void Main() {
//Initialize population whit individuals that have been initialized whit uniform random noise
//uniform noise means random value inside your search space
int i=0
while(i<populationSize) {
Individual individual= new Individual()
individual.data1=random.UniformNoise()
individual.data2=random.UniformNoise()
//integers cant take floating point values and they need to be either rounded
individual.data3=Math.Floor( random.UniformNoise())
population.add(individual)
i++
}
i=0
int j
//main loop of evolution.
while (!StoppingCriteria) {
i++
j=0
while (j<populationSize) {
//calculate new candidate solution
//pick random point from population
int x=Math.floor(random.UniformNoise()%(population.size()-1))
int a,b,c
//pick three different random points from population
do{
a=Math.floor(random.UniformNoise()%(population.size()-1))
}while(a==x);
do{
b=Math.floor(random.UniformNoise()%(population.size()-1))
}while(b==x| b==a);
do{
c=Math.floor(random.UniformNoise()%(population.size()-1))
}while(c==x | c==a | c==b);
// Pick a random index [0-Dimensionality]
int R=rand.nextInt()%N;
//Compute the agent's new position
Individual original=population.get(x)
Individual candidate=original.clone()
Individual individual1=population.get(a)
Individual individual2=population.get(b)
Individual individual3=population.get(c)
//if(i==R | i<CR)
//candidate=a+f*(b-c)
//else
//candidate=x
if( Math.floor((random.UniformNoise()%N)==R | random.UniformNoise()%1<CR){
candidate.data1=individual1.data1+F*(individual2.data1-individual3.data1)
}// else isn't needed because we cloned original to candidate
if( Math.floor((random.UniformNoise()%N)==R | random.UniformNoise()%1<CR){
candidate.data2=individual1.data2+F*(individual2.data2-individual3.data2)
}
//integer work same as floating points but they need to be rounded
if( Math.floor((random.UniformNoise()%N)==R | random.UniformNoise()%1<CR){
candidate.data3=Math.floor(individual1.data3+F*(individual2.data3-individual3.data3))
}
//see if is better than original, if so replace
if(fitnessFunction(original)<fitnessFunction(candidate)){
population.remove(original)
population.add(candidate)
}
j++
}
}
//find best candidate solution
i=0
Individual bestFitness=new Individual()
while (i<populationSize) {
Individual individual=population.get(i)
if(fitnessFunction(bestFitness)<fitnessFunction(individual)){
bestFitness=individual
}
i++
}
//your solution
return bestFitness
}
}
See also
- CMA-ES
- Artificial bee colony algorithm
- The runner-root algorithm (RRA)
- Evolution strategy
- Genetic algorithm
- Differential search algorithm [14]
- Biogeography-based optimization
References
<templatestyles src="Reflist/styles.css" />
Cite error: Invalid <references>
tag; parameter "group" is allowed only.
<references />
, or <references group="..." />
External links
- Storn's Homepage on DE featuring source-code for several programming languages.
- Fast DE Algorithm A Fast Differential Evolution Algorithm using k-Nearest Neighbour Predictor.
- MODE Application Parameter Estimation of a Pressure Swing Adsorption Model for Air Separation Using Multi-objective Optimisation and Support Vector Regression Model.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ 3.0 3.1 3.2 Lua error in package.lua at line 80: module 'strict' not found.
- ↑ 4.0 4.1 4.2 Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ 14.0 14.1 Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Zhang, Wen-Jun; Xie, Xiao-Feng (2003). DEPSO: hybrid particle swarm with differential evolution operator. IEEE International Conference on Systems, Man, and Cybernetics (SMCC), Washington, DC, USA: 3816-3821.