Download Personal Project A Genetic Algorithm – the one you are asked to

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Polymorphism (biology) wikipedia , lookup

Epistasis wikipedia , lookup

Genetic drift wikipedia , lookup

Gene expression programming wikipedia , lookup

Microevolution wikipedia , lookup

Koinophilia wikipedia , lookup

Group selection wikipedia , lookup

Population genetics wikipedia , lookup

Transcript
Personal Project
A Genetic Algorithm – the one you are asked to develop – is simply a conditional loop, which stops
when certain termination criteria are satisfied. Once, before entering the loop, a certain initialization
step must be executed. The loop itself involves the artificial evolution of a population of ‘individuals’
(in fact, candidate solutions to a given problem). This evolution involves: selection of parents,
generation of offspring and construction of the new generation. If the fitness of at least one individual
in the new generation is acceptable then evolution stops and the results are published; if not the loop
continues. The loop must also stop when too much time has gone by and no answer is produced.
An outline of the whole design of your software follows. It requires an Object-Oriented approach to
both the design and the implementation of your program.
1. The Individual class has the following requirements:
-
It holds a candidate solution
It can evaluate its own fitness
It can enter sexual reproduction (crossover) with one other individual
It can reproduce asexually (mutation) alone
2. The Population class has the following requirements:
-
It holds N individuals
It can ask any individual to evaluate its fitness
It can access the fitness value of any individual
It keeps track of the number of generations (loop number)
It evaluates the termination criteria and can stop the program & generate output
It runs the parent selection function
It runs the offspring generation function
It decides what individuals form the next generation
3. The Evolution class, which is algorithmic in nature and embodies the main loop:
-
Pre-loop: Initialize the population & evaluate its fitness
Loop:
o Termination iff Population (has maximally fit individual OR loop number too high)
o Population runs Parent Selection (fitness proportional XOR tournament selection)
o Population invokes Offspring Generation
 Crossover applied to two parents to generate two children
 Mutation is next applied to each of the two children
-
o Population executes Fitness Evaluation of resulting children
o Population Selects Survivors (= children, if generational)
Back to Loop;
If in doubt, use www.obitko.com/tutorials/genetic-algorithms/example-function-minimum.php to
refresh your memory about a very simple GA. Hence, your Assignments are arranged as follows:
Assignment#1 (2 weeks: due Feb 11)
Create an Individual class. You should be able to generate any number of individuals, each randomly
initialized, and then assess their fitness. An individual has an 1-dimensional array of N real numbers.
The fitness is reflected in how close the individual is to the solution of a multi-dimensional multimodal equation (choose one), within a wide range. If in doubt about the function to optimize, use the
Ackley function on page 7 of the CodeMonkey paper under the /Assignments directory.
Assignment#2 (2 weeks)
Complete the Individual class and create a Population class (you decide on the relationship between
them). Your program should create M (say 103) individuals, and then run a mini-loop consisting of:
Pre-loop; Termination; Mutation (of the whole population to generate new one); Fitness Evaluation of
the new Population, then back to Termination. Overload operator! when implanting Mutation.
Assignment#3 (2 weeks)
Complete the Population Class by: implementing Parent Selection and Crossover (overload operator *
when implementing Crossover). At this point, the basic evolutionary process should be complete, and
you should think of how to encapsulate it in an Evolution class. Generate results then add Elitism,
which requires that the fittest individual in the population is past without modification to the next
generation. Generate results again; compare and contrast.
Assignment#4 (2 weeks)
Alter your program so it can handle real-valued, Boolean and integer-valued vector solutions. This will
require use of both inheritance and polymorphism, as changes to (a) how an individual vector is
stored and evaluated (the fitness function); (b) Crossover (which must have 3 flavors) and (c)
Mutation (which must have 3 flavors also) will be necessary. Termination and both Parent and
Survivor Selection are not affected, as they only utilize fitness. To do the necessary changes, the
Individual class and/or the Population class (depending on your design) must become 2-level
hierarchies, with abstract base classes and derived fully implemented derived classes. Ultimately,
several functions including initialize and fitness, as well as operators ! and * must know which
implementation to trigger based on the nature of the objects calling them.
Your tutor will elaborate on these requirements, so speak to him! Make sure you build on what you
did in previous assignments- well as much as possible. I will provide you with a problem for both the
binary and integer representations well before you’re ready to attempt the final assignment.