Particle Swarm Optimization
to solve navigation and traveling salesman
problems in the Pacman world.
By David Rigan
Introduction
Inspired by the flocking and schooling patterns of birds and fish, Particle Swarm
Optimization (PSO) was invented by Russell Eberhart and James Kennedy in
1995. Originally, these two started out developing computer software simulations
of birds flocking around food sources, then later realized how well their algorithms
worked on optimization problems.
Key Value
The algorithm keeps track of three global variables:
● Target value or condition
● Global best (gBest) value indicating which particle's data is currently closest
to the Target
● Stopping value indicating when the algorithm should stop if the Target isn't
found
Each particle consists of:
● Data representing a possible solution
● A Velocity value indicating how much the Data can be changed
● A personal best (pBest) value indicating the closest the particle's Data has
ever come to the Target
Figure 1. A few common population topologies
(neighborhoods). (A) Single-sighted, where
individuals only compare themselves to the next
best. (B) Ring topology, where each individual
compares only to those to the left and right. (C)
Fully connected topology, where everyone is
compared together. (D) Isolated, where
individuals only compare to those within
specified groups.
Population Topologies
Figure 1.
Flow Diagram
Figure 2. Flow diagram illustrating the
particle swarm optimization algorithm.
Figure 2
Pseudocode
For each particle
{
Initialize particle
}
Do until maximum iterations or minimum error criteria
{
For each particle
{
Calculate Data fitness value
If the fitness value is better than pBest
{
Set pBest = current fitness value
}
If pBest is better than gBest
{
Set gBest = pBest
}
}
For each particle
{
Calculate particle Velocity
Use gBest and Velocity to update particle Data
}
Track Layout
● Initial States
● Target
DEMO
Particle Swarm Optimization
to solve navigation and traveling salesman
problems in the Pacman world.
Source
http://mnemstudio.org/particle-swarm-introduction.htm
http://inst.eecs.berkeley.edu/~cs188/fa18/projects.html

Particle swarm optimization on pacman game problem solving

  • 1.
    Particle Swarm Optimization tosolve navigation and traveling salesman problems in the Pacman world. By David Rigan
  • 2.
    Introduction Inspired by theflocking and schooling patterns of birds and fish, Particle Swarm Optimization (PSO) was invented by Russell Eberhart and James Kennedy in 1995. Originally, these two started out developing computer software simulations of birds flocking around food sources, then later realized how well their algorithms worked on optimization problems.
  • 3.
    Key Value The algorithmkeeps track of three global variables: ● Target value or condition ● Global best (gBest) value indicating which particle's data is currently closest to the Target ● Stopping value indicating when the algorithm should stop if the Target isn't found Each particle consists of: ● Data representing a possible solution ● A Velocity value indicating how much the Data can be changed ● A personal best (pBest) value indicating the closest the particle's Data has ever come to the Target
  • 4.
    Figure 1. Afew common population topologies (neighborhoods). (A) Single-sighted, where individuals only compare themselves to the next best. (B) Ring topology, where each individual compares only to those to the left and right. (C) Fully connected topology, where everyone is compared together. (D) Isolated, where individuals only compare to those within specified groups. Population Topologies Figure 1.
  • 5.
    Flow Diagram Figure 2.Flow diagram illustrating the particle swarm optimization algorithm. Figure 2
  • 6.
    Pseudocode For each particle { Initializeparticle } Do until maximum iterations or minimum error criteria { For each particle { Calculate Data fitness value If the fitness value is better than pBest { Set pBest = current fitness value } If pBest is better than gBest { Set gBest = pBest } } For each particle { Calculate particle Velocity Use gBest and Velocity to update particle Data }
  • 7.
    Track Layout ● InitialStates ● Target
  • 8.
    DEMO Particle Swarm Optimization tosolve navigation and traveling salesman problems in the Pacman world.
  • 9.

Editor's Notes

  • #3 Terinspirasi oleh pola burung dan ikan, Particle Swarm Optimization (PSO) diciptakan oleh Russell Eberhart dan James Kennedy pada tahun 1995. Awalnya, keduanya mulai mengembangkan simulasi perangkat lunak komputer dari burung yang berbondong-bondong di sekitar sumber makanan, kemudian menyadari bagaimana baik algoritma mereka bekerja pada masalah optimasi.
  • #4 Algoritma memiliki tiga variabel global: Target Value. Nilai atau Kondisi yang ingin dicapai (Target) Nilai Global Best (gBest). Nilai yang menunjukkan data partikel mana yang saat ini paling dekat dengan Target. Stoping Value. Nilai yang menunjukkan kapan algoritma akan berhenti jika Target tidak ditemukan. Setiap partikel terdiri dari: Data yang mewakili solusi yang memungkinkan Data partikel bisa menjadi apa saja, Pada contoh burung yang berkelompok, datanya adalah koordinat X, Y, Z dari masing-masing burung. Koordinat individu dari masing-masing burung akan mencoba untuk bergerak lebih dekat ke koordinat burung yang lebih dekat dengan koordinat makanan (gBest). Jika data adalah pola atau urutan, maka setiap bagian data akan dimanipulasi hingga polanya sesuai dengan pola target. Nilai Kecepatan yang menunjukkan berapa banyak Data dapat diubah Nilai kecepatan dihitung berdasarkan seberapa jauh data individu dari target mendapatkannya. Semakin jauh, semakin besar nilai kecepatannya. Dalam contoh burung, individu-individu yang paling jauh dari makanan akan berusaha untuk mengikuti yang lain dengan terbang lebih cepat ke arah burung terbaik. Jika data adalah pola atau urutan, kecepatan akan menggambarkan betapa berbedanya pola dari target, dan dengan demikian, berapa banyak yang perlu diubah untuk mencocokkan target. Personal Best (pBest). Nilai Pribadi terbaik yang menunjukkan Data Partikel terdekat yang pernah sampai ke Target Setiap partikel pBest hanya menunjukkan data terdekat yang pernah dituju ke target sejak algoritma dimulai. Nilai gBest hanya berubah ketika nilai pBest partikel mana pun lebih mendekati target daripada gBest. Melalui setiap iterasi dari algoritma, gBest secara bertahap bergerak lebih dekat dan lebih dekat ke target sampai salah satu partikel mencapai target.
  • #5 Beberapa topologi populasi umum (lingkungan) Single-sighted, di mana individu hanya membandingkan dirinya dengan yang terbaik berikutnya Topologi ring, di mana setiap individu hanya membandingkannya dengan yang kiri dan kanan. Topologi yang terhubung sepenuhnya, di mana setiap orang dibandingkan bersama. Terisolasi, di mana individu hanya dibandingkan dengan mereka dalam kelompok tertentu. Definisi lingkungan dan bagaimana mereka digunakan memiliki efek yang berbeda pada perilaku algoritma.
  • #6 menginisialisasi partikel menghitung nilai kebugaran untuk setiap partikel Apakah nilai kebugaran saat ini lebih baik daripada pbest Jika Ya > menetapkan kebugaran saat ini sebagai pbest baru Jika Tidak > simpan pbest sebelumnya tetapkan nilai partikel pbest terbaik ke gbest menghitung kecepatan untuk setiap partikel gunakan nilai kecepatan masing-masing partikel untuk memperbarui nilai datanya Apakah target atau jangka waktu maksimum tercapai ? Jika Ya > Berakhir Jika Tidak kembali ke point 2 Diagram alur yang menggambarkan algoritma optimisasi partikel swarm.