- All Implemented Interfaces:
Consider an example to illustrate. Let parent p1 = [3, 0, 6, 2, 5, 1, 4, 7] and parent p2 = [7, 6, 5, 4, 3, 2, 1, 0]. Consider U=0.5, and imagine in this hypothetical scenario that exactly half of the indexes were chosen, and that those 4 indexes are: 0, 3, 4, 6. Child c1 will get the elements at those indexes from p1, thus c1 begins with [3, x, x, 2, 5, x, 4, x]. The missing elements, 0, 1, 6, 7 will get their relative ordering from p2, and thus will be ordered as: 7, 6, 1, 0. In that order, they will fill into the open spots to derive: c1 = [3, 7, 6, 2, 5, 1, 4, 0]. Likewise, c2 will get the elements from indexes 0, 3, 4, and 6 from p2 to initialize as [7, x, x, 4, 3, x, 1, x]. Its missing elements, 0, 2, 5, and 6 will get relative order from p1, and thus will be ordered 0, 6, 2, 5 to derive c2 = [7, 0, 6, 4, 3, 2, 1, 5].
The worst case runtime of a call to
cross is O(n), where n is the length of the
UOBX was introduced in the following paper:
Syswerda, G. Schedule Optimization using Genetic Algorithms. Handbook of Genetic Algorithms, 1991.
Method SummaryModifier and TypeMethodDescription
(int raw1, int raw2)See
PermutationBinaryOperatorfor details of this method.
voidPerforms a crossover for an evolutionary algorithm, such that crossover forms two children from two parents.
split()Generates a functionally identical copy of this object, for use in multithreaded implementations of search algorithms.
UniformOrderBasedCrossoverpublic UniformOrderBasedCrossover()Constructs a uniform order-based crossover (UOBX) operator, with a default U=0.5.
(double u)Constructs a uniform order-based crossover (UOBX) operator.
u- The probability of an index being among the fixed-point positions.
IllegalArgumentException- if u is less than or equal to 0.0, or if u is greater than or equal to 1.0.
crossDescription copied from interface:
applypublic void apply
(int raw1, int raw2)See
PermutationBinaryOperatorfor details of this method. This method is not intended for direct usage. Use the
cross(org.cicirello.permutations.Permutation, org.cicirello.permutations.Permutation)method instead.
splitpublic UniformOrderBasedCrossover split()Description copied from interface:
SplittableGenerates a functionally identical copy of this object, for use in multithreaded implementations of search algorithms. The state of the object that is returned may or may not be identical to that of the original. Thus, this is a distinct concept from the functionality of the
Copyableinterface. Classes that implement this interface must ensure that the object returned performs the same functionality, and that it does not share any state data that would be either unsafe or inefficient for concurrent access by multiple threads. The split method is allowed to simply return the this reference, provided that it is both safe and efficient for multiple threads to share a single copy of the Splittable object. The intention is to provide a multithreaded search with the capability to provide spawned threads with their own distinct search operators. Such multithreaded algorithms can call the split method for each thread it spawns to generate a functionally identical copy of the operator, but with independent state.