These pages are auto-generated from self-documenting comments embedded in class files.
For more information on breve and steve, refer to the breve homepage.

Object : GeneticAlgorithmIndividual

This class is included as part of the file GeneticAlgorithm.tz.
To use this class in a simulation, include the line "@use GeneticAlgorithm."

Class description:

This object represents a single individual in a GeneticAlgorithm. To use the class GeneticAlgorithm, you must also implement a custom subclass of this class. Your custom subclass should contain the variables which will represent the genes for the genetic algorithm, and must also implement a few methods used for genetic operators.

At a very minimum, you must implement your own versions of the methods compute-fitness, copy and mutate. If you intend to use the crossover genetic operator, you must also implement the method crossover. If these methods are not implemented by your subclass, the object will trigger a runtime error.

Class methods:

Methods to Override in Custom Subclasses


copy from otherIndividual (object)

Implement this method to copy the genes from otherIndividual. This method must be implemented by your subclass.


crossover from-parent1 parent1 (object) from-parent2 parent2 (object)

Implement this method to make this object become a crossover of parent1 and parent2. This method must be implemented by your subclass if crossover is enabled.


get-fitness

Returns the fitness value associated with this individual, which has been previously assigned using set-fitness.


mutate

Implement this method to mutate the genes of this object. This method must be implemented by your subclass.


randomize

Implement this method to randomize the genes of this object. This method must be implemented by your subclass.


set-fitness to fitnessValue (double)

Assigns a fitness value to this individual. This method should be called by the user at the end of the fitness test.


Documentation created Sun Oct 7 19:13:02 2007