Biologically inspired computation
Download
1 / 66

Biologically Inspired Computation - PowerPoint PPT Presentation


  • 116 Views
  • Updated On :

Biologically Inspired Computation. Lecture 5: Introducing Swarm Intelligence contents: the behavior of natural swarms and flocks -- Reynold’s rules and swarm simulation. Some of the images in this lecture come from slides for a Course in Swarm Intelligence given at :. But first:.

Related searches for Biologically Inspired Computation

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Biologically Inspired Computation' - raimondo


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Biologically inspired computation

Biologically Inspired Computation

Lecture 5: Introducing Swarm Intelligence

contents: the behavior of natural swarms and flocks -- Reynold’s rules and swarm simulation.

Some of the images in this lecture come from slides for a Course in Swarm Intelligence given at :


But first
But first:

  • Finishing off encodings

  • Information about mandatory reading

  • Information about CW2


E g encoding a timetable i
E.g. encoding a timetable I

4, 5, 13, 1, 1, 7, 13, 2

Exam2 in 5th slot

Exam1 in 4th slot

Etc …

  • Generate any string of 8 numbers between 1 and 16,

  • and we have a timetable!

  • Fitness may be <clashes> + <consecs> + etc …

  • Figure out an encoding, and a fitness function, and

  • you can try to evolve solutions.


E g encoding a timetable ii
E.g. encoding a timetable II

4, 5, 13, 1, 1, 7, 13, 2

Etc …

Use the 13th clash-free slot for exam3

Use the 5th clash-free slot for exam2 (clashes with E4,E8)

Use the 4th clash-free slot for exam1


So a common approach is to build an encoding around an algorithm that builds a solution
So, a common approach is to build an encoding around an algorithm that builds a solution

  • Don’t encode a candidate solution directly

  • … instead encode parameters/features for a constructive algorithm that builds a candidate solution

E2


E g bin packing given collection of items pack them into the fewest possible number of bins
e.g.: bin-packing – given collection of items, pack them into the fewest possible number of bins


E g bin packing given collection of items pack them into the fewest possible number of bins1
e.g.: bin-packing – given collection of items, pack them into the fewest possible number of bins


Engineering constructive algorithms
Engineering Constructive Algorithms into the fewest possible number of bins

A typical constructive algorithm for bin-packing:

Put the items in a specific sequence (e.g. smallest to largest)

Initialise solution

Repeat nitems times

choose next item, place it in first bin it fits (create a new empty bin if necessary)

Indirect Encodings often involve using a constructive algorithm,



First-fit Ascending algorithm for bin-packing


First-fit Ascending algorithm for bin-packing


First-fit Ascending algorithm for bin-packing


First-fit Ascending algorithm for bin-packing


First-fit Ascending algorithm for bin-packing


First-fit Ascending algorithm for bin-packing


Example using first fit descending
Example using First-Fit Descending algorithm for bin-packing

First-fit Descending


First-Fit Descending algorithm for bin-packing


First-Fit Descending algorithm for bin-packing


First-Fit Descending algorithm for bin-packing


First-Fit Descending algorithm for bin-packing


First-Fit Descending algorithm for bin-packing


Notes
Notes: algorithm for bin-packing

  • In other problems, FFA gets better results than FFD

  • There are many other constructive heuristics for bin packing, e.g. Using formulae that choose next item based on distribution of unplaced item sizes and empty spaces ...

  • There are constructive algorithms for most problems (e.g. Timetabling, scheduling, etc ....)

  • Often, ‘indirect encodings’ for EAs use constructive algorithms.

  • Common approach: the encoding is permutation, and the solution is built using the items in that order

  • READ THE FALKENAUER PAPER TO SEE GOOD EA ENCODING FOR BIN-PACKING


Encodings that use constructive algorithms
Encodings that use constructive algorithms algorithm for bin-packing

The indirect encoding for timetabling, a few slides ago, is an example.

The ‘underlying’ constructive algorithm is:

Line up the exams in order e1, e2, … eN

Repeat until all exams are scheduled:

take the next exam in the list, and put it in the first place it can go without clashes

This provides only a single solution, the same every time we run it. This may be very bad in terms of other factors, such as consecutive exams, time allowed for marking, etc.

How did we modify it so that it could generate a big space of different solutions?


Encodings that use constructive algorithms1
Encodings that use constructive algorithms algorithm for bin-packing

Line up the exams in order e1, e2, … eN

Repeat until all exams are scheduled:

take the next exam in the list, and put it in the first place it can go without clashes


Encodings that use constructive algorithms2
Encodings that use constructive algorithms algorithm for bin-packing

Line up the exams in order e1, e2, … eN

Repeat until all exams are scheduled:

