private class AggarwalYuEvolutionary.EvolutionarySearch extends Object
Modifier and Type | Field and Description |
---|---|
(package private) int |
dbsize
Database size
|
(package private) int |
dim
Database dimensionality
|
(package private) int |
m
m to use.
|
private Random |
random
random generator
|
(package private) ArrayList<ArrayList<DBIDs>> |
ranges
Database ranges
|
Constructor and Description |
---|
AggarwalYuEvolutionary.EvolutionarySearch(Relation<V> database,
ArrayList<ArrayList<DBIDs>> ranges,
int m,
Long seed)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
checkConvergence(Collection<AggarwalYuEvolutionary.Individuum> pop)
check the termination criterion
|
private AggarwalYuEvolutionary.Individuum |
combineRecursive(ArrayList<Integer> r,
int i,
int[] current,
AggarwalYuEvolutionary.Individuum parent1,
AggarwalYuEvolutionary.Individuum parent2)
Recursive method to build all possible gene combinations using positions
in r.
|
private ArrayList<AggarwalYuEvolutionary.Individuum> |
crossoverOptimized(ArrayList<AggarwalYuEvolutionary.Individuum> population)
method implements the crossover algorithm
|
private ArrayList<AggarwalYuEvolutionary.Individuum> |
initialPopulation(int popsize)
Produce an initial (random) population.
|
private AggarwalYuEvolutionary.Individuum |
makeIndividuum(int[] gene)
Make a new individuum helper, computing sparsity=fitness
|
private ArrayList<AggarwalYuEvolutionary.Individuum> |
mutation(ArrayList<AggarwalYuEvolutionary.Individuum> population,
double perc1,
double perc2)
method implements the mutation algorithm
|
private Pair<AggarwalYuEvolutionary.Individuum,AggarwalYuEvolutionary.Individuum> |
recombineOptimized(AggarwalYuEvolutionary.Individuum parent1,
AggarwalYuEvolutionary.Individuum parent2)
Recombination method.
|
private ArrayList<AggarwalYuEvolutionary.Individuum> |
rouletteRankSelection(ArrayList<AggarwalYuEvolutionary.Individuum> population)
the selection criterion for the genetic algorithm:
roulette wheel mechanism: where the probability of sampling an individual of the population was proportional to p - r(i), where p is the size of population and r(i) the rank of i-th individual |
Collection<AggarwalYuEvolutionary.Individuum> |
run() |
final int dbsize
final int dim
final int m
private final Random random
public Collection<AggarwalYuEvolutionary.Individuum> run()
private boolean checkConvergence(Collection<AggarwalYuEvolutionary.Individuum> pop)
private ArrayList<AggarwalYuEvolutionary.Individuum> initialPopulation(int popsize)
popsize
- Population sizeprivate ArrayList<AggarwalYuEvolutionary.Individuum> rouletteRankSelection(ArrayList<AggarwalYuEvolutionary.Individuum> population)
population
- private ArrayList<AggarwalYuEvolutionary.Individuum> mutation(ArrayList<AggarwalYuEvolutionary.Individuum> population, double perc1, double perc2)
private AggarwalYuEvolutionary.Individuum makeIndividuum(int[] gene)
gene
- Gene to evaluateprivate ArrayList<AggarwalYuEvolutionary.Individuum> crossoverOptimized(ArrayList<AggarwalYuEvolutionary.Individuum> population)
private Pair<AggarwalYuEvolutionary.Individuum,AggarwalYuEvolutionary.Individuum> recombineOptimized(AggarwalYuEvolutionary.Individuum parent1, AggarwalYuEvolutionary.Individuum parent2)
parent1
- First parentparent2
- Second parentprivate AggarwalYuEvolutionary.Individuum combineRecursive(ArrayList<Integer> r, int i, int[] current, AggarwalYuEvolutionary.Individuum parent1, AggarwalYuEvolutionary.Individuum parent2)
r
- valid positions to usei
- Offset in r to start at.current
- Current geneparent1
- First parentparent2
- Second parent