SciLib.Neuro
Class Population

java.lang.Object
  extended by SciLib.Neuro.Population

public class Population
extends java.lang.Object

This class defines a Population class that contains a genetic algorithm.


Field Summary
(package private)  FunctionmD f
           
 
Constructor Summary
Population()
          default constructor
 
Method Summary
 double averageFitness()
          Compute the average fitness
 void computeTheBest()
          Generate theBestGen for all variables
 void crossover()
          Crossover selection: selects two parents that take part in the crossover.
 void elitist()
          Elitist function: If the best member of the current generation is worse then the best member of the previous generation, the latter one would replace the worst member of the current population
 void evaluate()
          evaluate the fitness
 void Evolution()
          Evolution process
 void genFunction(FunctionmD func)
          generate Problem Function
 vector getBestGen()
          get the best generation vector
 matrix getChromosome()
          get the chromosome matrix
 vector getFitness()
          get the fitness vector
 double getNumGen()
          get tne maximum number of generations
 int getNumVar()
          get tne number of variables
 double getpMutation()
          get the probability of mutation
 int getpopSize()
          get tne population size
 double getpxOver()
          get the probability of crossover
 double getTheBest()
          get theBest value
 void initialize()
          Initialize the population
 void mutate()
          Mutation: Random uniform mutation.
 void nextGeneration()
          generate next generation
 void read(java.lang.String fileName)
          Read a data file that contains information about a problem File format Number of variables : nVar Number of populations : nPop Maximum generations : maxGen probability of crossover : pxOver probability of mutation : pMutation Upper Limit : upper[i] Lower Limit : lower[i]
 double stddveFitness()
          Compute the standard deviation fitness
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

f

FunctionmD f
Constructor Detail

Population

public Population()
default constructor

Method Detail

getTheBest

public double getTheBest()
get theBest value

Returns:
A double value

getNumVar

public int getNumVar()
get tne number of variables

Returns:
An integer value

getpopSize

public int getpopSize()
get tne population size

Returns:
An integer value

getNumGen

public double getNumGen()
get tne maximum number of generations

Returns:
A double value

getpxOver

public double getpxOver()
get the probability of crossover

Returns:
A double value

getpMutation

public double getpMutation()
get the probability of mutation

Returns:
A double value

getChromosome

public matrix getChromosome()
get the chromosome matrix

Returns:
A matrix

getFitness

public vector getFitness()
get the fitness vector

Returns:
A vector

getBestGen

public vector getBestGen()
get the best generation vector

Returns:
A vector

genFunction

public void genFunction(FunctionmD func)
generate Problem Function


read

public void read(java.lang.String fileName)
Read a data file that contains information about a problem File format Number of variables : nVar Number of populations : nPop Maximum generations : maxGen probability of crossover : pxOver probability of mutation : pMutation Upper Limit : upper[i] Lower Limit : lower[i]


initialize

public void initialize()
Initialize the population


computeTheBest

public void computeTheBest()
Generate theBestGen for all variables


elitist

public void elitist()
Elitist function: If the best member of the current generation is worse then the best member of the previous generation, the latter one would replace the worst member of the current population


evaluate

public void evaluate()
evaluate the fitness


nextGeneration

public void nextGeneration()
generate next generation


crossover

public void crossover()
Crossover selection: selects two parents that take part in the crossover. Implements a single point crossover


mutate

public void mutate()
Mutation: Random uniform mutation. A variable selected for mutation is replaced by a random value between lower and upper bounds of this variable


Evolution

public void Evolution()
Evolution process


averageFitness

public double averageFitness()
Compute the average fitness

Returns:
a double value

stddveFitness

public double stddveFitness()
Compute the standard deviation fitness

Returns:
a double value