GA_INDIVIDUAL Function (PV-WAVE Advantage)
Creates a data structure from user supplied phenotypes.
Usage
result = GA_INDIVIDUAL (chromosome)
Input Parameters
chromosome—A chromosome data structure created by GA_CHROMOSOME. This structure is copied and stored in the returned individual’s data structure.
Returned Value
result—The GA_INDIVIDUAL function returns a data structure, which is required input to the
GA_POPULATION Function (PV-WAVE Advantage).
Input Keywords
Print—If present and nonzero, this option turns on printing of intermediate results. By default, intermediate results are not printed.
Gray_encoding—If present and nonzero, specifies alleles are encoded using Gray encoding for integer and real phenotypes. If undefined or zero, specifies alleles are encoded using Base-2 encoding for integer and real phenotypes. Default: Base-2 encoding.
Binary_phenotype—An array of length chromosome.N_binary, where N_binary is the number of binary phenotypes, containing the integer values for any binary phenotypes. This is a required argument when chromosome.N_binary > 0.
Nominal_phenotype—An array of length chromosome.N_nominal containing the integer values for any nominal phenotypes. This is a required argument when chromosome.N_nominal is greater than zero. The value of Nominal_phenotype(i) must be one of the integers 0, 1, ..., chromosome.n_categories(i) – 1.
Integer_phenotype—An array of length chromosome.N_integer containing the integer values for any integer phenotypes. This is a required argument when chromosome.N_integer > 0. The value of Integer_phenotype(i) must be an integer in the closed interval:
[chromosome.I_bounds(2i), chromosome.I_bounds(2i + 1)]
Real_phenotype—An array of length chromosome.N_real containing the floating point values for any real phenotypes. This is a required argument when chromosome.N_real is greater than zero. The value of Real_phenotype(i) must be a floating point value in the closed interval:
[chromosome.R_bounds(2i), chromosome.R_bounds(2i + 1)]
Double—If present and nonzero, then double precision is used.
Discussion
The
GENETIC_ALGORITHM Function (PV-WAVE Advantage) operates on a population of individuals. Individuals can be created automatically using
GA_RANDOM_POPULATION Function (PV-WAVE Advantage) or systematically using
GA_POPULATION Function (PV-WAVE Advantage). If the initial population is created using randomly selected individuals, then this function is not needed. However, if the initial population is to be constructed systematically, then the individuals for that population must first be created using this function.
This function takes the phenotype values in the keywords and creates a data structure. This structure contains a chromosome created by encoding the phenotypes into their respective allele representations using the chromosome map described in chromosome.
It also allows for incorporating parentage information for the individual, although this is typically not done for the individuals in the initial population.
Example
This example creates an individual using a chromosome with 1 binary, 2 nominals, 3 integers and 2 real phenotypes. The Print argument is used to print a description of the data structure. By default, Base-2 encoding is used for encoding integer and real phenotypes.
PRO ga_individual_ex1
n_binary = 1
n_nominal = 2
n_integer = 3
n_real = 2
; binary phenotype
binaryPhenotype = [ 1 ]
; number of categories for nomial phenotypes
n_categories = [2, 3]
; nominal phenotype values
nominalPhenotype = [1, 2]
; number of intervals and boundaries for integer
; phenotypes
i_intervals = [16, 16, 16]
i_bounds = [0, 1000, -10, 10, -20, 0]
; integer phenotype values
integerPhenotype = [200, -5, -5]
; number of intervals and boundaries for real
; phenotypes
r_intervals = [512, 1024]
r_bounds = [0.0, 20.0, -20.0, 20.0]
; real phenotype values
realPhenotype = [19.9, 19.9]
; Create the Chromosome Data Structure
chromosome = GA_CHROMOSOME( $
N_binary=n_binary, $
N_nominal=n_nominal, $
N_categories=n_categories, $
N_integer=n_integer, $
I_intervals=i_intervals, $
I_bounds=i_bounds, $
N_real=n_real, $
R_intervals=r_intervals, $
R_bounds=r_bounds)
; Create individual data structure
individual = GA_INDIVIDUAL(chromosome, $
Binary_phenotype=binaryPhenotype, $
Nominal_phenotype=nominalPhenotype, $
Integer_phenotype=integerPhenotype, $
Real_phenotype=realPhenotype, $
/Print)
END
Output
The Print option produced the following description of the individual. Summary starts with a detailed description of the chromosome. It consists of 34 alleles split among the phenotypes. The actual encoding of the phenotypes into alleles is shown below.
Bits assigned to binary phenotypes are not encoded. They are mapped directly into the first N_binary bits of the chromosome. In this case there is only one binary phenotype. It gets mapped into bit zero.
Following the binary phenotype are the nominal phenotypes. Each of these is also mapped into a single allele. However, unlike binary phenotypes, the alleles can assume values other than zero and one.
The integer and real phenotypes are discretized into sixteen interval values. These are then encoded into 4 bit Base-2 representations of the integers 0–15.
*******************************
**** INDIVIDUAL STRUCTURE *****
Number of Parents: 2
Encoding: BASE-2
*******************************
**** CHROMOSOME STRUCTURE *****
Chromosome length: 34 Bits
*****BIT ASSIGNMENTS***********
Binary: 0 - 0 n_binary = 1
Nominal: 1 - 2 n_nominal= 2
Integer: 3 - 14 n_integer= 3
Real: 15 - 33 n_real = 2
*******************************
********PHENOTYPES*************
BINARY*************************
Variable 0: 1
*******************************
NOMINAL************************
Variable 0: 1
Variable 1: 2
*******************************
INTEGER************************
Variable 0: 200
Variable 1: -5
Variable 2: -5
*******************************
REAL***************************
Variable 0: 19.9
Variable 1: 19.9
*******************************
**********CHROMOSOME**************************************
BINARY BITS: 1
NOMINAL ALLELES: 1 2
INTEGER BITS: 0 0 1 1 0 1 0 0 1 1 0 0
REAL BITS: 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1
**********************************************************
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.