Docsity

Evolutionary Computation for Problem Solving - Artificial Intelligence | CPSC 481, Study notes of Computer Science

Partial preview of the text

Download Evolutionary Computation for Problem Solving - Artificial Intelligence | CPSC 481 and more Study notes Computer Science in PDF only on Docsity!

Artificial Intelligence

CPSC 481

Evolutionary Computation for

Problem Solving , Learning , and

Creativity

Lecture Overview

 Molecular biology basics for computer scientists

 Evolutionary approaches

 Problem solving using biological metaphor such as DNA,

evolution, survival of fitness

 Genetic algorithm

 Genetic programming

 Supervised learning and symbolic regression

How are Proteins Created in Cells?

Central Dogma of Molecular Biology

 DNA (code of life)  RNA (mRNA) through transcription or copy

 Amino acid through translation or protein synthesis

 DNA in 1 D medium (linear sequence of characters) is translated

into 3D structure of proteins by Ribosomes

 In fact, this whole process happens in 4D with timing, e.g., 1D 

3D structure plus time (4D)

 Basis of modern molecular biology

 What does DNA contain and where is it located?

DNA as Complex Computer Software

 DNA is very complex source code (code of life but semantics are not known)

of functional body of life (like a complex computer system, OS, DBMS, etc.)

 A Human DNA is comprised of approximately three billion base pairs.  DNA is 1 D but functional proteins are 4D (structures + timings determine functions)

 DNA and computer analogy

 Each base pair of the DNA alphabet, A, T, G, C): a binary bit in an
instruction
 A codon for an instruction (or a gene for a statement in source code)
 Direction of DNA translation: a sequence of statements (order of
execution)
 Action of a protein: execution of an instruction
 A group of genes (corresponds to an organism): a function or module
 DNA repair (using redundancy): automatic debugging, checksum
(hamming code) for fixing transmission errors, software verification.
 Variations in genes using genetic operators or evolution: modifications of
statements for different effects or functions during software
maintenance/migration 7

Evolution by Natural Selection

 Genome and heredity

 Genome is a complete set of chromosomes for a specie. Half of the
genome (DNA) is passed from parent to child. Thus, heredity is passed
through the genome.

 Genetic variation in a population is

 the result of principal forces: mutation , crossover (sexual
recombination) of genetic code (DNA).

 Evolution is achieved by

 Inheritance by reproduction and crossover + the result of natural
selection or survival of the fittest achieved through genetic variation
over multiple generations.

 What do these DNA and evolution have to do with

problem solving in AI?

Evolutionary Algorithms/Computation

 Idea of evolving computer programs is almost as old as the

computer itself [Friedberg, 1958].

 The idea of automatic programming is natural, once you have learned how complex and tedious manual programming is.

 The general term “ evolutionary computation ( EC ) ”, or “evolutionary

algorithms (EA)” has emerged for these techniques.

 Basic idea of evolutionary algorithms

 Generation of initial solutions (based on a priori knowledge, results of earlier run, or random)—initial population Loop : evaluate and select them by fitness function to determine:  If the solution(s) is (are) sufficiently good, then Stop and Return the solution(s)  Else Generation of variants by genetic operators, mutation and crossover  Stop if the specified cycles for next generation is reached.

 Many variants to ECs were proposed. The two most popular ones are:

Genetic Algorithm (GA) and Genetic Programming (GP).

Genetic Algorithms (GA)

 First introduced by Holland and his colleagues at the University of Michigan,

 A population, P(t) = {x t 1 , x t 2 , …, x tn} , xti is a candidate solution at time t (generation).

11

Key questions to answer from this algorithm: --How do we represent a problem based on a biological metaphor? --How do we create an initial population with initial candidate solutions (offspring)? --How do we define fitness of each member? --How do we evolve the population? --How do we use genetic operators?

  • Crossover takes two candidates (randomly or strategically), determine the split points (in the middle or randomly), divides them, and swapping components to produce two new candidates

Examples: Crossover and Mutation

  • Mutation takes a single candidate (randomly or strategically) and change one or some bits randomly.

is “don’t care”

modified

Example: Optimization of a Simple Function

 Problem description
 Given f(x) = x*sin(10 π *x) + 1.0 , find x in the range [ -1,2 ] which maximizes the
