Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved...

8
Genetic Programm ing Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved data structures used to evolve solutions to problems. GP system performed better than the standard GP system with indexed memory.

description

Stack Operations makenull - The stack pointer is assigned the value of the maximum size of the stack plus one so as to indicate that the stack is empty. empty - If the value of the stack pointer is not validthis method returns true otherwise it returns false. top - A copy of the element at the top of the stack is returned. pop - This method returns the element currently pointed to by the stack pointer, and increments the stack pointer by one. push - This method reduces the stack pointer by one and stores the element passed to it at this position.

Transcript of Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved...

Page 1: Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved data structures used to evolve solutions to problems.

Genetic ProgrammingData Structures

Evolution of algorithms for an array-based stack, queue, and linked-list.

Evolved data structures used to evolve solutions to problems.

GP system performed better than the standard GP system with indexed memory.

Page 2: Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved data structures used to evolve solutions to problems.

Genetic ProgrammingThe Push-Down Stack

The push-down stack is an array-based stack.

The first element pushed onto the stack stored in the array at the position equal to the maximum size of the stack.

As successive elements are added onto the stack the stack pointer is decremented by one.

Page 3: Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved data structures used to evolve solutions to problems.

Genetic ProgrammingStack Operations makenull - The stack pointer is assigned the value of the

maximum size of the stack plus one so as to indicate that the stack is empty.

empty - If the value of the stack pointer is not validthis method returns true otherwise it returns false.

top - A copy of the element at the top of the stack is returned.

pop - This method returns the element currently pointed to by the stack pointer, and increments the stack pointer by one.

push - This method reduces the stack pointer by one and stores the element passed to it at this position.

Page 4: Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved data structures used to evolve solutions to problems.

Genetic Programming

The Genetic Programming System

Objective: To simultaneously evolve the five algorithms for an integer, array-based push-down stack. Checks for stack overflow and underflow are not catered for.

Each individual in the population is represented using a multi-tree genome. The genome consists of five parse trees representing each of the five stack operations.

Primitives Constants: 0, 1 max : The maximum size of the stack. This is given a value of

10. arg1: The value to be pushed onto the stack. Arithmetic operators: +, - read and write aux, inc_aux, dec_aux and write_aux

Page 5: Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved data structures used to evolve solutions to problems.

Genetic Programming

The Genetic Programming System Fitness Cases:

Four test sequences were used. Each test sequence consists of 40 calls to each of the five stack

operations and requires a value to be returned at the end of each function call.

The values pushed onto the stack were randomly selected in the range -1000...999.

The number of function calls for which the same value is returned for each function call. The operations makenull and push are indirectly tested as they do not

return a value. The score is automatically incremented by one for both these

operations. Trees accessing an invalid memory location are penalised by stopping

the evaluation and returning the fitness value calculated up until that point.

Page 6: Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved data structures used to evolve solutions to problems.

Genetic Programming

The Genetic Programming System

Selection: Tournament selection with a tournament size of 4.

Population Size: 1000 Generations: 101 Program Size: <= 250 Success Predicate: Fitness >= 160

Page 7: Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved data structures used to evolve solutions to problems.

Genetic ProgrammingEvolved Solution

makenull top pop push empty

write_aux

1

read

aux

Qprog2

read

aux

inc_aux dec_aux arg 1

writeaux

Page 8: Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved data structures used to evolve solutions to problems.

Genetic ProgrammingEvolved Solution

makenull top pop push empty

write_aux

0

read

aux

Qprog2

read

aux

inc_auxdec_aux arg 1

write

aux

sub

-1