Solving Problems with Artificial Neural Networks ANNs ANN
Solving Problems with Artificial Neural Networks (ANNs)
ANN Application Areas • • Game AI * Language processing Character recognition Data compression
Neural Networks in Games • Control – Use sensor data to make smart moves (collision detection) • Threat assessment – Use player units and proximity to determine threat level • Fight or flight – Is the mob likely to win the fight? Acts on that data • Anticipation – Takes in player history to predict the players next move, responds to best counter that move
Neural Networks in Games • Control (robots) – Movement • E. g. : Colin Mc. Rae Rally – Input: Sensor results – Outputs: Directions to move – http: //www. youtube. com/watch? v=Es 1 p. Ag_j. HX 4 – http: //www. onlamp. com/pub/a/onlamp/2004/09/30/AIf or. Game. Dev. html
Neural Networks in Games • Threat assessment (strategy) – Inputs: types of units and their movement – Output: Aerial threat, a ground threat, both an aerial and ground threat, or no threat. http: //www. onlamp. com/pu b/a/onlamp/2004/09/30/AIf or. Game. Dev. html
Neural Networks in Games • Fight or flight (persistent rpg) – Used for mobs – Inputs: class, group size, level, range – Decision making process: that is, whether the creature will attack, evade, or wander, depending on whether or not there's an enemy (a player) in the creature's proximity. http: //www. onlamp. com/pub/a/onlamp/2004/09/30/AIfor. Game. Dev. html
Neural Networks in Games • Anticipation (mortal kombat, streetfighter) – Computer tell what the player is going to do based on past attacks (low kick, high kick, punch) – Inputs: a few previous attacks – Outputs: next predicted attack • Computer can then decide to block, move, punch, etc http: //www. onlamp. com/pub/a/onlamp/2004/09/30/AIfor. Game. Dev. h tml
Challenges with Neural Network Representation • Choosing inputs! • Choosing structure • How do we evolve the individuals - how do we mate the chromosomes/individuals?
Inputs • Problem dependent – Control – sensor data – Threat assesment – troops, troop movement – Flight or fight(mob) – player data (level, range, grouped? ) – Anticipation – player history
Outputs • What should the network do? – Control – movement directions – Threat assesment – react to opposing player’s troops? – Flight or fight(mob) – run or fight – Anticipation – player’s next move
Mating • Several different methods – If networks have the same structure, they could exchange weight values, or mutate current values Mother 2 1 3 4 Father
Mating 2 1 Mother 3 2 4 4 Father 3 1
Mating • Several different methods – If networks have the same structure, they could exchange weight values, or mutate values – Cross over/mutate nodes – Could mutate connections and nodes
• Structure – We can see how the different mating methods might cause problems with different network structures 5 6 2 5 6 1 3 4 2 4 3 1
• How do we choose a structure? – NEAT – method to mate NNs of different topologies (connections and node arrangements) 5 6 2 5 6 1 3 4 2 4 3 1
NEAT • Problem: Does my problem need 2 nodes or 5 nodes, 25, 100? • NEAT – Starts with very little nodes (input, output) – Evolves the necessary structure
Example: NEAT Drummer Time Measure Beat
Example: NEAT Drummer • Problem: We don’t know how to write a drum part for a song that we made. We want to use ANNs to make one for us. – 1. Find a suitable network structure. • Number of nodes • f(x) types – 2. Select outputs – 2. Select inputs
Example: NEAT Drummer Find a suitable network structure Step 1: How many nodes should we have? - We can choose explicitly - Or we can use an algorithm to choose for us (NEAT)
Example: NEAT Drummer f 1(x) = Choose fi(x) f 2(x) = f 3(x) = f 4(x) = f 1(x) f 2(x) f 3(x) f 5(x) = f 6(x) = f 4(x) f 5(x)
Example: NEAT Drummer • Choosing functions – (1/(1+e^-x) can approximate any function when it goes through enough nodes – What else could we choose? – What affect would the choices have on our overall network pattern over time?
Example: NEAT Drummer f 1(x) = f 2(x) = f 3(x) = f 4(x) = f 1(x) f 2(x) f 3(x) f 5(x) = f 6(x) = f 4(x) f 5(x)
Example: NEAT Drummer Choosing the outputs, we want a drum set f(x) f(x)
Example: NEAT Drummer Choosing the outputs, we want a drum set Bass Drum Hi-Hat f(x) Snare Drum f(x)
- Slides: 24