﻿ SetOperators

# SetOperators

Navigation:  »No topics above this level«

# SetOperators

 SetOperators(Population As Integer, CrossoverType As Integer, CrossoverRate As Single, MutationRate As Single)   Purpose: This function sets the parameters of the basic GeneHunter operators required for continuous/integer chromosomes.   Arguments: Population is the number of the population for which you are going to set the parameters of the operators. CrossoverType Only one crossover type is currently implemented: simple continuous crossover.  Use the value of 1 for this type, or the symbolic constant SIMPLE_CONT_CROSS, defined in the module GALIB32.BAS. CrossoverRate is the rate of crossover, i.e., the probability that the crossover operator will be applied to a chromosome.  This probability is calculated per chromosome.  If an individual in the population has a number of chromosomes, the probability of crossover per individual is given by the expression:   total crossover rate = 1-(1-crossover rate)^n   where total crossover rate is the probability of crossover per individual; crossover rate is the probability of crossover per chromosome; and n is the number of chromosomes per individual.  Usually, values of crossover rate in the range 0.8-1.0 are appropriate, and the value 0.9 is recommended. MutationRate is the rate of mutation per bit in a chromosome.  Chromosomes can have different bit resolutions, so the probability of mutation per chromosome is given by the expression:   total mutation rate = 1-(1-mutation rate)^k   where total mutation rate is the probability of chromosome mutation; mutation rate is the rate of mutation per bit; and k is the number of bits in a chromosome (8, 16 or 32).  The probability of the mutation of an individual is calculated by:   total mutation rate = 1-(1-mutation rate)^k   but k in this case stands for the total number of bits in the representations of all chromosomes of an individual.  In other words, if there are 10 8-bit chromosomes, then K = 8 * 10 = 80.  Usually, values of mutation rate 0.001-0.01 are appropriate.  The value 0.01 is recommended when using the elitist strategy, otherwise, use the value 0.005.   Example: i = SetOperators(PopNum, SIMPLE_CONT_CROSS, 0.9, 0.003)   This example sets the parameters of the GeneHunter operators for the population PopNum.  The crossover type is simple continuous.  The crossover rate will be 0.9; the mutation rate will be 0.003.   Related Functions: SetEnumOperators, SetStrategy