public class IslandGA<T extends Chromosome> extends GeneticAlgorithm<T>
Modifier and Type | Class and Description |
---|---|
static class |
IslandGA.Graph
The Graph represent the paths between islands in the algorithm landscape
|
static class |
IslandGA.ReplacementStrategy
The elitism strategy enumeration
|
GeneticAlgorithm.ElitismStrategy, GeneticAlgorithm.ResizeStrategy, GeneticAlgorithm.Statistics
Modifier and Type | Field and Description |
---|---|
static IslandGA.Graph |
DEFAULT_GEOGRAPHY
The default topology connecting islands
|
static int |
DEFAULT_MIGRATION
The default migration rate between islands
|
static int |
DEFAULT_NICHES
The default number of niches
|
static IslandGA.ReplacementStrategy |
DEFAULT_REPLACEMENT
The default replacement strategy
|
algorithmListeners, body, DEFAULT_GENERATION_LIMIT, DEFAULT_HISTORY_SIZE, elitism, elitismStrategy, fullEvaluationForced, generation, generationLimit, generationListeners, initialPopulation, MAX_HISTORY_SIZE, MIN_HISTORY_SIZE, random, randomization, resizeStrategy, statistics
Constructor and Description |
---|
IslandGA(Fitness fitness)
Creates a IslandGA instance
|
IslandGA(Fitness fitness,
Population<T> population)
Creates a IslandGA instance
|
IslandGA(Fitness fitness,
Population<T> population,
int genlimit)
Creates a IslandGA instance
|
IslandGA(Fitness fitness,
Population<T> population,
int genlimit,
int niches)
Creates a IslandGA instance
|
IslandGA(Fitness fitness,
Population<T> population,
int genlimit,
int niches,
GeneticAlgorithm<T> algo)
Creates a IslandGA instance with an empty fitness
|
IslandGA(Fitness fitness,
Population<T> population,
int genlimit,
int niches,
GeneticAlgorithm<T> algo,
int migration)
Creates a IslandGA instance with an empty fitness
|
IslandGA(Fitness fitness,
Population<T> population,
int genlimit,
int niches,
GeneticAlgorithm<T> algo,
int migration,
IslandGA.Graph geography)
Creates a IslandGA instance
|
IslandGA(Fitness fitness,
Population<T> population,
int genlimit,
int niches,
GeneticAlgorithm<T> algo,
int migration,
IslandGA.Graph geography,
IslandGA.ReplacementStrategy rp)
Creates a IslandGA instance
|
IslandGA(Fitness fitness,
Population<T> population,
int genlimit,
int niches,
int migration)
Creates a IslandGA instance
|
IslandGA(Fitness fitness,
Population<T> population,
int genlimit,
int niches,
int migration,
IslandGA.Graph geography)
Creates a IslandGA instance
|
IslandGA(Fitness fitness,
Population<T> population,
int genlimit,
int niches,
int migration,
IslandGA.Graph geography,
IslandGA.ReplacementStrategy rp)
Creates a IslandGA instance
|
Modifier and Type | Method and Description |
---|---|
GeneticAlgorithm<T>[] |
getAllIslands()
Gets the list of algorithms used for the different islands
|
IslandGA.Graph |
getGeography()
Return the topology connecting islands
|
int |
getMigration()
Returns the migration rate
|
int |
getNiches()
Returns the number of niches
|
IslandGA.ReplacementStrategy |
getReplacement()
Returns the replacement strategy
|
protected void |
migrate(Population<T>[] branches)
Performs migration of individuals between islands
|
protected void |
populateNiches()
Distributes individuals among islands by setting their speciem
|
void |
setAllIslands(GeneticAlgorithm<T> algo)
Sets the algorithm for all islands
|
void |
setBiggerIsBetter(boolean flag)
Sets the algorithm's body objective to maximize (true) or minimize
(false) the individual fitness.
|
void |
setElitism(int elitism)
Sets the elitism for all the islands
|
void |
setGeography(IslandGA.Graph geography)
Sets the topology
|
void |
setIsland(int i,
GeneticAlgorithm<T> algo)
Sets the algorithm for a specific island
|
void |
setMigration(int migration)
Sets the migration rate
|
void |
setNiches(int niches)
Sets the number of niches
|
void |
setReplacement(IslandGA.ReplacementStrategy replacement)
Sets the replacement stategy
|
addAlgorithmEventListener, addGenerationEventListener, addStage, applyElitism, end, evaluateIndividual, evaluatePopulation, evaluatePopulation, evolve, evolve, evolve, getBody, getCurrentPopulation, getElitism, getElitismStrategy, getFitness, getGeneration, getGenerationLimit, getHistoryAt, getHistorySize, getInitialPopulation, getLastPopulation, getNextPopulation, getPool, getRandomization, getResizeStrategy, getRunner, getStatistics, isBiggerBetter, isFitnessChanged, isFullEvaluationForced, onGeneration, onInit, onStart, onStop, randomizeIndividual, randomizePopulation, removeAlgorithmEventListener, removeGenerationEventListener, setElitismStrategy, setFitness, setFullEvaluationForced, setGenerationLimit, setHistorySize, setRandomization, setRandomization, setRandomSeed, setResizeStrategy, setRunner, start, stop, toString, updateStatistics
public static final int DEFAULT_NICHES
public static final int DEFAULT_MIGRATION
public static final IslandGA.Graph DEFAULT_GEOGRAPHY
public static final IslandGA.ReplacementStrategy DEFAULT_REPLACEMENT
public IslandGA(Fitness fitness)
fitness
- public IslandGA(Fitness fitness, Population<T> population)
fitness
- the fitness objectpopulation
- initial populationgenlimit
- the generation limitniches
- the number of nichesmigration
- the migration rategeography
- topology connecting islandsrp
- replacement strategypublic IslandGA(Fitness fitness, Population<T> population, int genlimit)
fitness
- the fitness objectpopulation
- initial populationgenlimit
- the generation limitpublic IslandGA(Fitness fitness, Population<T> population, int genlimit, int niches)
fitness
- the fitness objectpopulation
- initial populationgenlimit
- the generation limitniches
- the number of nichespublic IslandGA(Fitness fitness, Population<T> population, int genlimit, int niches, int migration)
fitness
- the fitness objectpopulation
- initial populationgenlimit
- the generation limitniches
- the number of nichesmigration
- the migration ratepublic IslandGA(Fitness fitness, Population<T> population, int genlimit, int niches, int migration, IslandGA.Graph geography)
fitness
- the fitness objectpopulation
- initial populationgenlimit
- the generation limitniches
- the number of nichesmigration
- the migration rategeography
- topology connecting islandspublic IslandGA(Fitness fitness, Population<T> population, int genlimit, int niches, int migration, IslandGA.Graph geography, IslandGA.ReplacementStrategy rp)
fitness
- the fitness objectpopulation
- initial populationgenlimit
- the generation limitniches
- the number of nichesmigration
- the migration rategeography
- topology connecting islandsrp
- replacement strategypublic IslandGA(Fitness fitness, Population<T> population, int genlimit, int niches, GeneticAlgorithm<T> algo)
fitness
- the fitness objectpopulation
- initial populationgenlimit
- the generation limitniches
- the number of nichesalgo
- the algorithm to be used for all nichespublic IslandGA(Fitness fitness, Population<T> population, int genlimit, int niches, GeneticAlgorithm<T> algo, int migration)
fitness
- the fitness objectpopulation
- initial populationgenlimit
- the generation limitniches
- the number of nichesalgo
- the algorithm to be used for all nichesmigration
- the migration ratepublic IslandGA(Fitness fitness, Population<T> population, int genlimit, int niches, GeneticAlgorithm<T> algo, int migration, IslandGA.Graph geography)
fitness
- the fitness objectpopulation
- initial populationgenlimit
- the generation limitniches
- the number of nichesalgo
- the algorithm to be used for all nichesmigration
- the migration rategeography
- topology connecting islandspublic IslandGA(Fitness fitness, Population<T> population, int genlimit, int niches, GeneticAlgorithm<T> algo, int migration, IslandGA.Graph geography, IslandGA.ReplacementStrategy rp)
fitness
- the fitness objectpopulation
- initial populationgenlimit
- the generation limitniches
- the number of nichesalgo
- the algorithm to be used for all nichesmigration
- the migration rategeography
- topology connecting islandsrp
- replacement strategypublic void setElitism(int elitism)
setElitism
in class GeneticAlgorithm<T extends Chromosome>
elitism
- public void setIsland(int i, GeneticAlgorithm<T> algo)
i
- island indexalgo
- algorithmpublic void setAllIslands(GeneticAlgorithm<T> algo)
algo
- algorithmpublic GeneticAlgorithm<T>[] getAllIslands()
protected void populateNiches()
protected void migrate(Population<T>[] branches)
branches
- public final IslandGA.Graph getGeography()
public void setGeography(IslandGA.Graph geography)
geography
- public final int getMigration()
public void setMigration(int migration)
migration
- public final int getNiches()
public void setNiches(int niches)
niches
- public final IslandGA.ReplacementStrategy getReplacement()
public void setReplacement(IslandGA.ReplacementStrategy replacement)
replacement
- public void setBiggerIsBetter(boolean flag)
GeneticAlgorithm
setBiggerIsBetter
in class GeneticAlgorithm<T extends Chromosome>
flag
- true to set the body to maximize the fitness, false to
minimize