All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class geneticAlgorithm.Pop

java.lang.Object
   |
   +----geneticAlgorithm.Pop

public class Pop
extends Object
implements Serializable
Class Pop is responsible for maintaning a vector of individuals and their total fitness value. Problem dependent methods are done by calling the Function class methods.


Constructor Index

 o Pop()
Creates empty population.
 o Pop(int)
Create a population of popSize individuals.

Method Index

 o add(Ind)
Receives an individual and adds it to the population.
 o add(Pop)
Receives a new population and adds it to the old one.
 o calcFitness()
Calculates the population total fitness.
 o crossOver()
Choose two individuals randomly for cross-over operation.
 o crossOver(int, int)
Receives two individuals, calls Function class method to perform the cross-over, and returns the newly created child.
 o getAvgFitness()
Returns the population average fitness.
 o getBestInd()
Returns the individual with the best fitness value.
 o getInd(int)
Returns the individual in the 'pos' index.
 o reset()
Deletes population.
 o size()
Returns the population size.

Constructors

 o Pop
 public Pop()
Creates empty population.

 o Pop
 public Pop(int popSize)
Create a population of popSize individuals.

Methods

 o getBestInd
 public Ind getBestInd()
Returns the individual with the best fitness value.

 o getAvgFitness
 public double getAvgFitness()
Returns the population average fitness.

 o calcFitness
 public void calcFitness()
Calculates the population total fitness.

 o reset
 public void reset()
Deletes population.

 o getInd
 public Ind getInd(int pos)
Returns the individual in the 'pos' index.

 o add
 public void add(Ind ind)
Receives an individual and adds it to the population.

 o add
 public void add(Pop pop)
Receives a new population and adds it to the old one.

 o size
 public int size()
Returns the population size.

 o crossOver
 public Ind crossOver()
Choose two individuals randomly for cross-over operation.

 o crossOver
 public Ind crossOver(int pos1,
                      int pos2)
Receives two individuals, calls Function class method to perform the cross-over, and returns the newly created child.


All Packages  Class Hierarchy  This Package  Previous  Next  Index