Using a Genetic Algorithm to Create Prey Tactics

  • Slides: 25
Download presentation
Using a Genetic Algorithm to Create Prey Tactics Presented by Tony Morelli on 11/29/04

Using a Genetic Algorithm to Create Prey Tactics Presented by Tony Morelli on 11/29/04

Abstract § Evolve a predator/prey system § Inputs are the distances/angles between each predator/prey

Abstract § Evolve a predator/prey system § Inputs are the distances/angles between each predator/prey and other obstacles § Outputs are the bearing and speed to avoid confrontations while maintaining a task. § Focus on a prey whose mission is to follow the shoreline.

Introduction § Use a Genetic Algorithm to evolve a prey tactic when being attacked.

Introduction § Use a Genetic Algorithm to evolve a prey tactic when being attacked. § This example uses animals placed inside the SWARM architecture. § Objective for the prey is to identify a predator and avoid contact with it. § Prey behaviors/actions will be evolved against a hand coded predator.

Introduction § Evolving predator/prey is useful because it can demonstrate what happens in nature

Introduction § Evolving predator/prey is useful because it can demonstrate what happens in nature as well as create new military tactics. § GA is useful because we have a set of behaviors and a set of triggers for those behaviors. Hand coding this is difficult. A GA should find the best set of behaviors and triggers.

Background § Bauson & Ziemke § Evolved View Angle, View Range § Speed was

Background § Bauson & Ziemke § Evolved View Angle, View Range § Speed was used as a constraint § Prey prefers a camera with wide angle and short range, while a predator prefers small angle and long range § Predators dominated prey

Results Summary § Evolved prey outperformed hand coded prey when placed against a hand

Results Summary § Evolved prey outperformed hand coded prey when placed against a hand coded predator. § Evolved predator outperformed hand coded predator when placed against hand coded prey § Evolved predator outperformed evolved prey

Introduction § § § Methodology Results and Analysis Conclusions/Future Work

Introduction § § § Methodology Results and Analysis Conclusions/Future Work

Methodology § Prey needs to know it is being attacked and then react to

Methodology § Prey needs to know it is being attacked and then react to the situation § Prey’s primary goal is to follow the shoreline clock-wise § Must avoid predators and land Avoid Land Avoid Predators Follow Shoreline

Methodology § Genetic Algorithm was used to evolve prey tactics § § § §

Methodology § Genetic Algorithm was used to evolve prey tactics § § § § GA by Ryan Leigh 1 Point Crossover Elitist Selection Crossover: 0. 7 Mutation: 0. 1 Population: 20 Generations: 20

Methodology § Parameters § Distance from predator § Far, Near, Close, Too. Close §

Methodology § Parameters § Distance from predator § Far, Near, Close, Too. Close § 50 -944 pixels § Speed § Slow, Normal, Fast, Superfast § 0. 025 -0. 3 § Turning Rate § π/16 – π / 2 radians § Vision Range § π/16 – π / 2 radians

Methodology § 51 Bit String § § § § Bits 0 -7 – Far

Methodology § 51 Bit String § § § § Bits 0 -7 – Far Bits 8 -15 – Near Bits 16 -23 – Close Bits 24 -30 – Too Close Bits 31 -33 – Turning Rate Bits 34 -36 – Vision Range Bits 37 -43 – Fast Speed Bits 44 -50 – Normal Speed

Methodology § Parameter values were evolved § When each parameter was used was not

Methodology § Parameter values were evolved § When each parameter was used was not evolved § If enemy is too close change speed to Super Fast § The values for super fast and too close were evolved, not the logic surrounding them

Methodology § Once an attack is identified, the prey will try to avoid contact.

Methodology § Once an attack is identified, the prey will try to avoid contact. § When anything gets within certain ranges, or a crash is projected within a certain range, the prey will react to it

Fitness Evaluation § Success is measured by time § Until the prey thinks he

Fitness Evaluation § Success is measured by time § Until the prey thinks he is being attacked, fitness increments by 1 every update § If the prey is wondering around and never encounters a predator, his evasive skills are not tested, so this allows to keep that prey alive in the gene pool § Once an attack is detected fitness is incremented by 5 every update § We really want to measure the prey’s evasive ability. This weight allows for that.

Methodology § The simulation was run for 5 minutes § This was at an

Methodology § The simulation was run for 5 minutes § This was at an accelerated rate § 5 minutes would take a few seconds § If at any point the predator/prey collide, or either one hits land, the simulation ends § Fitness was calculated and the GA performed its job.

Methodology § First the default predator and the default prey went head to calculate

Methodology § First the default predator and the default prey went head to calculate a fitness. § Next the prey was evolved against the default predator. The top prey then went head to head against the default predator § The predator was evolved against the default prey. The top predator then went head to head against the default prey § Finally the evolved predator and the evolved prey were matched up and the fitness of the prey was evaluated.

Results § Default Predator vs Default Prey Seed Fitness 0. 1337 0. 8712 0.

Results § Default Predator vs Default Prey Seed Fitness 0. 1337 0. 8712 0. 7107 0. 835 130189 74867 89023 67161 § Average: 90310

Results

Results

Results § Evolved Prey vs Default Predator § § Seed Fitness 0. 1337 0.

Results § Evolved Prey vs Default Predator § § Seed Fitness 0. 1337 0. 8712 0. 1707 0. 835 173523 303250 116531 205971 Average: 199819 221% Increase

Results § Evolved Predator vs Default Prey § § Seed Fitness 0. 1337 0.

Results § Evolved Predator vs Default Prey § § Seed Fitness 0. 1337 0. 8712 0. 1707 0. 835 22693 50037 41991 59181 Average: 43476 48% Decrease

Results § Evolved Predator vs Evolved Prey § § Seed Fitness 0. 1337 0.

Results § Evolved Predator vs Evolved Prey § § Seed Fitness 0. 1337 0. 8712 0. 1707 0. 835 26873 34326 19303 30181 Average: 27671 70% Decrease

Results § Evolved Predator vs Evolved - Evolved Prey § § Seed Fitness 0.

Results § Evolved Predator vs Evolved - Evolved Prey § § Seed Fitness 0. 1337 0. 8712 0. 1707 0. 835 172865 152757 200454 249813 Average: 193972 214% Increase

Analysis § As expected, evolved prey was highly successful when compared to the default

Analysis § As expected, evolved prey was highly successful when compared to the default predator § Evolved predator was much better than evolved prey § Evolved prey developed specialized parameters that were successful against 1 type of predator § Once paired against a different predator, the learned tactics no longer applied § No general knowledge

Conclusions § The GA did work against a known predator § My evolved prey

Conclusions § The GA did work against a known predator § My evolved prey did not develop any general knowledge

Future Work § Need to add in logic for random turning when there is

Future Work § Need to add in logic for random turning when there is no limit on turning § Need to add in logic for handling multiple predators. § Should plan a route instead of just reacting and running away.