Package org.opt4j.operators.diversity
Class DiversityPermutation
- java.lang.Object
-
- org.opt4j.operators.diversity.DiversityPermutation
-
- All Implemented Interfaces:
org.opt4j.core.optimizer.Operator<org.opt4j.core.genotype.PermutationGenotype<?>>
,Diversity<org.opt4j.core.genotype.PermutationGenotype<?>>
public class DiversityPermutation extends java.lang.Object implements Diversity<org.opt4j.core.genotype.PermutationGenotype<?>>
The
DiversityPermutation
is the interface forDiversity
operators forPermutationGenotype
s.Given are
n
elementse in E
two permutationsp1, p2
of these elements. The functionp(e)
returns the position of the elemente
in the permutationp
. This operator calculates the following value:diversity(p1,p2)=sum[e in E] |p1(e)-p2(e)|/(n^2/2)
This value is bounded by0
and1
sincemin { sum[e in E] |p1(e)-p2(e)| } = 0
andmax { sum[e in E] |p1(e)-p2(e)| } = = 2 * sum[i=1 to n/2] (n-i)-(i-1) = = 2 * sum[i=1 to n/2] (n-2i+1) = = 2 * ( n^2/2 + n/2 - n/2(n/2+1)) = = 2 * ( n^2/2 + n/2 - n^2/4 - n/2) = = n^2/2
.
-
-
Constructor Summary
Constructors Constructor Description DiversityPermutation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
diversity(org.opt4j.core.genotype.PermutationGenotype<?> a, org.opt4j.core.genotype.PermutationGenotype<?> b)
Returns the genetic diversity of twoGenotype
s.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opt4j.operators.diversity.Diversity
getOperatorType
-
-
-
-
Method Detail
-
diversity
public double diversity(org.opt4j.core.genotype.PermutationGenotype<?> a, org.opt4j.core.genotype.PermutationGenotype<?> b)
Description copied from interface:Diversity
Returns the genetic diversity of twoGenotype
s.
-
-