Post on 11-Apr-2015
description
transcript
Boids: Modeling and Understanding
emergent behavior
Sudeep Pillaisudeepp@umich.edu
Background
• Natural and often seen, yet so intriguingo Discrete birds, but an overall fluidic motion
o Magnificent synchronized behaviors
• Each bird dependent on each othero Based on local perception, they control themselves
o No awareness of global perspective
o Seems like a distributed control
o Is it intentional??
• Formationso Classic “Flying V” formation
– Reduce overall drag force as compared to flying alone
– Upwash produces free lift allowing lower angle of attack
– Lead bird – Two flanking birds dissipate downwash
Intentional flocking
• Reduced Energy expenditureo Greater number cause further reduction in induced drag
– Birds towards the middle gain considerable advantage
– Flanking birds gain free lift through upwash
– Reduced induced drag for birds being flanked
– Research – 70% more flight time, reduced heart rates
– Lead bird – Two flanking birds dissipate downwash
• Communication & Cooperationo Mutual cooperation – Flock Rotations
Evolved over time
Efficient flying formation thereby increasing flight time
Distribution of responsibility within flock during rotations
The “Flying V” formation
• Protection from predatorso Statistically improved survival of gene pool from attacks
o Each creature has knowledge of its local perception
o Cry signals for predator warning increases reaction time
• Improved foragingo Larger effective search patterns
• Advantages for social and mating activities
More reasons to flocking
• Formation of efficient flying ordero Reduced Energy expenditure
o Effective communication among flock
o Improved knowledge and avoidance of predator
o Improved foraging
o Increased social and mating activities
• Emergence - Complex global behavior (flocking)
arising from simple local interaction
Emergent behavior
• Do we model emergence in behavior or the
result of emergence (i.e. flocking) ?o Relatively trivial (using current technology) to create a model
that simulates flocking (boids)
o Less trivial to model emergence and tracing the path towards
flocking
• Accomplishing • the former leads us to understanding the latter
• the latter is difficult, and very specific
Modeling emergent behavior
• Basicso Separation, Alignment, Cohesion
• Slight modifications (In decreasing order of precedence)
o Collision Avoidance – avoid collision with nearby flockmates
o Velocity Matching – match velocity with nearby flockmates
o Flock Centering – stay close to nearby flockmates
• Additional modificationso Tendency towards goal, Limiting flock speed, Bounding
workspace, Perching, Obstacle avoidance, Boid neighborhood
Modeling boids
The Algorithm
flock_init_positions()
Structure b (boids)FOR EACH BOID b
b.position =25* [2*rand-1; 2*rand-1;2* rand-1];b.velocity = [0;0;0];
END
Main instance
Flock_init_positions ()LOOP
flock_draw_boids()flock_move()
END LOOP
Rule 1 : SeperationPROCEDURE rule1(boid bJ)
Vector c = 0;FOR EACH BOID b
IF b != bJ THENIF |b.position - bJ.position| < 100 THEN
c = c - (b.position - bJ.position)END IF
END IFENDRETURN c v1
END PROCEDURE
Rule 2: Velocity Matching PROCEDURE rule2(boid bJ)
Vector pvJ
FOR EACH BOID bIF b != bJ THEN
pvJ = pvJ + b.velocityEND IF
ENDpvJ = pvJ / N-1RETURN (pvJ - bJ.velocity) / 8 v2
END PROCEDURE
Rule 3: Flock centering PROCEDURE rule3(boid bJ)
Vector pcJ
FOR EACH BOID bIF b != bJ && |b.position - bj.position| < 8
THENpcJ = pcJ + b.position
END IFENDpcJ = pcJ / N-1RETURN (pcJ - bJ.position) / 100 v3
END PROCEDURE
Moving boids – flock_move()PROCEDURE
move_all_boids_to_new_positions()Vector v1, v2, v3Boid bFOR EACH BOID b
v1 = rule1(b)v2 = rule2(b)v3 = rule3(b)…..…..…..b.velocity = b.velocity + v1 + v2 + v3 + ….b.position = b.position + b.velocity
ENDEND PROCEDURE
The Algorithm (2) – Further additions
Predator interaction Same procedure as tendency towards goal, except a negative effect.
Return –v (from tend_to_goal) v6
FLOCK LEARNING Fitness functions being iteratively manipulated based on behavior needs
FOR EACH BOID bv1 = c1*rule1(b)v2 = c2*rule2(b)v3 = c3*rule3(b)…..
b.velocity = b.velocity + v1 + v2 + v3 + ….b.position = b.position + b.velocity
END
Tendency towards goal – flock_tendency()
PROCEDURE tend_to_goal(Boid b)Vector goalRETURN (goal - b.position) / 100 v4
END PROCEDURE
Limiting Speed – flock_limitvel()PROCEDURE limit_velocity(Boid b)
Integer vlimVector vIF norm(b.velocity) > vlim THEN
b.velocity = (b.velocity/|b.velocity|*vlim)END IF
END PROCEDURE
Workspace bound – flock bound()PROCEDURE bound_position(Boid b)
Integer Xmin, Xmax, Ymin……Vector vIF b.position.x < Xmin THEN
v.x = 10ELSE IF b.position.x > Xmax THEN
v.x = -10END IF…......Return v v5
END PROCEDURE
Moving boids – flock_move()PROCEDURE
move_all_boids_to_new_positions()Vector v1, v2, v3Boid bFOR EACH BOID b
v1 = rule1(b)v2 = rule2(b)v3 = rule3(b)…..…..…..b.velocity = b.velocity + v1 + v2 + v3 + ….b.position = b.position + b.velocity
ENDEND PROCEDURE
• Anti-flockingo Dispersion of flock due to predator
o Negating flock centering almost solves the problem
• Other behaviorso Negating separation – Boids run into each other
o Negating velocity matching – Boids have semi-chaotic
oscillations
• Different permutations of different behaviors with different fitness
functions not necessarily modeling flocks realistically
Other possibilities
• Trial and error and manual tweaking of
parameters using GAso Flocks can be tuned to exhibit interesting behavior
o Practical application may be limited
• Particle Swarm Optimization (PSO)o Shares evolutionary computation techniques such as GA
o Unlike GA, it has no evolution operators (crossover, mutation)
o Strategy
Initialized with random group
Closest bird to food leads the flock
Solution to the optimization is a single bird, not a group
Each bird‟s fitness is re-evaluated and optimized
Optimization
Simulation
• Modeling from the perspective of the birdo Model effects of other birds that are in its view (local)
o Model effects of aerodynamics (CFD)
o Does it support the “Flying V formation”?
• Implementing highway traffic based on
distributed behavior controlo Simple to implement
o Highly reliable
o Energy efficient
Future work
• Several models and techniques have been
developedo Some based on the behavior of flocks
o Some based on optimizing a specific task
• Similar to how we think of evolution, have
flocks „emerged‟ completely?o Flocking in groups can be beneficial, as is evident. Are we in a
transitional phase? Or will they „emerge‟ further to optimize
flocking behavior?
o Can we predict of any possible optimizations they may
possibly undertake?
My thoughts