the change in the gene pool over time
genes mutate randomly which introduces variation to gene pool
individuals survive through natural selection
populations evolve and breed via recombination
each gene is a binary digit
a chromosome is a single string of genes (digits)
a solution to a problem is encoded as a chromosome
encoding = representation
encoding must cover whole search space (gene pool)
fitness function uses to rate the solution the chromosome represents
NP-complete problem
given n items, each with a weight and value, determine the items to include in the knapsack so that the total weight is less than or equal to a given limit and the total value is as large as possible
eg. binary encoding where 1 - take item, 0 - don’t take the item and length - number of items we have to consider
invalid solution could be all 1s, means the weight limitation stated in the problem brief would be invalid
to deal with them
create only valid chromosomes from start by catering to conditions
create any solution and deal with validity afterwards
consider this when we create a representation
total value
low value = bad, high value - good, easy-to-compare solutions
invalid solutions can be given the total value = 0
create population of random chromosomes
each chromosome scored with fitness function
create a new generation through genetic operators - selection/ crossover/ mutation
repeat until complete - best solution found
one point crossover - Holland original
uniform crossover - improvement
chromosomes [with n genes] move to the crossover pool with CP chance
each chromosome is randomly paired with another chromosome (A and B)
for each pair, a crossover point P is randomly generated with a value between 2 and n-1
to create 2 children (C and D),
all genes from 1 → P from parent A are given to child C
all genes from 1 → P from parent B are given to child D
all genes from P+1 → n from parent A are given to child C
all genes from P+1 → n from parent B are given to child D
the children are added to the population
more powerful crossover where for each gene there is a 50% chance the child C will get the gene from parent A and 50% chance child C will get the gene from parent B. child D will get the gene from the opposing parent
each bit is treated separately instead of separating the whole chromosome into only 2 chunks.
eg. for parent 1, P1 has 50/50 chance to be for child 1 or 2
if it goes to child 1, child 2 gets the corresponding gene in parent 2
and vice versa
each bit [gene] of a chromosome is given a probability MP of inverting.
eg.
1 turns into 0
0 turns into 1