(Genetic Algorithm Interface Architecture) Final Presentation CS 499 Created By: Chuck Hall Simone...

Post on 13-Jan-2016

216 views 0 download

Transcript of (Genetic Algorithm Interface Architecture) Final Presentation CS 499 Created By: Chuck Hall Simone...

(Genetic Algorithm Interface Architecture)

Final PresentationCS 499

Created By:Chuck HallSimone ConnorsHéctor AybarMike Grim

INTRODUCTION

Client – Dr. Abrahamian

Goal – Develop a GA library

Team organizationEdmond

Abrahamian

Client

Simone Connors

Project Member

Hector Aybar

Project Member

Mike Grim

Project Member

Chuck Hall

Project Manager

Dr. Yu

UpperManagemen

t

WHAT IS A GENETIC ALGORITHM?

Search algorithm that mimics natural genetics

Searches for optimal solutions to complex functions

Shared fundamentals of natural genetics Populations/Generations Chromosomes Genes contain values Crossover & Mutation Survival of the fittest

If the GA is solving f(x), then one chromosome is an ‘x’

STAGED DELIVERY LIFECYCLE

Architectural

Design

Requirements

Analysis

SoftwareConcept

Stage 3: module efficiency prototypeDelivery Date: December 6, 2004

Stage 2: default integer and double-string prototypeDelivery Date: November 8, 2004

Stage 1: default bit-string and function pointer prototype

Delivery Date: October 11, 2004

Delivery

Testing

Coding

Detailed

Design

PLANNED DELIVERY SCHEDULE

GAIA RELEASE

Beta Release – Nov. 9th

Built in bit-string and integer-string functionality Compatible with user defined gene types Contained some undetected memory leaks and infinite

loops Concentration on X² test

Release Candidate # 1 – Nov. 13th Fixed memory leaks and infinite loops CVS branch to RELENG_1

GAIA RELEASE

Release Candidate # 2 – Nov. 19th Contained Performance Enhancements Concentration on TSP problem

Release Candidate # 3 – Soon Built in double gene type functionality Concentration on F[1-6] test functions

TESTING

Unit Testing Tested modules to ensure correctness Blackbox and whitebox testing

Integration Testing Tested combined modules Detected faults not found during Unit Testing

TESTING

System Testing Tested entire GAIA system Ensured that system complies with functional

requirements in RAD Tested with different parameter

configurations Tested GAIA with Traveling Salesperson

Problem

TESTING

Regression Testing Re-executed all prior tests Updated test drivers Ensured that modified code didn't cause any

new faults Performed simple statistical analysis of

performance (to be seen later)

TESTING

Test Case Inputs Expected Results Outputs Document test case in Test Case

Specifications

Testing was performed on UNIX-like and GNU/Linux platforms

GCC compiler used when testing

Developed drivers for testing

TESTING

Installation and Acceptance Testing Client downloads and installs GAIA library Client performs all acceptance testing

Site Testing Performed by client

MORE ON TESTING

Different from Most Sr. Projects No GUI Many Test Drivers Requires Familiarity

System Architecture API

HARDWARE/SOFTWARE MAPPING

3-Tier Architecture Interface Application Logic Storage

SYSTEMARCHITECTURE Interface

API

Application Logic

Genetic AlgorithmManagement

Storage

Librarian InstanceStorage

FLOW OF EVENTS (API)

Create two pointers:Instance of GAIA

GA Parameters structure

Initialize Memory:Instance of GAIA

Instance of GA Parameters structure

Primary application fills the initial population.

Optimize problem using thegenetic algorithm.

(Details in another figure.)

Primary application asks for thesolution to be returned to it.

Free all the memory associated

with an instance of GAIA.

Primary application requestsa human-readable error to

be returned.

GA Parameters and FunctionPointers are setup:

parametersallocate_chromosomedelete_chromosomecopy_chromosomecrossovermutationselectionfitness

Is ther

ean

error?

Yes

If no error, just return.

No

FLOW OF EVENTS:GENETIC ALGORITHM

Precondition:Initial population has been filled and all

Fitness values have been calculated.

Select 2 parent chromosomes.

Make 2 copies of each.

Perform crossover and mutation on one set.

Calculate fitness values for the 2 children.

Check eachparent and

childchromosom

e.Is it already

inthe pool?

Is the pool

filled?

Have any of the

convergence criteriabeen met?

Insert into the pool

sorted byfitness value.

Copy the best chromosomes

