ICT2191 Topic 11 Genetic Algorithm Animat Design of an animat for defensive tactics Representation of Action Sequences Genetic Operators Genetic Algorithm.

Slides:



Advertisements
Similar presentations
Population-based metaheuristics Nature-inspired Initialize a population A new population of solutions is generated Integrate the new population into the.
Advertisements

Reinforcement Learning
Local Search Algorithms
Biologically Inspired Computing: Operators for Evolutionary Algorithms
Genetic Algorithms (Evolutionary Computing) Genetic Algorithms are used to try to “evolve” the solution to a problem Generate prototype solutions called.
1 Transportation problem The transportation problem seeks the determination of a minimum cost transportation plan for a single commodity from a number.
Tetris – Genetic Algorithm Presented by, Jeethan & Jun.
Tetris and Genetic Algorithms Math Club 5/30/2011.
Genetic Algorithms Contents 1. Basic Concepts 2. Algorithm
Genetic Algorithms. Some Examples of Biologically Inspired AI Neural networks Evolutionary computation (e.g., genetic algorithms) Immune-system-inspired.
1 Chapter 13 Artificial Life: Learning through Emergent Behavior.
1 Lecture 8: Genetic Algorithms Contents : Miming nature The steps of the algorithm –Coosing parents –Reproduction –Mutation Deeper in GA –Stochastic Universal.
Estimation of Distribution Algorithms Let’s review what have done in EC so far: We have studied EP and found that each individual searched via Gaussian.
Improved Crowd Control Utilizing a Distributed Genetic Algorithm John Chaloupek December 3 rd, 2003.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
A new crossover technique in Genetic Programming Janet Clegg Intelligent Systems Group Electronics Department.
Iterative Improvement Algorithms
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Intro to AI Genetic Algorithm Ruth Bergman Fall 2002.
Evolutionary Computation Application Peter Andras peter.andras/lectures.
Chapter 6: Transform and Conquer Genetic Algorithms The Design and Analysis of Algorithms.
Christoph F. Eick: Applying EC to TSP(n) Example: Applying EC to the TSP Problem  Given: n cities including the cost of getting from on city to the other.
Universidad de los Andes-CODENSA The Continuous Genetic Algorithm.
Genetic Programming.
Slides are based on Negnevitsky, Pearson Education, Lecture 10 Evolutionary Computation: Evolution strategies and genetic programming n Evolution.
Evolutionary algorithms
Genetic Algorithm.
1 Introduction to Genetic Algorithms. 2 Genetic Algorithms What are they? –Evolutionary algorithms that make use of operations like mutation, recombination,
SOFT COMPUTING (Optimization Techniques using GA) Dr. N.Uma Maheswari Professor/CSE PSNA CET.
Othello Artificial Intelligence With Machine Learning
© Negnevitsky, Pearson Education, Lecture 10 Evolutionary Computation: Evolution strategies and genetic programming Evolution strategies Evolution.
Intro. ANN & Fuzzy Systems Lecture 36 GENETIC ALGORITHM (1)
Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas 363CS – Artificial Intelligence.
Ch.12 Machine Learning Genetic Algorithm Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011.
Zorica Stanimirović Faculty of Mathematics, University of Belgrade
What is Genetic Programming? Genetic programming is a model of programming which uses the ideas (and some of the terminology) of biological evolution to.
Genetic algorithms Charles Darwin "A man who dares to waste an hour of life has not discovered the value of life"
HOW TO MAKE A TIMETABLE USING GENETIC ALGORITHMS Introduction with an example.
1 Chapter 13 Artificial Life: Learning through Emergent Behavior.
Dynamical Systems Model of the Simple Genetic Algorithm Introduction to Michael Vose’s Theory Rafal Kicinger Summer Lecture Series 2002.
G ENETIC A LGORITHMS Steve Foster. I NTRODUCTION Genetic Algorithms are based on the principals of evolutionary biology in order to find solutions to.
Genetic Algorithms Introduction Advanced. Simple Genetic Algorithms: Introduction What is it? In a Nutshell References The Pseudo Code Illustrations Applications.
EE459 I ntroduction to Artificial I ntelligence Genetic Algorithms Kasin Prakobwaitayakit Department of Electrical Engineering Chiangmai University.
Automated Patch Generation Adapted from Tevfik Bultan’s Lecture.
Genetic Algorithms CSCI-2300 Introduction to Algorithms
Genetic Algorithms What is a GA Terms and definitions Basic algorithm.
MAE 552 Heuristic Optimization Instructor: John Eddy Lecture #12 2/20/02 Evolutionary Algorithms.
Evolutionary Computation: A New Way to Search for Solutions Blase B. Cindric Mount Union College November 14, 2006.
EE749 I ntroduction to Artificial I ntelligence Genetic Algorithms The Simple GA.
D Nagesh Kumar, IIScOptimization Methods: M8L5 1 Advanced Topics in Optimization Evolutionary Algorithms for Optimization and Search.
Othello Artificial Intelligence With Machine Learning Computer Systems TJHSST Nick Sidawy.
Genetic algorithms: A Stochastic Approach for Improving the Current Cadastre Accuracies Anna Shnaidman Uri Shoshani Yerach Doytsher Mapping and Geo-Information.
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal Evolutionary Computation.
1 Comparative Study of two Genetic Algorithms Based Task Allocation Models in Distributed Computing System Oğuzhan TAŞ 2005.
Genetic Algorithms An Evolutionary Approach to Problem Solving.
 Presented By: Abdul Aziz Ghazi  Roll No:  Presented to: Sir Harris.
