240 likes | 494 Views
Jo Skjermo IDI/NTNU Jo.skjermo@idi.ntnu.no. Particle Swarm Optimization. Artificial life. A-Life studies how computational techniques can help when studying biological phenomena A-Life studies how biological techniques can help out with computational problems For example
E N D
Jo Skjermo IDI/NTNU Jo.skjermo@idi.ntnu.no Particle Swarm Optimization
Artificial life • A-Life studies how computational techniques can help when studying biological phenomena • A-Life studies how biological techniques can help out with computational problems For example • artificial neural network is a simplified model of humanbrain. • genetic algorithm is inspired by the human evolution.
Flocking • Simple «stupid» individuals • But the flock seems smart • with coordinated behaviour • The whole is greater than the sum of its parts(Aristotle)
swarmintelligence • Why? Among other things: the social aspect • Interaction with the environment • Interaction with each other • Simple individuals • Ants • Bees • “Particles”? • Collective behavior better then individual • Beehive • Anthill
Some history - Boids • Craig Reynolds, 1986 • Acomputer model of coordinated animal motion such as bird flocks and fish schools. • Flocks, herds, and schools: A distributed behavioral model. ACM Computer Graphics, 21(4):25–34, 1987. • http://www.red3d.com/cwr/boids/ • 3 simple rules for each individual • Cohesion: steer to • move toward the average • position of local flockmates • Alignment: steer • towards the average • heading of local flockmates Separation: steer to avoid crowding local flockmates
ParticleSwarmOptimization • James Kennedy and Russell Eberhart. 1995 • Particleswarmoptimization. In Proceedings of IEEE International Conference on Neural Networks • Added some more simple rules to each individual… • Roost: steer towards the “roost” • Memory: remember when is wasclosest to the “roost” • Communication: tell everyone else where is was closest to the “roost” Aftersome time, all boidslandedontheroost Figures: Marco A. Montes de Oca
PSO – thebasicidea • Roost = an unknown function, or unknown parameters to a function • Boids = particles that “Fly around” in the search space • Will the boid ‘land’ at the minimum?
Basic, fullyconnected PSO • p is the best “position” the particle has seen this far. • g is the best “position” all the particles has seen this far (if fully connected). • r1 and r2 are random values in the range [0, 1) • c1 is a weight for the local attraction in the range [0, 2) • c2 is a weight for the global attraction in the range [0, 2) Pro tip 1: you might consider using a weight on the inertia also Pro tip 2: use random x(t)’s (positions) at the first iteration Pro tip 3: you might consider clamping you velocity between a min and max value Inertia Particleselfmemory Global influence (social part) New velocity=
PSO – thebasicidea • New “position” is calculated as • previous position + new velocity
PSO – assignment • You will implement your own PSO • You will implement your own PSO • You will implement your own PSO • You will implement your own PSO • You will implement your own PSO • You will implement your own PSO • We will check (i.e. you must deliver your code) • Yes, you can work in groups of two
PSO – thecircle problem (sometimesknown as thesphere problem) • f(u1,…,ux) = ( (u1 * u1) + … + (ux * ux)) • The 1D case: • f(u1) = u1*u1 • Eks: f(2) = 2*2 = 4 • Task 1: • Fitnesfunction is f(u) • Use PSO to find a «u» thatminimizes f(u)… • Hint: f(0.0) = 0.0 • Pro Hint 2D case: f(0.0, 0.0)=0.0
PSO • Task 2 • a)particle should use only the 3 “nearest” neighbors when computing the social part of velocity vector update. • i.e. dynamic sub-swarms • Hint: g(t) • b) see given formula • As given: multiply inertia with a decreasing weight, so that inertia decreases • Alternatively, you can decrease-weight the whole velocity vector (state it in the report if you do)
PSO • Task 3 • NOTE! • You will find solutions/positions that is not valid (weight > 1000kg) • Several methods to handle this… • Don’t update fitness • Negative fitness • Throw away solution, make a random new one • Choose one (and be prepared for questions during demo)
PSO • Task 4 • To make life simpler for yourself, init with a fixed seed for your randoms (while testing/developing)
PSO • Next lectures… • 5 Nov • Answering questions • 13 Nov (not the 12’th) 12 to 13/14'ish • Answering questions (at room 360 IT-Vest) • Yes, you can work in groups of two • Pay attention to the home page for making arrangements/booking time for demonstration • Yes, a small written report (and the code) must be delivered at the same time as the demonstration.