420 likes | 583 Views
Swarms and Distributed Computing. Dennis Shasha. Swarm Intelligence -- examples. Given two paths of different lengths, ants will discover the path of shortest length. Given a product, no matter how complex, free competition will lead to fair prices. Adam Smith’s invisible hand.
E N D
Swarms and Distributed Computing Dennis Shasha
Swarm Intelligence -- examples • Given two paths of different lengths, ants will discover the path of shortest length. • Given a product, no matter how complex, free competition will lead to fair prices. Adam Smith’s invisible hand. • People group together to form cultures (e.g. always cooperate in one; always compete in another).
Swarm Intelligence -- requires flexibility • Place a bunch of flies in a jar, lay the jar so its bottom is facing an open window, then open the lid. • Flies will bump around randomly then fly out the lid side, find the open window and leave. • Bees will continually try to go out the bottom and will eventually die.
Swarm Intelligence -- requires willingness to explore • Place a bunch of flies in a jar, lay the jar so its bottom is facing an open window, then open the lid. • Flies will bump around randomly then fly out the lid side, find the open window and leave. • Bees will continually try to go out the bottom and will eventually die. Note: This is in fact a property of intelligence and applies to individual flies/bees as well.
Swarm Intelligence -- requires learning from others • Evolution works quite slowly. One species may evolve a new degree of freedom in a limb. • Human development is perhaps a million times faster, e.g. in 100 years a species that can’t jump that high flies at orbital velocities. • “Memes” (ideas) spread essentially instantly. Improvements are rapid.
Stigmergy:how do ants learn from one another • Stigmergy is what happens when work changes the environment. • Thus, work becomes the external energy. • An ant, essentially blind, knows how to explore randomly follow smells (pheromones) left by itself or others
Finding the shortest path to food Ant A Nest food Ant B
Ant B discovers food Ant A Nest food Ant B
Ant A discovers foodAnt B follows pheromones home Ant A Nest food Ant B
Ants C and D follow B’s pheromones (shorter path) Ant A Nest food Ant C, Ant D
What Accomplished • Blind ants are able to “follow their noses” to find an optimal path. • They communicate by scent (pheromones). • Randomness followed by “positive feedback” or amplification, because C and D will now lay down their own pheromones.
What if Lower Path is blocked (perhaps later)? Weak pheromones Nest food Strong pheromones Ants X, Y, Z Barrier
Ants retrace steps Weak pheromones Nest food Strong pheromones Ants X, Y, Z Barrier
Ants follow weaker pheromones Weak pheromones Ants X, Y, Z Nest food Strong pheromones Barrier
Weak become strong through repeated use and pheromones Strong pheromones More ants Nest food Weak pheromones Barrier
Simple rules create intelligent designs • Random exploration. • Communication through scents (stigmergy) • Positive feedback to establish preferred route. • Adaptation to changing conditions. No complaining, no explaining.
Cool story but can we use it? • Consider a communication network in which links appear and disappear over the course of hours. • If A wants to communicate with B, A might send out “ant” tokens that try to find B, retrace their steps and announce their length. Communication takes place along shortest path. • Longer paths can still be used if there is a break in a link. • May want continuous exploration.
Task Allocation in a Swarm • Seed harvester ants need to carry food back to their nest. • Ants pass food down a chain. • Ant carries food down the chain until it reaches the next ant. Transfers and then returns for more. • “Bucket Brigade”
Typical state of the ants:D gets more food, gives to C, B returns to get more from C. nest food Ant B Ant A Ant C Ant D
Benefits of bucket brigade • Geometrically efficient – can work in a very narrow setting. • Robust to failure – if an ant drops out, other ants can pick up the slack without changing the protocol. • Robust to differences in speed – if three ants B, C, D are in a row and C is slowest, then B and D will end up walking farther again without changing protocol.
Warehouse tasking Orders can come in anywhere Worker 1 Worker 2 Worker 3….
Organization 1: zones for stockingand delivery • Worker k is responsible for all goods in zone k. • When an order comes in for zone k, worker k takes the appropriate good to the exit. • When several orders enter concurrently, there might be traffic jams at the exit.
Organization 2: zone for stockingbucket brigade for delivery • Worker k is responsible for all goods in zone k. • When an order comes in for zone k, worker k takes the appropriate good towards the exit until he meets worker k-1 and then transfers. • Worker k-1 goes towards k-2 and does transfer.
Which is better? • Assuming no traffic jams, for which order traffic would zone delivery be better? • For which ones would bucket brigade be better? • What if there is some cost to transfer? • What if you could anticipate the traffic?
Which is more flexible? • Worker gets hurt. • Worker is slower than others. • Worker is more lazy than others. • Where should the fast workers go?
Office workflow: claims management • Gatekeeper routes to specialists. • Specialists route to one another. • Does this work for such work?
Bucket Brigade for Offices • What if a specialist is missing? • Have pools of interchangeable specialists • What about a global view of the customer? • Really need good computer support, e.g. has this customer been well treated in the past? Is this customer possibly exercising fraud? • Are the incentives consistent with customer service? • Keep a notion of global response time.
Tie-breaking by Swarms • A group of ants want to sort different sized youngsters: microlarvae, macrolarvae, pupae. • At first they are not sorted, but there are, by chance, local concentrations of one type or the other. • What local algorithm could each ant use to concentrate the different youngster types in uniform clusters?
Tie-breaking Protocol • Move youngster type to location where there are a lot of youngsters of that type. • Apparently this can be done entirely by smell. • Lesson for computer science? Certainly not if global information is available. Bucket sort vs. quicksort • But intriguing and very parallel.
Tropical Termites and the Arch • Colonies of tropical termites will build domes (i.e. intersecting arches). • Doing this with humans requires centralized control and synchronization. • Termites build pillars and then the pillars fall towards one another. • How?
Incredibly Simple Rules • Go towards strongest scent. • Drop dirt there. • Ant will find the two towers equally strong. • They will choose one but will tend to go towards the inside of that tower. • That’s why the towers fall towards one another. • No synchronization because random and many. (Bacterial fried eggs.)
References so far • E. Bonabeau and G. Theraulaz, "Swarm smarts", Scientific American, pp. 72-79, March 2000. http://dsp.jpl.nasa.gov/members/payman/swarm/sciam_0300.pdf • E. Bonabeau, C. W. Hunt, P. Gaudiano “Agent-Based Modeling for Testing and Designing Novel Decentralized Command and Control System Paradigms” July 2003
Is there a theory to all this? • Not really. There seem to be useful analogies and some simulation software available from the Santa Fe institute. • A true theory would need to explain altruism in a swarm (why does an ant/bee/soldier sacrifice for the sake of the whole). • Most individuals in species show altruism when genes are held in common.
Pareto Optima Model • Suppose you have two objectives in life: money and location. You can get paid more in city X but you prefer city Y. So, there is a tradeoff: you can move from X to Y but only after losing some money. So, (X, $1 million) may be traded for (Y, $500,000) • “The improvement of one objective function value comes only at the cost of worsening some other objective function value.” • So each of above is Pareto optimum.
Nash Equilibrium Model • Suppose you are playing a multi-player game. • If no single person can improve his/her lot by changing strategies, then the game is in Nash equilibrium.
Nash vs. Pareto • Consider prisoner’s dilemma: Bob and Alice are prisoners. If they protect one another, they get little punishment (value -2). If one blames the other and the other protects the first then blamer goes free (value 0) and blamee gets more prison (value -4). If they both blame one another, they both suffer more punishment (value -3).
Nash vs. Pareto II • For Pareto, the state in which they both protect one another is a Pareto optimum because leaving that state would hurt the other player. • For Nash, the mutual protection state is not an equilibrium because either wins more by blaming.
Nash vs. Pareto markets vs. societies • Nash models markets. All agents act selfishly. • Pareto models very stable bureaucracies. Nobody hurts anyone else. • Swarms can take on both characteristics.
Pareto Optima Model • Question: how can a bunch of swarm elements each with a local Pareto optimum achieve a global Pareto optimum? • It does work in perfect markets. Where else? • Ref: “Foundations of Swarm Intelligence: From Principles to Practice” Mark Fleischer http://arxiv.org/PS_cache/nlin/pdf/0502/0502003.pdf
Culture and Game Theory • “Culture can be defined as individual and community level behavioral patterns that depend upon context and are often suboptimal.” • Game theory is about players, each trying to optimize. • In some games, cooperation brings more profit to individuals than competition. In other games, the reverse.
“Looking out for number 1” vs“We are all in this together” • Suppose a group of people are farmers. When a new couple needs a home, the whole community raises a barn. Equipment is shared, etc. • How are such people going to act if they see someone in need? • Ask the same question if the people are a collection of day traders.
How to model this • Intra-individual consistency: you are not selfish once and altruistic another time. • Inter-agent consistency: you act like your neighbors. • Behavioral stickiness: individuals do not alter their behavior despite changes to their incentives. • Ref: “CAN GAME(S) THEORY EXPLAIN CULTURE? THE EMERGENCE OF CULTURAL BEHAVIOR WITHIN MULTIPLE GAMES” Jenna Bednar and Scott Page