March 1, 2016Introduction to Artificial Intelligence Lecture 11: Machine Evolution 1 Let’s look at… Machine Evolution.
Genetic Algorithm (Knapsack Problem)
Optimization Of Robot Motion Planning Using Genetic Algorithm
Othello Artificial Intelligence With Machine Learning
MAE 552 Heuristic Optimization
Evolution strategies and genetic programming
School of Computer Science & Engineering
Example: Applying EC to the TSP Problem
CIS 488/588 Bruce R. Maxim UM-Dearborn
Example: Applying EC to the TSP Problem
Example: Applying EC to the TSP Problem
CIS 488/588 Bruce R. Maxim UM-Dearborn
Searching for solutions: Genetic Algorithms
Biologically Inspired Computing: Operators for Evolutionary Algorithms
Presentation transcript:

ICT2191 Topic 11 Genetic Algorithm Animat Design of an animat for defensive tactics Representation of Action Sequences Genetic Operators Genetic Algorithm Module Computing Fitness Getting it to Work Evaluation of Performance Reading: Champandard Chapter 34 Link to Genetic Algorithms on Website

ICT2192 Design of Animat for Defensive Tactics In combat game terms, defensive tactics is the sequence of actions carried out by an animat to protect itself when it comes under attack This is a natural choice for learning behaviour by genetic algorithm, because the animat is in a highly competitive situation with a survival mandate It should be possible to decide on the fittest behaviours and select for them in the evolving sequence of actions To keep things simple, we will focus on only two behaviours – dodging enemy fire and rocket jumping But the method could be extended to include other defensive moves, such as weaving and seeking cover

ICT2193 Representation of Action Sequences The representation is always important in AI problems, but particularly so for genetic algorithm solutions When attacked, we want our animat to perform an optimal action sequence that will preserve its health That means optimal ordering of a list of basic actions, optimal parameters to control them and optimal timing DodgingMove (3 weights) Rocket Jumping Look Fire - Jump - behaviour action(parameters)

ICT2194 Representation of Action Sequences The only complicated matter is the 3-weights for Move. Three pre-chosen vectors represent fleeing from: the projectile, the projected hit point given the current path, and the point of impact There could be reasons to move away from each of these points. Can assign a weight to each, then move along the path resulting from the combined vector potential collision predicted impact from impact from collision from projectile animat current path

ICT2195 Representation of Action Sequences Useful behaviour involves not only the right order of actions, with the right parameters, but also at the right time Each action in our ordered list of actions must be associated with a start-time This could be a relative offset, (say in msec) from the last action Or maybe absolute timing, with an offset from the start of the sequence – reduces dependencies in action timings move (x,y,z) look (up) jump () 400msec 200msec move (x,y,z) look (up) jump () 1500msec 2040msec 3050msec

