Hide Comments
Hide Comments

Comments (0)

Represents one individual, or candidate solution, in the Population of solutions in a genetic algorithm problem. In genetic algorithms ( RSGeneticAlgorithm.TRSGeneticAlgorithm component), there is a population of individuals ( RSGeneticAlgorithm.TRSGAPopulation ), which contain chromosomes (  Bits property). These chromosomes are used to abstractly represent the solution to the search problem. They represent through their bits the DNA of each candidate solution (or individual), represented by a TRSGAIndividual class. The chromosomes are created by taking the parameters or factors (integers, booleans, floats, and enumerations) of your search problem and concatenating them together into a sequence of bits.Genetic Algorithms then work by evolving your population towards the solution of the problem. Parents are selected from the current generation to reproduce the children of the next generation. Evolving a new generation involves:

Selecting 2 parents (Individuals) to reproduce
Splicing the chromosomes of the 2 parents together to make a child (the child inherits the parents chromosomes)
Optionally Mutating and Inverting the chromosome of the child to provide randomness
Repeating the above steps until the population of the new generation has been produced.

After the new generation is bred, genetic algorithms looks at the new population to see if any of the individuals solve the problem. In genetic algorithms terms, this usually means evaluating the "fitness" of each individual (a numeric score that measures the ability of the individual). If any individual is "fit enough", the evolutionary search stops.
 

Namespace: RSGeneticAlgorithm

expandingInheritance Hierarchy

TCollectionItem
  RSGeneticBase.TRSIndividual
    RSGeneticAlgorithm.TRSGAIndividual
 

expandingSyntax

Delphi

type
  TRSGAIndividual = class(TRSIndividual)
  end; 
 

expandingConstructors

 

Name

Description

public constructor

Create(TCollection)

Initializes a new instance of the TRSGAIndividual class. (Overrides RSGeneticBase.TRSIndividual.Create(TCollection).)

public destructor

Destroy

Represents the destructor of the TRSGAIndividual class. (Overrides RSGeneticBase.TRSIndividual.Destroy.)

Top

expandingProperties

 

Name

Description

public property

AdjustedFitness

Represents property AdjustedFitness. (Inherited from RSGeneticBase.TRSIndividual.)

public property

Bits

Represents the individual's chromosome, or DNA. These bits are created by taking the parameters or factors (integers, booleans, floats, and enumerations) of your search problem and concatenating them together into a sequence of bits to create the chromosome. The   Genes of the RSGeneticAlgorithm.TRSGeneticAlgorithm component represent the encoding of the bits for all the individuals.
 

public property

Collection

Returns the population that this individual belongs to.
 

public property

Fitness

The Fitness property is a floating point value that specifies the correctness of the individual DNA. Fitness is used by the genetic components to decide which individuals are better than others. Fitness is a score you define for every individual using an     OnEvaluateFitness event handler. It may be any floating point number. However, fitness must have relative meaning among the entire range of assigned fitness numbers, e.g., a fitness of -10 must be worse than a fitness of -3 which must be worse than a fitness of 5, etc (or vice versa, the     FitnessMethod property tells the genetic component whether lower or higher numbers are desirable). The     NormalizedFitness value is the fitness of the individual normalized over the entire population's fitness values so that it is a value between 0 and 1 (where 0 will be the individual with the lowest fitness and 1 will be the individual with the highest fitness).

Using each individual's calculated fitness and the FitnessMethod, the genetic component will seek to either maximize the solution (e.g., keep evolving for individuals whose fitness are greater than other individuals in the population) or to minimize the solution (e.g., find the individuals whose fitness are less than other individuals).
 

published property

Name

Allows you to provide a descriptive name for the individual. The genetics components do not use this property. (Inherited from RSGeneticBase.TRSIndividual.)

protected property

NeedFitness

Represents property NeedFitness. (Inherited from RSGeneticBase.TRSIndividual.)

public property

NormalizedFitness

Returns the Fitness of the individual normalized over the entire population's fitness values so that it is a value between 0 and 1 (where 0 will be the individual with the lowest fitness and 1 will be the individual with the highest fitness).
 (Inherited from RSGeneticBase.TRSIndividual.)

public property

NormalizedWeigthedFitness

Returns the   WeightedFitness of the individual normalized over the entire population's weighted fitness values so that it is a value between 0 and 1 (where 0 will be the individual with the lowest weighted fitness and 1 will be the individual with the highest weighted fitness). (Inherited from RSGeneticBase.TRSIndividual.)

public property

WeightedFitness

Returns the Fitness value weighted by some function. Use the RSGeneticBase.TRSCustomGeneticComponent.OnEvaluateWeightedFitness event to specify the weighting.

The genetic components can guide the search for the best individual by using the weighted fitness instead of the regular fitness. The weighted fitness allows optimization for something other than the pure fitness. For example, with genetic programming, the weighted fitness can be used to weight the fitness for smaller programs. The     FitnessMethod specifies whether the Fitness or the WeightedFitness is used in the search.

Note that the Fitness is always used for determining if we have found the "best" individual for termination purposes.

Top

expandingMethods

 

Name

Description

public method

Assign(TPersistent)

Represents method Assign(TPersistent). (Overrides RSGeneticBase.TRSIndividual.Assign(TPersistent).)

public method

Clone

Returns an exact copy of the current individual. (Inherited from RSGeneticBase.TRSIndividual.)

protected method

CreateDNA

Represents method CreateDNA.

public method

EvaluateFitness

Evaluates the     Fitness of the individual. The fitness function is supplied in the RSGeneticBase.TRSCustomGeneticComponent.OnEvaluateFitness event.

Normally, the Fitness is only evaluated if the individual is modified. This function forces evaluation.

protected method

GetDisplayName

Represents method GetDisplayName. (Inherited from RSGeneticBase.TRSIndividual.)

public method

LoadFromXML(IXMLChromosome)

Overloaded. Reads the individual's chromosome from the XML description of the chromosome

public method

LoadFromXML(IXMLNode)

Overloaded. Reads the individual's data from the XML node (Overrides RSGeneticBase.TRSIndividual.LoadFromXML(IXMLNode).)

public method

Modified

Informs the object that you have modified it so that its Fitness must be reevaluated (Inherited from RSGeneticBase.TRSIndividual.)

public method

SaveToXML(IXMLChromosome)

Overloaded. Saves an XML description of its chromosome into the ChromosomeXML parameter

public method

SaveToXML(IXMLNode)

Overloaded. Writes the individual's data to the XML node (Overrides RSGeneticBase.TRSIndividual.SaveToXML(IXMLNode).)

Top

expandingFields

 

Name

Description

protected field

FFitness

Represents field FFitness. (Inherited from RSGeneticBase.TRSIndividual.)

Top

expandingSee Also

Comments (0)