Swarms and Distributed Computing

42
Swarms and Distributed Computing Dennis Shasha

description

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. - PowerPoint PPT Presentation

Transcript of Swarms and Distributed Computing

Page 1: Swarms and  Distributed Computing

Swarms and Distributed Computing

Dennis Shasha

Page 2: Swarms and  Distributed Computing

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).

Page 3: Swarms and  Distributed Computing

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.

Page 4: Swarms and  Distributed Computing

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.

Page 5: Swarms and  Distributed Computing

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.

Page 6: Swarms and  Distributed Computing

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 toexplore randomly

follow smells (pheromones) left by itself or others

Page 7: Swarms and  Distributed Computing

Finding the shortest path to food

Nest food

Ant A

Ant B

Page 8: Swarms and  Distributed Computing

Ant B discovers food

Nest food

Ant A

Ant B

Page 9: Swarms and  Distributed Computing

Ant A discovers foodAnt B follows pheromones home

Nest foodAnt A

Ant B

Page 10: Swarms and  Distributed Computing

Ants C and D follow B’s pheromones (shorter path)

Nest food

Ant A

Ant C, Ant D

Page 11: Swarms and  Distributed Computing

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.

Page 12: Swarms and  Distributed Computing

What if Lower Path is blocked (perhaps later)?

Nest food

Weak pheromones

Ants X, Y, Z Barrier

Strong pheromones

Page 13: Swarms and  Distributed Computing

Ants retrace steps

Nest food

Weak pheromones

Ants X, Y, Z

Barrier

Strong pheromones

Page 14: Swarms and  Distributed Computing

Ants follow weaker pheromones

Nest food

Weak pheromones

Ants X, Y, Z

Barrier

Strong pheromones

Page 15: Swarms and  Distributed Computing

Weak become strong through repeated use and pheromones

Nest food

Strong pheromones

More ants

Barrier

Weak pheromones

Page 16: Swarms and  Distributed Computing

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.

Page 17: Swarms and  Distributed Computing

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.

Page 18: Swarms and  Distributed Computing

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”

Page 19: Swarms and  Distributed Computing

Typical state of the ants:D gets more food, gives to C, B

returns to get more from C.

nestfood

Ant A Ant B Ant C Ant D

Page 20: Swarms and  Distributed Computing

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.

Page 21: Swarms and  Distributed Computing

Warehouse tasking

Worker 1 Worker 2 Worker 3….

Orders can come in anywhere

Page 22: Swarms and  Distributed Computing

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.

Page 23: Swarms and  Distributed Computing

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.

Page 24: Swarms and  Distributed Computing

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?

Page 25: Swarms and  Distributed Computing

Which is more flexible?

• Worker gets hurt.

• Worker is slower than others.

• Worker is more lazy than others.

• Where should the fast workers go?

Page 26: Swarms and  Distributed Computing

Office workflow: claims management

• Gatekeeper routes to specialists.

• Specialists route to one another.

• Does this function well for such work?

Page 27: Swarms and  Distributed Computing

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.

Page 28: Swarms and  Distributed Computing

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?

Page 29: Swarms and  Distributed Computing

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.

Page 30: Swarms and  Distributed Computing

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?

Page 31: Swarms and  Distributed Computing

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.)

Page 32: Swarms and  Distributed Computing

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

Page 33: Swarms and  Distributed Computing

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.

Page 34: Swarms and  Distributed Computing

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.

Page 35: Swarms and  Distributed Computing

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.

Page 36: Swarms and  Distributed Computing

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).

Page 37: Swarms and  Distributed Computing

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.

Page 38: Swarms and  Distributed Computing

Nash vs. Pareto markets vs. societies

• Nash models markets. All agents act selfishly. Free market is efficient. It also models cheating (if I cut the line and you don’t, I win; so we all end up cutting). That is inefficient.

• Pareto models very stable bureaucracies (and friendly academic departments). Nobody hurts anyone else.

• Swarms can take on both characteristics.

Page 39: Swarms and  Distributed Computing

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

Page 40: Swarms and  Distributed Computing

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.

Page 41: Swarms and  Distributed Computing

“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 (or fishermen).

Page 42: Swarms and  Distributed Computing

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 Theory Explain Culture? The Emergence of Cultural Behavior Within Multiple Games” Jenna Bednar and Scott Page