function f. Or find x i such that f(x i ) ≥ f(x) , for all x ∈ [ -1,2 ]. Precision of x is 6 digits

after the decimal point.

 Encoding the problem and representing problems and solutions

 The size of binary vector as a chromosome can be determined as follow:  Variable x in the range [-1,2] can be divided into at least 31000000 equal size ranges. This means that 22 bits are required as a binary vector (chromosome): 2097152 = 2 21 < 3000000 ≤ 2 22 = 4194304.  Mapping from a binary string into a real number x from the range [-1,2] is straightforward and is completed in two steps:  Convert the binary string from the base 2 to base 10.  Find a corresponding real number x : _x = -1.0 + x’3/(2 22 -1)_ , where x’ is a 22bits of chromosome; –1.0 is the left boundary of the domain; 2.0 is the right boundary of the domain.  For example, a chromosome x’ = (1000101110110101000111) represents the number 0.637197, since x’ = (1000101110110101000111) 2 = 2288967 and x = -1.0 + 2288967*(3/4194303) = 0.637197. Of course, the chromosomes (0000…0000) and (1111…1111) represent boundaries of the domain, -1.0 and 2.0, respectively.

 What about other parameters?^14

Example: Encoding the Traveling

Salesman Problem

 Assume there are nine cities to visit
 Representation

 Path representation: use 4 bits of binary to represent each city, 1, 2, …, 9 in order  p1: 0001 0010 0011 …. 1000 1001 p2: 0101 0100 0011 …. 0100 0011  Can we apply crossover and mutation operators?  Fitness function: straightforward, calculation of cost

 Representation

 Path representation: use decimal numbers instead of binary  p1 = (1 9 2 4 6 5 7 8 3) p2 = (4 5 9 1 8 7 2 3)  Can we apply crossover and mutation operators?  Mutation is possible if neighboring cities are exchanged

 Modified crossover operator, called “ Order Crossover ”

 Make two cut points in each of two parents randomly  p1 = (1 9 2 | 4 6 5 7 | 8 3) p2 = (4 5 9 | 1 8 7 6 | 2 3)  Two children c1 and c2 are produced by copying the middle segments  c1 = (x x x | 4 6 5 7 | x x) c2 = (x x x | 1 8 7 6 | x x)  Starting from the second cut, copy the cities from the other parent except for existing cities  c1 = (2 3 9 | 4 6 5 7 | 1 8) c2 = (3 9 2 | 1 8 7 6 | 4 5) from 2, 3, 9,1,8 removing 4, 6, 5, 7

16

Genetic Programming (GP)

 Cramer and Koza suggested that a tree structure should be used as the program representation in a genome. Koza recognized the importance of the method and demonstrated its feasibility for automatic programming in general in1992.

 Generational GP algorithm

(1) Initialize the population
(2) Evaluate the individual programs in the existing population. Assign a
numerical rating or fitness to each individual.
(3) Until the new population is fully populated, repeat the following steps:

Select an individual or individuals in the population using the selection algorithm. Perform genetic operations on the selected individual or individuals. Insert the result of the genetic operations into the new population.

(4) If the termination criterion is fulfilled, then continue. Otherwise, replace
the existing population with the new population and repeat steps 2~4.
(5) Present the best individual in the population as the output from the
algorithm.
Two programs, selected on fitness for
crossover. Points | from a and b are
randomly selected for crossover

Example: Crossover Operation

The child programs produced
by crossover of the points

Components of GP

 Functions and terminals are the primitives for GP programs

 Loosely speaking, terminals provide a value to the system while functions process a value already in the system.  The terminal set is comprised of the inputs to the GP program  The function set is composed of the statements, operators, and functions available to the GP system.  Functions and terminals must be assembled into a structure before they may execute as programs. Programs are structures of functions and terminals together with rules or conventions for when and how each function or terminal is to be executed.

 Sufficiency and parsimony in choosing functions and terminals

 The function set may be application-specific and be selected to fit the problem domain ( parsimony is related to search space). The functions and terminals used for a GP run should be powerful enough ( sufficiency ) to be able to represent a solution to the problem.

 Closure of the function and terminal set

 Each function in the function set should be able to handle gracefully all values it might receive as input. This is called the closure property.

 Other needed parameters

 Population size, probability of genetic operators, termination conditions, etc. 20