jenes.tutorials.problem3
Class TSPGA

java.lang.Object
  extended by jenes.GeneticAlgorithm<IntegerChromosome>
      extended by jenes.tutorials.problem3.TSPGA

public class TSPGA
extends GeneticAlgorithm<IntegerChromosome>

Tutorial showing how to implement problem specific operators. The problem faced in this example is the well known Tavel Salesman Problem (TSP) This class implements the algorithm.

Since:
1.0
Version:
1.0
Author:
Luigi Troiano, Pierpaolo Lombardi

Nested Class Summary
 
Nested classes/interfaces inherited from class jenes.GeneticAlgorithm
GeneticAlgorithm.ElitismStrategy, GeneticAlgorithm.ResizeStrategy, GeneticAlgorithm.Statistics
 
Field Summary
 
Fields inherited from class jenes.GeneticAlgorithm
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 Summary
TSPGA(double[][] matrix, Population<IntegerChromosome> pop, int genlimit)
           
 
Method Summary
 void evaluateIndividual(Individual<IntegerChromosome> individual)
          Evaluates a single individual.
protected  void randomizeIndividual(Individual<IntegerChromosome> individual)
          Performs an individual randomization.
 
Methods inherited from class jenes.GeneticAlgorithm
addAlgorithmEventListener, addGenerationEventListener, addStage, applyElitism, end, evaluatePopulation, evaluatePopulation, evolve, evolve, evolve, getBody, getCurrentPopulation, getElitism, getElitismStrategy, getGeneration, getGenerationLimit, getHistoryAt, getHistorySize, getInitialPopulation, getNextPopulation, getRandomization, getResizeStrategy, getStatistics, isBiggerBetter, isFullEvaluationForced, onGeneration, onInit, onStart, onStop, randomizePopulation, removeAlgorithmEventListener, removeGenerationEventListener, setBiggerIsBetter, setElitism, setElitismStrategy, setFullEvaluationForced, setGenerationLimit, setHistorySize, setRandomization, setRandomization, setResizeStrategy, start, stop, toString, updateStatistics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TSPGA

public TSPGA(double[][] matrix,
             Population<IntegerChromosome> pop,
             int genlimit)
Method Detail

evaluateIndividual

public void evaluateIndividual(Individual<IntegerChromosome> individual)
Description copied from class: GeneticAlgorithm
Evaluates a single individual. This evaluation of individuals is specifically related to the problem to solve, thus it is an abstract method requiring an implementation by the sublass.

Specified by:
evaluateIndividual in class GeneticAlgorithm<IntegerChromosome>
Parameters:
individual - the individual to be evaluated

randomizeIndividual

protected void randomizeIndividual(Individual<IntegerChromosome> individual)
Description copied from class: GeneticAlgorithm
Performs an individual randomization. It is invoked by 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.

Overrides:
randomizeIndividual in class GeneticAlgorithm<IntegerChromosome>
Parameters:
individual - the individual to be randomize