1.22k likes | 1.24k Views
Evolving Winning Controllers for Virtual Race Cars. Yonatan Shichel & Moshe Sipper. Outline. Introduction Artificial Intelligence AI in games Robocode: Java-based tank-battle simulator RARS: Robot Auto Racing Simulator Evolutionary Computation Key concepts in evolution
E N D
Evolving Winning Controllersfor Virtual Race Cars Yonatan Shichel & Moshe Sipper
Outline • Introduction • Artificial Intelligence • AI in games • Robocode: Java-based tank-battle simulator • RARS: Robot Auto Racing Simulator • Evolutionary Computation • Key concepts in evolution • Genetic Algorithms (GA) • Genetic Programming (GP) • GP-RARS: evolution of winning controllers for virtual race cars • Game description • Previous work • Evolutionary environment setup & calibration • Experiments and Results • Discussion • Result Analysis • Concluding Remarks
Artificial Intelligence (AI) Definition (Russell & Norvig, 2003): “systems that [act/think] [like humans/rationally]”
Artificial Intelligence (AI) Definition (Russell & Norvig, 2003): “systems that [act/think] [like humans/rationally]”
Artificial Intelligence (AI) Definition (Russell & Norvig, 2003): “systems that [act/think] [like humans/rationally]”
Artificial Intelligence (AI) Definition (Russell & Norvig, 2003): “systems that [act/think] [like humans/rationally]”
Artificial Intelligence (AI) Definition (Russell & Norvig, 2003): “systems that [act/think] [like humans/rationally]”
AI in Games • games are natural candidates for AI • games provide a variety of challenges • games allow exploration of real-world realms • games allow comparison to human behavior • games can be rewarding to master • games are fun!
Robocode • tank-battle simulation • Java-based, open-source programming game • simplistic physical model • active gamer community • extensive online robot library • ongoing tournaments
RARS: Robot Auto Racing Simulator • car-race simulation • C++-based, open-source programming game • sophisticated physical model • inactive gamer community • limited online robot library • tournaments held between 1995 and 2003
Evolutionary Computation “a family of algorithmic approachesaimed at finding optimal solutions tosearch problems of high complexity”
Key concepts in Evolution The Origin of Species (Darwin, 1859): • a population is composed of many individuals • individuals differ in characteristics, which are inheritable by means of sexual reproduction • environment consists of limited resources, leading to a struggle for survival
Key concepts in Evolution The Origin of Species (Darwin, 1859): • fitter individuals are more likely to survive and reproduce, passing their characteristics to their offspring • as time passes, populations slowly adapt to their surrounding environment
Genetic Algorithms (GA) Inspired by Darwin’s evolutionary principles: • a fixed-size population is composed of many solution instances for the problem at hand • solutions are encoded in genomes • a fitness function determines how fit each individual is • population is re-populated on each generation • fitter individuals have higher probabilities to be selected to next generation
Genetic Algorithms (GA) • genetic operators – crossover and mutation – are applied on selected individuals for the creation of new individuals • process is repeated for many generations
Genetic Algorithms (GA) A schematic flow of a basic GA: g=0 initialize population P0 evaluate P0 //assign fitness values to individuals while (termination condition not met) do g=g+1; select Pg from Pg-1 crossover Pg mutate Pg evaluate Pg end while
Genetic Algorithms (GA) GA customization: • genome representation • fitness measure • selection method • crossover method • mutation method • termination condition • initial population creation
Genetic Programming (GP) “an evolutionary computation approachaimed at the creation of computer programsrather than static solutions”
Genetic Programming (GP) • individual’s genome is composed of LISP expressions
Genetic Programming (GP) example of LISP expression: (+ (* x x) 1) ==> x2+1 + * 1 x x
Genetic Programming (GP) • individual’s genome is composed of LISP expressions • LISP expressions are composed of functions and terminals
Genetic Programming (GP) functions: {+, *} terminals: {1, x} + * 1 x x
Genetic Programming (GP) functions: {+, *} terminals: {1, x} + * 1 x x
Genetic Programming (GP) functions: {+, *} terminals: {1, x} + * 1 x x
Genetic Programming (GP) functions: {+, *} terminals: {1, x} + 1 * x x
Genetic Programming (GP) • individual’s genome is composed of LISP expressions • LISP expressions are composed of functions and terminals • LISP expressions evaluate to numeric values, hence representing functions
Genetic Programming (GP) evaluation of LISP expression:
Genetic Programming (GP) • individual’s genome is composed of LISP expressions • LISP expressions are composed of functions and terminals • LISP expressions evaluate to numeric values, hence representing functions • genetic operators are defined to operate on (and return) LISP expressions
Genetic Programming (GP) subtree substitution crossover: - + 1 * * 1 1 x x + x 1 (+ (* x x) 1) x2+1 (- 1 (* 1 (+ x 1))) -x
Genetic Programming (GP) subtree substitution crossover: - + 1 * * 1 1 x x + x 1 (+ (* x x) 1) x2+1 (- 1 (* 1 (+ x 1))) -x
Genetic Programming (GP) subtree substitution crossover: - + 1 * * 1 1 x x + x 1 (+ (* x x) 1) x2+1 (- 1 (* 1 (+ x 1))) -x
Genetic Programming (GP) subtree substitution crossover: - + 1 * 1 1 + x 1 (- 1 (* 1 (+ x 1))) -x
Genetic Programming (GP) subtree substitution crossover: - + 1 1
Genetic Programming (GP) subtree substitution crossover: - + * 1 1 1 + x 1 (+ (* 1 (+ x 1)) 1) x+2
Genetic Programming (GP) subtree substitution crossover: - + * 1 * 1 1 x x + x 1 (+ (* 1 (+ x 1)) 1) x+2 (- 1 (* x x)) 1-x2
Genetic Programming (GP) random subtree growth mutation: + * 1 x x (+ (* x x) 1) x2+1
Genetic Programming (GP) random subtree growth mutation: + * 1 x x (+ (* x x) 1) x2+1
Genetic Programming (GP) random subtree growth mutation: + * 1 x
Genetic Programming (GP) random subtree growth mutation: - + 1 1 * 1 x (+ (* x (- 1 1)) 1) 1
Genetic Programming (GP) A schematic flow of a basic GP: g=0 initialize population P0 evaluate P0 //assign fitness values to individuals while (termination condition not met) do g=g+1; while (Pg is not full) do OP = choose a genetic operator select individual or individuals from Pg-1 according to OP's inputs apply OP on selected individuals add the resulting individuals to Pg end while evaluate Pg end while
GP-RARS evolution of winning controllers for virtual race cars
Basic Rules • one or more cars drive on a track for given number of laps • cars are damaged when colliding or driving off track • car may be disabled and disqualified if its damage exceeds a certain level • the winner is the driver that finishes first
Game Variants • number of cars: one, two, multiple • number of tracks: one, multiple • race length: short, long • controller program: generic, specialized • driver class: reactive (c2), optimal-path (c1)
Game Variants • number of cars: one, two, multiple • number of tracks: one, multiple • race length: short, long • controller program: generic, specialized • driver class: reactive (c2), optimal-path (c1)