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.
-
Pop()
- Creates empty population.
-
Pop(int)
- Create a population of popSize individuals.
-
add(Ind)
- Receives an individual and adds it to the population.
-
add(Pop)
- Receives a new population and adds it to the old one.
-
calcFitness()
- Calculates the population total fitness.
-
crossOver()
- Choose two individuals randomly for cross-over operation.
-
crossOver(int, int)
- Receives two individuals, calls Function class method to perform the cross-over, and returns the newly created child.
-
getAvgFitness()
- Returns the population average fitness.
-
getBestInd()
- Returns the individual with the best fitness value.
-
getInd(int)
- Returns the individual in the 'pos' index.
-
reset()
- Deletes population.
-
size()
- Returns the population size.
Pop
public Pop()
- Creates empty population.
Pop
public Pop(int popSize)
- Create a population of popSize individuals.
getBestInd
public Ind getBestInd()
- Returns the individual with the best fitness value.
getAvgFitness
public double getAvgFitness()
- Returns the population average fitness.
calcFitness
public void calcFitness()
- Calculates the population total fitness.
reset
public void reset()
- Deletes population.
getInd
public Ind getInd(int pos)
- Returns the individual in the 'pos' index.
add
public void add(Ind ind)
- Receives an individual and adds it to the population.
add
public void add(Pop pop)
- Receives a new population and adds it to the old one.
size
public int size()
- Returns the population size.
crossOver
public Ind crossOver()
- Choose two individuals randomly for cross-over operation.
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