ICT2196 Data Structure An action sequence will be an array of any size up to a maximum length. The array contains tokens representing any of the four possible actions: Each element of the array will be a structure containing - a symbol representing the action for that part of the sequence - a floating-point field for the absolute time offset in seconds from the beginning of sequence - if the action is Look, a direction (one of up, down, ahead) - if the action is Move, a Vec3f of three “fleeing weights” to be used as a steering vector To initialise, an array of random length will be assigned a random sequence of actions, parameterised by a random time offset

ICT2197 Genetic Operators We need operators for selection, crossover and mutation In the hypothetical example in Chapter 34, two parents are selected from a randomly-generated population with a probability proportional to their fitness (Note - Kanga actually uses tournament – best of 3 randomly selected individuals) For crossover, use the simplest type: one-point crossover. This chooses a random index on the arrays of two parents, then swaps the subarrays: move fire look jump move fire look move crossover index=3 move fire look jump move fire look move swap parents offspring

ICT2198 Genetic Operators Two forms of mutation are discussed in the example of Chapter 34: 1) There is a low probability that the length of a sequence may increase or decrease by 1 2) There is a (different) low probability that an action and its parameters, or the timing of an action will change randomly move fire look jump move original mutant move fire look move fire look move original mutant move fire move fire

ICT2199 Computing Fitness We are actually working with two behaviours. It follows that we should try to optimise two fitness functions (or one fuction with two components): Rocket Jumping – the point of this is to jump high, so we measure upward movement and try to optimise that. To avoid the loophole of being rewarded for climbing stairs, etc., this is only measured when the animats feet are off the ground We want the animat to discover that rocket jumping is the best method of jumping high. We will specially reward very high jumps by squaring the vertical distance off the ground Dodging - begin with distance from point of explosion. If the animat is hit, this will be zero; otherwise, simply linear distance increases with better performance To avoid the loophole of obtaining high fitness scores from simply standing far from an explosion, use average velocity - the change in distance (animat to crossing point) between time the weapon fired and time of explosion Some Quake 2 code is required to implement these two functions. Each returns a single floating point number.

ICT21910 Genetic Algorithm Module A standard module can be parameterised to handle most of the variations on the GA process – so most of the work is really building a set of helper functions to measure the fitness or the operators Champandard wants to abstract the application of an evolutionary style of computation away from the details of how the populations are generated, how fitness is computed, and even what kind of evolutionary computation is to be performed In the FEAR code this would ideally be done as a set of interfaces which lie between components being evolved and the (general purpose, evolutionary, genetic) algorithm. In Kanga, this idea has been shortcut. There are four main functions, into which many of the needed operations are mixed

ICT21911 The Kanga animat Consists of fairly hacky code to implement (part of) this process A degenerate form of genetic operator is used – does not do crossover, only mutation as described earlier The Think() function contains the following: constants: k_PopulationSize=8, k_MaxActionsPerSequnce=8, k_MaxSequenceLength=2.0f, kDodgesPerTrial=3 MonitorSituation() - Decides if a projectile has been fired, and tries to track it. This function also accumulates fitness for jumping when the animat is off the ground (should really be in AssignFitness!) GenerateSequence() - Creates a new sequence from a parent, applying the mutation at prob of 0.1 to change length, prob of 0.4 to change action. No crossover. ApplySequence() - Applies the generated sequence using ApplyAction(), a switch statement which calls embodied I/O functions according to the action symbol AssignFitness() - Evaluates the performance of dodging (every 3 dodges) and jumping using inverse change in fitness.

ICT21912 Evaluating the Tactical Performance Kanga can be tried out by putting it into a small environment such as arena1 and going after it as a player with something that launches rockets (not a machine gun) To automate the process, put Salty into the room – doesn’t move but fires rockets continuously! You should see a gradual improvement in the jumping and dodging performance. Only dodging fitness seems to be reported for the current population – this might be remedied by better printf statements It might take some time before the animat discovers rocket jumping Obviously more work needs to be done to properly evaluate the performance of animats in FEAR. Some kind of graphical tool which lets us keep track of measures continuously in real time would be useful