<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«


Return to chapter overview


PutChromosome(Population As Integer, Individual As Integer, Chromosome As Integer, ChromoValue As Single)


Purpose: This function sets a chromosome to a specified value from a variable in your program.  Use PutChromosome when you want to start from a predetermined state of chromosomes in the population (e.g. to continue using a previously saved population).  Normally, you will not have to use PutChromosome because GeneHunter initializes chromosomes to random values when MakeChromosome is called.



Population is the number of the population with which you are working.

Individual is the number of the individual whose chromosome value you want to set.  Individual numbers start with 0.

Chromosome is the number of the chromosome whose value you want to set.  Chromosome numbers start with 0.

ChromoValue is a variable in your program where the value of the chromosome to be passed is stored.  If the chromosome is of the integer type, then the ChromoValue will be rounded to the nearest integer in the range [MinValue, MaxValue].


Example: i = PutChromosome(PopNum, 0, 1, ChromoVal)


This example sets chromosome 1 of individual 0 in the population whose number is stored in the PopNum variable, to the value stored in the single ChromoVal variable.


Related Functions: GetChromosome, MakeChromosome