SlideShare a Scribd company logo
1 of 17
Università degli studi di Salerno
Corso di Laurea Magistrale in Ingegneria Informatica
Anno 2015/2016
Corso di Intelligenza Artificiale
Presentazione progetto Mrs. PacMan vs Ghosts Team
Gruppo: Capozzoli Settimio – Di Gruttola Carmine – Esposito Emiddio
Outline
• Introduzione
• Agente basato su utilità
• Agente basato su obiettivo
• Ottimizzazione
• Conclusione
2
Introduzione (1/2)
• Obiettivo: Sviluppare un controllore per Mrs. PacMan.
• Gioco a livelli, con quattro ambienti ciclici, dove attraverso pillole si
accumulano punti.
• Nell’ambiente un gruppo di fantasmi attacca Mrs. PacMan, se viene toccato
per tre volte il gioco finisce.
• Ogni livello finisce quando finiscono le pillole.
3
Introduzione (2/2)
• Si accumulano punti anche mangiando i fantasmi, dopo aver mangiato
apposite power pill.
• Il controllore dovrà decidere le mosse al fine di massimizzare il punteggio.
• Vincolo: la decisione dovrà essere presa in 40ms.
• I fantasmi possono essere controllati con quattro strategie diverse: Legacy,
Starter, Random, Aggressive.
• Si è presa in considerazione la strategia Starter.
4
Agente basato su utilità (1/4)
• Massimizza una funzione di utilità nello spazio degli stati.
• Strategia di ricerca: branching factor, profondità, vincoli temporali.
• Si è scelta la strategia Breadth First per esplorare tutte le possibili mosse
iniziali.
• Si termina la ricerca solo allo scadere dei 40ms.
• Si seleziona la mossa che porta allo stato trovato con la massima utilità.
5
Agente basato su utilità (2/4)
• Funzione di utilità: 𝑓 𝑆𝑡𝑎𝑡𝑒, 𝑆𝑡𝑎𝑡𝑒 𝑝𝑟𝑒𝑐 =
𝑠𝑐𝑜𝑟𝑒 − 𝑎𝑐𝑡𝑖𝑣𝑒𝑃𝑖𝑙𝑙𝑠 − 10 ∗ 𝑛𝑒𝑎𝑟𝑒𝑠𝑡𝑃𝑖𝑙𝑙𝐷𝑖𝑠𝑡 − 0.1 ∗ 𝑝𝑖𝑙𝑙𝑉𝑎𝑟𝑖𝑎𝑛𝑐𝑒
+
𝑒𝑑𝑖𝑏𝑙𝑒𝐺ℎ𝑜𝑠𝑡𝑠
1000 − 1000 ∗ 𝑑𝑖𝑠𝑡 𝑔ℎ𝑜𝑠𝑡, 𝑝𝑎𝑐𝑚𝑎𝑛
+
𝑒𝑣𝑖𝑙𝐺ℎ𝑜𝑠𝑡𝑠
1000 ∗ 𝑑𝑖𝑠𝑡 𝑔ℎ𝑜𝑠𝑡, 𝑝𝑎𝑐𝑚𝑎𝑛 − 𝑙𝑜𝑠𝑡𝐿𝑖𝑓𝑒 ∗ 106 − 𝑜𝑝𝑝𝑜𝑠𝑖𝑡𝑒𝑀𝑜𝑣𝑒 ∗ 104
− 𝑛𝑒𝑎𝑟𝑒𝑠𝑡𝐺ℎ𝑜𝑠𝑡𝐷𝑖𝑠𝑡 𝑆𝑡𝑎𝑡𝑒 > 10 ∗ 1000 ∗ 𝑛𝑒𝑎𝑟𝑒𝑠𝑡𝑃𝑜𝑤𝑒𝑟𝑃𝑖𝑙𝑙𝐷𝑖𝑠𝑡
6
Agente basato su utilità (3/4)
• I contributi positivi sono i contributi che l’agente deve aumentare, ad
esempio il punteggio
• I contributi negativi sono i contributi da annullare, ad esempio numero di
pillole o distanza di fantasmi mangiabili.
• Sono stati aggiunte penalizzazioni o premi costanti per alcuni eventi, quali
perdita di vite o mosse opposte.
• I pesi di ogni contributo sono stati identificati in maniera empirica.
7
Agente basato su utilità (4/4)
• L’agente, pur avendo un comportamento medio accettabile, presenta
comportamenti problematici che ne limitano le prestazioni.
• La struttura ha limitato la possibilità di intervenire per eliminare questi
comportamenti.
• Si è quindi valutato un secondo approccio: un agente basato su obiettivo.
8
Agente basato su obiettivo (1/4)
• Diviso in due livelli: scelta dell’obiettivo e scelta del percorso per
raggiungerlo.
• Primo livello: si seleziona l’obiettivo attraverso un albero decisionale.
• Secondo livello: si sceglie il percorso attraverso un A* sul grafo
dell’ambiente.
• Si seleziona la prima mossa da effettuare per seguire il percorso trovato.
9
Agente basato su obiettivo (2/4)
• Il primo livello decide sulla
base di distanze da alcuni
elementi quali distanze dalla
pillola più «vicina», dal
fantasma più vicino, dal
fantasma mangiabile più
«vicino» e dalla power pill più
vicina.
10
Agente basato su obiettivo (3/4)
• Il secondo livello assegna ad ogni nodo un peso sulla base della posizione e del
contenuto e calcola il percorso a peso minimo attraverso un A*.
• ℎ 𝑛 = 𝑠ℎ𝑜𝑟𝑡𝑒𝑠𝑡𝑃𝑎𝑡ℎ𝐷𝑖𝑠𝑡𝑎𝑛𝑐𝑒 𝑛, 𝑔𝑜𝑎𝑙
• 𝑔 𝑛 = 𝑔 𝑛 − 1 + 𝑐𝑜𝑠𝑡 𝑛 , 𝑔 0 = 0
• 𝑐𝑜𝑠𝑡 𝑛 =
𝑐𝑜𝑠𝑡 𝑒𝑙𝑒𝑚𝑒𝑛𝑡∗𝑤 𝑡𝑢𝑛𝑛𝑒𝑙
𝑑𝑖𝑠𝑡 𝑛,𝑔ℎ𝑜𝑠𝑡 ∗𝑐1
𝑤𝑡𝑢𝑛𝑛𝑒𝑙 = min
junctions
𝑑𝑖𝑠𝑡 𝑛, 𝑗𝑢𝑛𝑐𝑡𝑖𝑜𝑛 ∗ 𝑐2
11
Agente basato su obiettivo (4/4)
• Attraverso diverse prove empiriche sono state fissati dei valori per i
parametri sia del primo che del secondo livello.
• Sono state effettuate 1000 prove e sono stati calcolati i punteggi minimo,
massimo e medio.
12
Risultati
Minimo 1.120
Media 6.295
Massimo 23.640
Ottimizzazione (1/3)
• Nel corso delle prove empiriche si è notato un comportamento sensibile ai
parametri dell’algoritmo.
• Si è quindi pensato di ottimizzare le prestazioni in maniera automatica.
• Si è deciso di utilizzare un Random Mutation Hill Climbing per
identificare i parametri ottimali.
13
Ottimizzazione (2/3)
• Il valore di ogni soluzione (combinazione di parametri) è stato valutato
utilizzando la media del punteggio su 100 partite.
• La soluzione di partenza è stata generata in due modi distinti: in maniera
casuale e a partire dai valori trovati empiricamente.
• Il vicino è stato generato a caso tra tutti i possibili spostamenti di passo ∆
fissato, e selezionato il primo con valore maggiore.
• Si è imposto il limite a 20 spostamenti non migliorativi per risolvere il
problema delle spalle.
14
Ottimizzazione (3/3)
• Il miglior risultato è stato ottenuto partendo dalla soluzione generata in
modo casuale.
• In seguito ne sono state valutate le prestazioni effettuando una ulteriore
prova di 1000 partite e selezionando punteggio minimo, massimo e medio.
15
Risultati
Minimo 1.100
Media 6.525
Massimo 23.750
Conclusioni
• Sono stati valutati diversi approcci per sviluppare un agente intelligente in
un ambiente competitivo.
• Sono state valutate le caratteristiche dell’approccio selezionato ed è stato
utilizzato un ulteriore livello di intelligenza per ottimizzarne le prestazioni.
16
Grazie per l’attenzione
17

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Mrs Pac Man vs Ghost Team

  • 1. Università degli studi di Salerno Corso di Laurea Magistrale in Ingegneria Informatica Anno 2015/2016 Corso di Intelligenza Artificiale Presentazione progetto Mrs. PacMan vs Ghosts Team Gruppo: Capozzoli Settimio – Di Gruttola Carmine – Esposito Emiddio
  • 2. Outline • Introduzione • Agente basato su utilità • Agente basato su obiettivo • Ottimizzazione • Conclusione 2
  • 3. Introduzione (1/2) • Obiettivo: Sviluppare un controllore per Mrs. PacMan. • Gioco a livelli, con quattro ambienti ciclici, dove attraverso pillole si accumulano punti. • Nell’ambiente un gruppo di fantasmi attacca Mrs. PacMan, se viene toccato per tre volte il gioco finisce. • Ogni livello finisce quando finiscono le pillole. 3
  • 4. Introduzione (2/2) • Si accumulano punti anche mangiando i fantasmi, dopo aver mangiato apposite power pill. • Il controllore dovrà decidere le mosse al fine di massimizzare il punteggio. • Vincolo: la decisione dovrà essere presa in 40ms. • I fantasmi possono essere controllati con quattro strategie diverse: Legacy, Starter, Random, Aggressive. • Si è presa in considerazione la strategia Starter. 4
  • 5. Agente basato su utilità (1/4) • Massimizza una funzione di utilità nello spazio degli stati. • Strategia di ricerca: branching factor, profondità, vincoli temporali. • Si è scelta la strategia Breadth First per esplorare tutte le possibili mosse iniziali. • Si termina la ricerca solo allo scadere dei 40ms. • Si seleziona la mossa che porta allo stato trovato con la massima utilità. 5
  • 6. Agente basato su utilità (2/4) • Funzione di utilità: 𝑓 𝑆𝑡𝑎𝑡𝑒, 𝑆𝑡𝑎𝑡𝑒 𝑝𝑟𝑒𝑐 = 𝑠𝑐𝑜𝑟𝑒 − 𝑎𝑐𝑡𝑖𝑣𝑒𝑃𝑖𝑙𝑙𝑠 − 10 ∗ 𝑛𝑒𝑎𝑟𝑒𝑠𝑡𝑃𝑖𝑙𝑙𝐷𝑖𝑠𝑡 − 0.1 ∗ 𝑝𝑖𝑙𝑙𝑉𝑎𝑟𝑖𝑎𝑛𝑐𝑒 + 𝑒𝑑𝑖𝑏𝑙𝑒𝐺ℎ𝑜𝑠𝑡𝑠 1000 − 1000 ∗ 𝑑𝑖𝑠𝑡 𝑔ℎ𝑜𝑠𝑡, 𝑝𝑎𝑐𝑚𝑎𝑛 + 𝑒𝑣𝑖𝑙𝐺ℎ𝑜𝑠𝑡𝑠 1000 ∗ 𝑑𝑖𝑠𝑡 𝑔ℎ𝑜𝑠𝑡, 𝑝𝑎𝑐𝑚𝑎𝑛 − 𝑙𝑜𝑠𝑡𝐿𝑖𝑓𝑒 ∗ 106 − 𝑜𝑝𝑝𝑜𝑠𝑖𝑡𝑒𝑀𝑜𝑣𝑒 ∗ 104 − 𝑛𝑒𝑎𝑟𝑒𝑠𝑡𝐺ℎ𝑜𝑠𝑡𝐷𝑖𝑠𝑡 𝑆𝑡𝑎𝑡𝑒 > 10 ∗ 1000 ∗ 𝑛𝑒𝑎𝑟𝑒𝑠𝑡𝑃𝑜𝑤𝑒𝑟𝑃𝑖𝑙𝑙𝐷𝑖𝑠𝑡 6
  • 7. Agente basato su utilità (3/4) • I contributi positivi sono i contributi che l’agente deve aumentare, ad esempio il punteggio • I contributi negativi sono i contributi da annullare, ad esempio numero di pillole o distanza di fantasmi mangiabili. • Sono stati aggiunte penalizzazioni o premi costanti per alcuni eventi, quali perdita di vite o mosse opposte. • I pesi di ogni contributo sono stati identificati in maniera empirica. 7
  • 8. Agente basato su utilità (4/4) • L’agente, pur avendo un comportamento medio accettabile, presenta comportamenti problematici che ne limitano le prestazioni. • La struttura ha limitato la possibilità di intervenire per eliminare questi comportamenti. • Si è quindi valutato un secondo approccio: un agente basato su obiettivo. 8
  • 9. Agente basato su obiettivo (1/4) • Diviso in due livelli: scelta dell’obiettivo e scelta del percorso per raggiungerlo. • Primo livello: si seleziona l’obiettivo attraverso un albero decisionale. • Secondo livello: si sceglie il percorso attraverso un A* sul grafo dell’ambiente. • Si seleziona la prima mossa da effettuare per seguire il percorso trovato. 9
  • 10. Agente basato su obiettivo (2/4) • Il primo livello decide sulla base di distanze da alcuni elementi quali distanze dalla pillola più «vicina», dal fantasma più vicino, dal fantasma mangiabile più «vicino» e dalla power pill più vicina. 10
  • 11. Agente basato su obiettivo (3/4) • Il secondo livello assegna ad ogni nodo un peso sulla base della posizione e del contenuto e calcola il percorso a peso minimo attraverso un A*. • ℎ 𝑛 = 𝑠ℎ𝑜𝑟𝑡𝑒𝑠𝑡𝑃𝑎𝑡ℎ𝐷𝑖𝑠𝑡𝑎𝑛𝑐𝑒 𝑛, 𝑔𝑜𝑎𝑙 • 𝑔 𝑛 = 𝑔 𝑛 − 1 + 𝑐𝑜𝑠𝑡 𝑛 , 𝑔 0 = 0 • 𝑐𝑜𝑠𝑡 𝑛 = 𝑐𝑜𝑠𝑡 𝑒𝑙𝑒𝑚𝑒𝑛𝑡∗𝑤 𝑡𝑢𝑛𝑛𝑒𝑙 𝑑𝑖𝑠𝑡 𝑛,𝑔ℎ𝑜𝑠𝑡 ∗𝑐1 𝑤𝑡𝑢𝑛𝑛𝑒𝑙 = min junctions 𝑑𝑖𝑠𝑡 𝑛, 𝑗𝑢𝑛𝑐𝑡𝑖𝑜𝑛 ∗ 𝑐2 11
  • 12. Agente basato su obiettivo (4/4) • Attraverso diverse prove empiriche sono state fissati dei valori per i parametri sia del primo che del secondo livello. • Sono state effettuate 1000 prove e sono stati calcolati i punteggi minimo, massimo e medio. 12 Risultati Minimo 1.120 Media 6.295 Massimo 23.640
  • 13. Ottimizzazione (1/3) • Nel corso delle prove empiriche si è notato un comportamento sensibile ai parametri dell’algoritmo. • Si è quindi pensato di ottimizzare le prestazioni in maniera automatica. • Si è deciso di utilizzare un Random Mutation Hill Climbing per identificare i parametri ottimali. 13
  • 14. Ottimizzazione (2/3) • Il valore di ogni soluzione (combinazione di parametri) è stato valutato utilizzando la media del punteggio su 100 partite. • La soluzione di partenza è stata generata in due modi distinti: in maniera casuale e a partire dai valori trovati empiricamente. • Il vicino è stato generato a caso tra tutti i possibili spostamenti di passo ∆ fissato, e selezionato il primo con valore maggiore. • Si è imposto il limite a 20 spostamenti non migliorativi per risolvere il problema delle spalle. 14
  • 15. Ottimizzazione (3/3) • Il miglior risultato è stato ottenuto partendo dalla soluzione generata in modo casuale. • In seguito ne sono state valutate le prestazioni effettuando una ulteriore prova di 1000 partite e selezionando punteggio minimo, massimo e medio. 15 Risultati Minimo 1.100 Media 6.525 Massimo 23.750
  • 16. Conclusioni • Sono stati valutati diversi approcci per sviluppare un agente intelligente in un ambiente competitivo. • Sono state valutate le caratteristiche dell’approccio selezionato ed è stato utilizzato un ulteriore livello di intelligenza per ottimizzarne le prestazioni. 16