take the next exam in the list, and put it in the first place it can go without clashes


Encodings that use constructive algorithms3
Encodings that use constructive algorithms algorithm for bin-packing

Line up the exams in order e1, e2, … eN

Repeat until all exams are scheduled:

take the next exam in the list, and put it in the Nth place it can go without clashes

The chromosome encodes each of the Ns. The original constructive algorithm corresponds to running the above on the chromosome “111111111….”.

We could also engineer the original constructive algorithm into an encoding in a quite different way. How?


Encodings that use constructive algorithms4
Encodings that use constructive algorithms algorithm for bin-packing

Line up the exams in order e1, e2, … eN

Repeat until all exams are scheduled:

take the next exam in the list, and put it in the first place it can go without clashes


Encodings that use constructive algorithms5
Encodings that use constructive algorithms algorithm for bin-packing

Randomly permute the exams e1, …, eN

Repeat until all exams are scheduled:

take the next exam in the list, and put it in the first place it can go without clashes

This is a fine constructive algorithm, which will provide a different solution depending on the permutation.

It is easily used as an encoding: the chromosome provides the permutation.


Other well known constructive algorithms algorithm for bin-packing

  • Prim’s algorithm for building the minimal spanning tree (see an earlier lecture) is an example.

  • Djikstra’s shortest path algorithm is also an example.

  • In both of these cases, the optimal solution is guaranteed to be found, since MST and SP are easy problems.

  • But usually we see constructive methods used to give very fast `OK’ solutions to hard problems.


On engineering constructive methods
On engineering constructive methods algorithm for bin-packing

Some Constructive Heuristics are deterministic. I.e. they give the same answer each time.

Some are stochastic – I.e. they may give a different solution in different runs.

Usually, if we have a deterministic constructive method such as FFD, we can engineer a stochastic version of it. E.g. instead of choosing the next-lightest item in each step, we might choose randomly between the lightest three unplaced items.


Bin packing example algorithm for bin-packingdirect encoding:

2, 3, 2, 3, 1 ....  item 1 is in bin 2, item 2 is in bin 3, item 3 is in bin 2, etc...

(often a bin will be over capacity, so fitness function will have to include penalties)

Bin packing example indirect encoding:

candidate solution is a perm of the items, e.g. 4, 2, 1, 3, 5 ...meaning:

First place item 4 in the first available bin it fits in, then place item 2 in the first available ... etc.


Direct vs indirect encodings
Direct vs Indirect Encodings algorithm for bin-packing

Direct:

  • straightforward genotype (encoding)  phenotype (actual solution) mapping

  • Easy to estimate effects of mutation

  • Fast interpretation of chromosome (hence speedier fitness evlaluation)

    Indirect/Hybrid:

  • Easier to exploit domain knowledge – (e.g. use this in the constructive heuristic)

  • Hence, possible to `encode away’ undesirable features

  • Hence, can seriously cut down the size of the search space

  • But, slow interpretation

  • Neighbourhoods are highly rugged.


Example real number encoding and how eas can innovate rather than just optimize
Example real-number Encoding (and: How EAs can innovate, rather than just optimize)

D1, D2, D3, D4 D5 D6

D1 >= D2 >= D3, D4 <= D5 <= D6

Fixed at six diameters, five sections

Design shape for a two-phase jet nozzle


A simple encoding
A simple encoding rather than just optimize)

2, 1.8, 1.1, 1.3 1.3 1.5

The encoding enforces these constraints:

D1 >= D2 >= D3, D4 <= D5 <= D6

Fixed at six diameters, five sections


A more complex encoding bigger search space slower but potential for innovative solutions
A more complex encoding– bigger search space, slower, but potential for innovative solutions

Num sections before smallest

Section diameters

Z1, Z2, D1, D2, D3 Dsmall…, Dn, Dn+1, …

Num sections after smallest

Middle section constrained to be smallest,

That’s all

Mutations can change diameters, add sections,

and delete sections


About cw2
About CW2 potential for innovative solutions


About cw21
About CW2 potential for innovative solutions


About cw22
About CW2 potential for innovative solutions

Pamela Hardaker, Benjamin N. Passow and David Elizondo. Walking State Detection from Electromyographic Signals towards the Control of Prosthetic Limbs UKCI 2013

got signals like this, but on her

thigh just above the knee:

running

walking

standing


Current knee-joint prospects need manual intervention to change between standing/walking/running modes (the wearer presses a button)

Can we train a Neural Network to automatically detect when to change, on the basis of nerve signals from the last 30ms ?


About cw23
About CW2 change between standing/walking/running modes (the wearer presses a button)

Snapshot of Pamela’s data

Time signal state


