public class TSPGA extends GeneticAlgorithm<IntegerChromosome>
GeneticAlgorithm.ElitismStrategy, GeneticAlgorithm.ResizeStrategy, GeneticAlgorithm.Statistics
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 |
---|
TSPGA(double[][] matrix,
Population<IntegerChromosome> pop,
int genlimit) |
Modifier and Type | Method and Description |
---|---|
void |
evaluateIndividual(Individual<IntegerChromosome> individual)
Evaluates a single individual.
|
protected void |
randomizeIndividual(Individual<IntegerChromosome> individual)
Performs an individual randomization.
|
addAlgorithmEventListener, addGenerationEventListener, addStage, applyElitism, end, 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, randomizePopulation, removeAlgorithmEventListener, removeGenerationEventListener, setBiggerIsBetter, setElitism, setElitismStrategy, setFitness, setFullEvaluationForced, setGenerationLimit, setHistorySize, setRandomization, setRandomization, setRandomSeed, setResizeStrategy, setRunner, start, stop, toString, updateStatistics
public TSPGA(double[][] matrix, Population<IntegerChromosome> pop, int genlimit)
public void evaluateIndividual(Individual<IntegerChromosome> individual)
GeneticAlgorithm
Fitness
, this method calls Fitness.evaluate(jenes.population.Individual)
method, otherwise method requiring an implementation by the sublass.
evaluateIndividual
in class GeneticAlgorithm<IntegerChromosome>
individual
- the individual to be evaluatedprotected void randomizeIndividual(Individual<IntegerChromosome> individual)
GeneticAlgorithm
GeneticAlgorithm.randomizePopulation(Population)
. By default randomization is
delegated to the individual. In some problems, it would be useful to
control the randomization process of individual. This is especially the
case of when there are some constraints on genes in order to make the
individual valid.
randomizeIndividual
in class GeneticAlgorithm<IntegerChromosome>
individual
- the individual to be randomize