from the pool intothe next generation.

Delete the copy.

Halt the algorithm.

Start creating the next generation.

Yes

Yes

No

No

No

Yes

INSIDE THE DEVELOPMENT PROCESS

Goals Source Control Standard Documentation Standard Compiler Cross Platform Thread Safe (Extra) Standard Build Tools Automated Build Process

CONCURRENT VERSIONING SYSTEM (CVS)

Source control system Has basic administration facilities via file

permissions and system authentication Revision rollbacks and rollforwards Version branching and merging Conflict prevention and developer

independence

DOCUMENT GENERATION TOOLSDoxygen

What is doxygen? Generates UML diagrams and cross-

referenced documentation. Makes document maintenance easier. Complement to good design docs that are

continually updated; it's not a substitute.

DOXYGEN:FROM SOURCE TO DOCUMENTATION

DOXYGEN:REVELATION

So, what does doxygen look like? Software blueprint Maybe an example is better

GNU COMPILER COLLECTION (GCC)

Client specified two compilers: GCC MIPSpro ANSI C Compiler

Versions used in testing (Linux & FreeBSD) 2.95: Late testing and client acceptance 3.3.3: Early development 3.4.2: Upgrade resolved erroneous warnings.

DEVELOPMENT GOALS

Cross-Platform Linux FreeBSD SGI Irix

Thread-Safe Not an actual requirement. Mutexes at entry/exit of each API function.

BUILD ENVIRONMENT

Consistent build options to GCC.... how? BSD/Make GNU/Make Makefiles

Same environment for everyone FreeBSD 5.2.1 & 5.3. Bash Same environment variables for all developers

AUTOMATED BUILD PROCESSOur Build Philosophy

Build often.

Automated daily snapshots from CVS.

Keep doxygen docs in sync with latest code.

XML CONFIGURATION FILE

Client requested ability to modify genetic algorithm parameters via XML.

Example

DYNAMIC API:OBJECT-ORIENTED C

Memory Management gaia_mem_t *

gaia_init_mem(gaia_gene_e gene_type, int concurrent_f, void *udata);

voidgaia_free_mem(gaia_mem_t *lib);

Genetic Algorithm Parameter Updating int

gaia_set_info_xml( gaia_mem_t *lib, const char *xml_file_path);

intgaia_set_info( gaia_mem_t *lib, const gaia_info_t *g_info);

DYNAMIC API:OBJECT-ORIENTED C

Genetic Algorithm Operator Overloading int

gaia_set_*(gaia_mem_t *lib, const gaia_info_t *g_info);

Genetic Algorithm Itself int

gaia_optimize(gaia_mem_t *lib);

Post-Genetic Algorithm Data Retrieval int

gaia_get_population(const gaia_mem_t *lib, chromosome_t *population);

intgaia_get_info(const gaia_mem_t *lib, gaia_info_t *g_info);

TSP DEMO

TSP DEMO

Find the optimal tour for a set of cities

For X cities the number of possible routes is X!

11 cities Brute force – 3hrs GA – under 2sec

12 cities Brute force – 35hrs GA – under 2sec

TSP DEMO

TSP DEMO

A gene represents an individual city

A chromosome represents a route

The fitness is the length of the route

In the GA we needed to replace Fitness function Crossover function Mutation function

GAIATSP DEMONSTRATION

For 42 U.S. cities: The shortest distance is 12,345 miles. The longest distance is roughly 80,000 miles.

42 cities TSP in action.

GAIA Performance Statistics300 Test Runs

95% Confidence Interval of Mean (12660.91 mi., 12881.02 mi.)

Sample mean: 12770.96 mi.

Range: 1,658 mi.

Tested accuracy is 96.6%.

What Else Will GAIA Do?

Molecular FoldingGame AI

SUMMARY – INDIVIDUAL SKILLS

Chuck Concern for team Knowledge of genetic

algorithms SVG for final

presentation

Hector Website Documentation Testing

Simone Meetings

•Minutes•Kept us online

Detailed Testing

Mike Technical

communication with client

System Design Development tools

SUMMARY

Things we did right Source control (CVS) Team communication Division of responsibilities Team meetings

Things we did wrong Documentation (more detailed in the right areas) Project timeline (too optimistic) Memory management (memory leaks; lacked VM

subsystem)

SUMMARY

This was a great project

We gained realistic work experience

We increased our skills tremendously

Have a real product to “show off” to employers

QUESTIONS/COMMENTS?