About cw24

Max signal strength in last 30ms change between standing/walking/running modes (the wearer presses a button)

Max signal strength in last 20ms

Max signal strength in last 10ms

range of sig in last 30ms

range … last 20ms

range … last 10ms

mean … last 30ms

mean … last 20ms

mean … last 10ms

About CW2

Snapshot of Pamela’s data

Time signal state

State: 0, 1 or 2


About cw25

Max signal strength in last 30ms change between standing/walking/running modes (the wearer presses a button)

Max signal strength in last 20ms

Max signal strength in last 10ms

range of sig in last 30ms

range … last 20ms

range … last 10ms

mean … last 30ms

mean … last 20ms

mean … last 10ms

About CW2

Snapshot of Pamela’s data

Time signal state

CW2: evolve a neural network

that predicts the state.

State: 0, 1 or 2


What you will do
What you will do change between standing/walking/running modes (the wearer presses a button)

From me, you get:

Working NN code that does the job already

What you will do:

Implement new mutation and crossover operators within my code, and test them on Pamela’s data

Write a report comparing the performance of the different operators


Swarms, and how they might inspire us change between standing/walking/running modes (the wearer presses a button)

There are some interesting things that come to mind when we

think of swarms (flocks, schools, etc …):

  • A swarm sometimes seems to behave as if it is an individual organism.

  • Ants or wasps on a hunt for food, or on the attack, behave as if with a single

  • mind, co-ordinating different actions with different parts of the swarm.

  • A swarm, of ants/bees/locusts/etc often exhibits behaviours that seem clearly more intelligent than any of the individual members of it.

  • The way in which swarms in some species change direction is astoundingly well co-ordinated.

  • The way in which swarms in some species avoid obstaclesseems to be extremely well choreographed


Other puzzling things that swarms do change between standing/walking/running modes (the wearer presses a button)

  • Termites build huge nests – how?? Is an individual

  • termite clever enough to do this?

  • Bees build hives, with complex internal structure

  • -- same question.

How on earth can these things happen?

HERE IS A LIVE EXAMPLE


Two simple rules: While continually wandering randomly: change between standing/walking/running modes (the wearer presses a button)

If you are empty-handed and encounter a disc, pick it up

If you are carrying a disc and encounter another of the same colour,

put yours down.

Emergent order arises from simple local rules.


We sometimes exhibit swarm behaviour too change between standing/walking/running modes (the wearer presses a button)


Because we might change between standing/walking/running modes (the wearer presses a button)

learn something

But we’re mainly interested in animals and insects

locusts

ants


Why does flocking swarming occur so much in nature

Helping to catch prey: e.g. tuna school in a crescent shaped flock

with the concave part forward:

This is thought to help channel

their prey to the “focus”, and

stop them from escaping

Why does flocking/swarming occur so much in nature?

Energy savings: Geese in V formation have around a 70% greater

range than in flying individually. Individuals can fly around 25%

faster (why?).

Frightening and confusing predators; avoiding being “picked off”


It also maybe helps with migration
It also shaped flockmaybe helps with migration

If we can assume that:

  • An individual has an idea, but not a perfect one, of where to go … e.g. by itself it may go a few degrees off course.

  • The “errors” of individuals are not correlated (i.e. they’re all wrong in a randomly different way)

  • An emergent result of the flocking is that the flock’s direction is the average of its members’ directions.

    Then: basic statistics can show that the error in the flocks direction is probably very small. About 1/sqrt(n) of the typical error of one of the n individuals.


So … shaped flock

Flocking occurs so much because it is clearly useful. But how do they do it so well? Individual ants are not clever enough to understand the benefits.

It comes down to: simple behaviours of individuals in a group can have useful emergent properties. A theme we will continue to see a lot …


Another kinds of swarm behaviour is the dynamics and evolution of ideas as they get passed on and changed in social networks.

A recommends to B, B recommends to C, …


The adaptive culture model
The Adaptive Culture Model evolution of ideas as they get passed on and changed in social networks.

Robert Axelrod has a well-known theory, “Axelrod’s Culture Model”,

which explains how ideas spread in societies. Kennedy and Eberhart

(a computer scientist and a social scientist respectively) altered this

into the “Adaptive Culture Model”, which works like this:

If you think your neighbour is good, then be more like them.

And that’s basically it. But notice the important words,

neighbour: you change yourself under the influence of people nearby

good: in some way your neighbour is more optimal than you,

otherwise why be like them?

more like: this is vague, so you have freedom in how you change

This is actually a very good model for how culture and ideas

spread quickly in societies. Everything from rumours to eating

habits. I only hope this works with `green’ behaviour …


Back to computer science … evolution of ideas as they get passed on and changed in social networks.

From the CS viewpoint, the question is:

How does this kind of, apparently organised, group behaviour

emerge, without a central controller? Without (like we have)

something like a brain in control of everything?

The emergent behaviour that we see arises purely as a result of

individuals in the swarm processing information in their (fairly)

immediate neighbourhood.

So, studying this in nature suggests how we can get co-ordinated

behaviour from a group of individuals, without having to specify

any overall controller. This is very useful, for example, for designing

computer networks. If one main machine was in control of the network,

and that machine crashed, …

But so far that has not been a main success area for swarm

inspiration …


Two main things that come from swarm inspiration: evolution of ideas as they get passed on and changed in social networks.

Optimisation algorithms.

Ants seem to find the shortest path to find food that may be

quite distant from their nest. They do this via “stigmergy” –

laying pheronomones on their path as they move. This has

directly inspired the design of a very successful optimisation

method, called Ant Colony Optimisation.

Meanwhile, the adaptive culture model has led to a different,

and also very successful, new optimisation algorithm, called

Particle Swarm Optimisation

Simulations of natural flocks.

For the entertainment and gaming industries, for example.


Craig reynolds and boids
Craig Reynolds and “Boids” evolution of ideas as they get passed on and changed in social networks.

Craig Reynolds is a computer graphics researcher, who revolutionised animation in games and movies with his classic paper :

Reynolds, C. W. (1987) Flocks, Herds, and Schools: A Distributed Behavioral Model, in Computer Graphics, 21(4) (SIGGRAPH '87 Conference Proceedings) pages 25-34.

This paper is examinable reading, available on my teaching page.

  • The story is:

  • before this paper, animations of flocks, swarms, groups, and so on,

  • behaved nothing at all like the real thing. Nobody knew how to make

  • it realistic. (we still have that problem with fire, explosions, and

  • realistic human movement, etc …)

  • Reynold’s solved the problem by trying a very simple approach,

  • which was inspired by a sensible view of how animals actually do it.


The problem
The problem evolution of ideas as they get passed on and changed in social networks.

We would like these to move like a realistic flock of starlings.

(The heading of each one is suggested by where it’s pointing)

But what’s wrong to start with?


The problem1
The problem evolution of ideas as they get passed on and changed in social networks.

That’s better. Now what? Perhaps in the next timestep, they

should all move the same small distance? They should all change

their velocity in some way? What?


Reynold s rules
Reynold’s Rules evolution of ideas as they get passed on and changed in social networks.

Reynolds came up with three simple rules that solve this

Problem, resulting in entirely realistic flocking behaviour.

To explain them, we first need to consider the perceptual system of

an individual (which Reynolds called a boid).

For realistic movement, you need a realistic view of perception.

E.g. a starling’s movement is not influenced at all by the flockmates

that it cannot see – such as those out of its line of sight, or too far

away.


A simple sensory system
A simple sensory system evolution of ideas as they get passed on and changed in social networks.

This picture is from Reynold’s boids page.

The green boid can see a certain amount

ahead, and is also aware of any

flockmates within limits on

either side (recall, birds tend

to have eithers on the sides

of their heads.)

Two parameters, angle and distance,

define the system. SO, this boid will only

be influenced by those others it can sense

according to these parameters.


Rule 1 separation
Rule 1: Separation evolution of ideas as they get passed on and changed in social networks.

At each iteration, a boid

makes an adjustment to its

velocity according to the

following rule:

Avoid getting too close to

local (the ones it is aware of) flockmates.


Rule 2 alignment
Rule 2: Alignment evolution of ideas as they get passed on and changed in social networks.

At each iteration, a boid

makes an adjustment to match its velocity to the average of that of its local flockmates.


Rule 3 cohesion
Rule 3: Cohesion evolution of ideas as they get passed on and changed in social networks.

At each iteration, a boid

makes an adjustment to its velocity towards the centroid of its flockmates.


Notes it s not quite as simple as that to get realistic behaviour
Notes: It’s not evolution of ideas as they get passed on and changed in social networks.quite as simple as that to get realistic behaviour

Need to define an appropriate distance for the perceptive range.

What if this is too high, what if this is too small?

Reynold’s found that he had to be careful about how the vectors from the three rules get combined. It is not ideal to simply add them. Opposing “shouts” from two rules may cancel out, leading to

the third winning – in what scenarios might this be a problem?

Note that the cohesion rule is interesting – it leads to “bifurcating” around obstacles – a follow-the-leader approach to flocking would not achieve that.

The simple rules also realistically lead to “flash expansion” if started too close together.


Next time: evolution of ideas as they get passed on and changed in social networks.

Ant Colony Optimization


ad