Schooling of the fish


 * Author: Jakub Stas, [mailto:xstaj68@vse.cz xstaj68]
 * Project name: Schooling of the fish
 * Class: 4IT495 Simulation of systems (WS 2012/2013)
 * Model type: Agent-based model
 * Software used: NetLogo

=Problem definition= The aggregate motion of a flock of birds, a herd of land animals, or a school of fish is a beautiful and familiar part of the natural world. A school exhibits many contrasts. It is made up of discrete fish yet overall motion seems fluid. It is simple in concept yet is so visually complex. This simulation proposes that the leaders can emerge as a consequence of a self-organized process based on local rules of dynamic interactions among individuals. Schools are an example of self-organized behaviour in a group where one can study the leadership properties of the individuals. Simulation proposed to monitor and analyze the leadership properties of the school and given individuals. Based on this analysis I tried to identify key factors that influence emergence of the leaders.

=Method= The simulated school is an elaboration of an agent based system, with the simulated fish being the agents. The aggregate motion of the simulated school is created by a distributed behavioral model much like that at work in a natural school; the fish choose their own course. Each simulated fish is implemented as an independent agent that navigates according to its local perception of the dynamic environment. The aggregate motion of the simulated school is the result of the dense interaction of the relatively simple behaviors of the individual simulated fish. Fish are bound by certain set of rules explained in later chapters. This simulation is implemented in NetLogo since it provides the best capabilities from available tools. There is a wide range of monitoring tools and visualization approaches in NetLogo which will be used as a part of the simulation.

=Model=

World and Agents
The agents move in a two-dimensional, discrete world that is unbounded. Time flow in this world is represented by ticks. Each agent (fish) $$i$$ is identified by its coordinates and heading at time $$t$$. The heading of an agent at time $$t$$ is defined as the vector connecting its location at t-1 with its location at t, and is expressed as the clockwise angle between that vector and the Y axis.

$$F : \{P, H\}$$

where:
 * $$P_i = \{(x_i(t), y_i(t))\}$$
 * $$H_i = \{\alpha (t)\}$$

Fish have a perceptual field which is defined as a circular sector whose centre is the agents current location $$P_i$$ and which is bisected by its current heading vector. Perceptual field is key model attribute since it defines two important properties of the fish:


 * depth of agents perceptual filed - defined by visibility angle $$\alpha_i$$
 * scope of agents perceptual filed - defined by visibility range (or radius) $$r_i$$

both of which can by modified (since they are model attributes).

When the school emerges, fish can be leader, follower or both. Each fish has its rank based on number of followers. Ranking function R is defined as follows:

$$R = \tfrac{F}{N - 1}$$

where:
 * $$F$$ number of followers
 * $$N$$ number of fish

Ranking function yields values from the interval $$<0; 1>$$. Fish can be categorized based on their rank as follows (in big enough population):
 * strong leader - rank higher than $$0.4$$
 * leader - rank from the interval $$(0; 0.4)$$
 * follower - rank equal to $$0$$
 * both leader and follower - cannot be determined based solely on ranking function

Leader selection is one of the most critical model attributes. There are two ways fish choose their leader (user can select leader selection strategy since this is also model attribute):
 * Distance-based
 * Fish select the closest fish in their perceptual field and this fish becomes the leader
 * Rank-based
 * Fish select the fish with highest rank. The closest fish is selected if there are more fish with same rank (the highest ranking visible fish) in question.

Special and also initial case is the situation, when fish do not see any other fish. In this case the fish moves independently of any leaders or other fish.

Controls
User interface is devided into two portions - controls/monitors and animation box. First part is divided as follows:

Simulation controls
Simulation controls are used to initialize, run and stop the simulation.


 * setup button - initializes environment and agents and resets all monitors to default values (keyboard shortcut Q)
 * run button - runs the simulation (keyboard shortcut W)
 * step button - executes one step in the simulation (keyboard shortcut E)

Fish properties
Fish properties define agents basic physical capabilities - they restrict their movement, define their perceptual field and number of agents in the simulation.


 * fish-count slider - number of fish in population (0 - 50 fish)
 * cohorence-of-school slider - minimal distance from leader in the school (0 - 5 patches)
 * visibility-angle slider - scope of the perceptual field (30 - 70 degrees)
 * visibility-range slider - depth of the perceptual field (0 - 7 patches)

Leader selection
Leader selection allows user to select leader selection strategy.


 * lss-rank switch
 * ON - rank-based leader selection strategy
 * OFF - distance-based leader selection strategy

Monitors
User is presented with two groups of monitors based on their scope: rank monitors and leader/follower monitors.


 * Rank monitors
 * Median of ranks
 * Average of ranks
 * Ranking histogram - displays ranking of the whole population (in given step)
 * Leader/Follower monitors
 * Leaders - number of leaders in population (in given step)
 * Followers - number of followers in population (in given step)
 * Fish histogram - complementary histogram displaying Leaders and Followers (in given step)
 * Leaders and followers plot - plots number of leaders and followers since the beginning of the simulation

Model limitations

 * Objects do overlap
 * This problem is partially solved for distance-based leader simulation but it quite fails when simulation is switched to rank-based selection strategy.
 * Absence of behavior
 * This model is an abstraction of one of the most complex problems in organizational studies and social sciences such as sociology, anthropology or psychology. Due to this fact many properties of the real environment and individuals had to be ignored. (discussed more in later chapters)

=Results= The success and validity of these type of simulations is difficult to measure objectively. They do seem to agree well with certain criteria and some statistical properties of natural schools which have been reported by the zoological and behavioral sciences. Perhaps more significantly, many people who view these animated schools immediately recognize them as a representation of a natural school. One can study certain aspects of biology in order to verify certain aspects of this simulation. It is always a good idea to research relevant or similar thesis/paper/simulation when you are trying to provide any relevant information by your simulation. And thats why I would start with formulating some hypotheses based on my research of related works before unveiling any results. After presenting hypotheses enumeration I describe my tests and discuss implication of the results in regard to the postulated hypotheses.

Hypotheses

 * 1) the bigger the world is, the more difficult it is for a school to emerge
 * 2) the smaller the world is, the less stable the school is
 * 3) certain values of agent features could favour school emergence
 * 4) agents spatial position influences their chances of becoming leader
 * 5) one of critical factors of school emergence is perception of an agent
 * 6) rank-based leader selection strategy produces bigger and more stable schools
 * 7) stability of the school is not guaranteed

School emergence
One of the most important concepts used in this simulation is the emergence of the school. In this series series of tests I focused on an average number of the schools in the environment during the run. I conducted two test suits - one for each leader selection strategy. Each test suit contained characteristic number of the fish (small - 15, medium - 35, large - 50). An average number of schools was calculated in each of three mile stones (early stage - 1 000 ticks, middle stage - 10 000 ticks, late stage - 100 000 ticks). Goal of this test is to explore the relationship between time and school stability.



Based on the table above we might conclude that hypothesis 2 is confirmed. Hypothesis 2 proposes that the smaller the world is, the less stable the school is which is confirmed, since nearly all table rows point to the fact, that the bigger the population is (and thus the world is smaller), the larger the average number of schools become.

Another interesting test that was conducted was aimed at the influence of the world resolution on emergence of the schools. Again two sets of test suits were run - test populations remained unchanged and new test attribute was introduced - resolution of the world (small - 26x26, medium - 50x50, large - 100x100). Goal of this test is to explore the relationship between world resolution and school emergence.



Based on second test we can say that also hypothesis 1 was proven, since all of the data support its claim. Simply put the bigger the world, the longer fish search for each other. Another hypothesis (not mentioned above) could state that time required for a school to emerge is independent of leader selection strategy (at least two strategies presented in this simulation). This claim is also proven by the second table, since there are no significant differences between both strategies.

When it comes to judging the stability of the school we can say that hypothesis 9 was confirmed by pretty much every single test I ran.

Influence of the perceptual field


Perception of an agent is one of its most critical properties. Following tests put this claim to the test. In this chapter I am going to reason about the role of agents scope and depth of the perception field.

Scope of the perception field

The most important thing to notice is, that data in all the rows (except two fields in row 10) confirm this claim. Therefore I think it's safe to say, that hypotheses 3 and 5 are proofed (since they complement each other). The underlaying logic is quite simple. Wider the range of what agent sees, the better the opportunity of finding suitable leader gets.

Depth of the perception field

To my surprise this test did not end in such an strong pro claim result. Even thought test proves the claim, I must admit a expected the result to be more like in the scope test. Logic backing this claim is also pretty straight forward: the deeper your perception field is, the better a chance of seeing a leader in a distance is.

Combination of both

Test where both factors are set to minimum or maximum was not conducted in statistical manner but only by observation. Nevertheless one can expect that when both scope and depth are set to their maximum values resulting effect would cause (and vise-versa):


 * 1) easier emergence of schools (they emerge faster)
 * 2) more stable schools
 * 3) schools containing more members over the time

Leadership
Another group of conducted test was aimed at leadership properties of the model. First of all lets take a look at hypothesis 4 which claims that agents spatial position influences their chances of becoming a leader. I must admit that I tried many different approaches to prove this hypothesis in my model (from randomization to pattern utilization), but I simply was not able to do it. I reckon that there are two reasons why this claim does not apply to my model:


 * World definition
 * Based on world definition the world has no boundaries - so the fish continuously swim through the world without the need to avoid the edges which would become a considerable influence in regard to the hypothesis
 * Leader selection strategies
 * Due to one of the short comings mentioned in Model limitations there are only two leader selection strategies. Based on this restriction I imposed on the model, there are no leader selection strategies that would embed discussed property in themselves.

Next lets take a look at one of the hypotheses proposed by me. Is rank-based leader selection strategy more efficient than distance based? To answer that I kept the track of all my tests I ran and I when we separates the tests where one particular strategy dominated the other we come to the result, that:


 * Distance-based leader selection proved more efficient in $$21 \%$$ of tests (mainly when perception of an agent was influenced)
 * Rank-based leader selection proved more efficient in $$79 \%$$ of tests (all the other tests)

=Model and reality= In this chapter I plan on assessing how my model fits the reality. Let me start by simple definition of schooling and how to approach it. For this purpose I will use wikipedia article defining schooling in following fashion. An aggregation of fish is the general term for any collection of fish that have gathered together in some locality. Fish aggregations can be structured or unstructured. An unstructured aggregation might be a group of mixed species and sizes that have gathered randomly near some local resource, such as food or nesting sites. If, in addition, the aggregation comes together in an interactive, social way, they are said to be shoaling.

Although shoaling fish can relate to each other in a loose way, with each fish swimming and foraging somewhat independently, they are nonetheless aware of the other members of the group as shown by the way they adjust behaviour such as swimming, so as to remains close to the other fish in the group. Shoaling groups can include fish of disparate sizes and can including mixed-species subgroups. If, as a further addition, the shoal becomes more tightly organised, with the fish synchronizing their swimming so they all move at the same speed and in the same direction, then the fish are said to be schooling. Schooling fish are usually of the same species and the same age/size. Fish schools move with the individual members precisely spaced from each other. The schools undertake complicated manoeuvres, as though the schools have minds of their own. Based on the definition above I truly feel the way that the model nicely approximates it since modeled fish are of the same sex and size and try to behave in described mannor.

When it comes to the shape of the school however, the model does not always approximate any easily identifiable shape. Some fish in an attempt to defend themselves form a ball shaped school or others form a large blobs of fish with no identifiable shape. This is mainly based on leader selection strategies in combination with coherence of the school and it seams like proposed strategies do not always identify with better known shapes of the schools. Also I find it hard to bind the model with any particular kind of fish. But since most of the hypotheses were drawn from an experts in the field of analyzing schooling behavior I am satisfied with the resulting performance of the model.

=Conclusion= This report presented an agent-based model of schooling behavior of the fish. The model is based on simulating the behavior of each fish independently. By common interactions between fish a school emerges and approximate the real concept of schools. The animation showing simulated schools built from this model seems to correspond to the observer's intuitive notion of what constitutes school-like motion. However it is really difficult to objectively measure how valid this model is, I do believe I managed to capture the essence of the schooling of the fish. By exposing the user to the controls of agent perception, leader selection and population control user is able to achieve many variations on schooling behavior.

=Resources=

BARNAJEE, A B (1992) A simple model of herd behaviour. Quarterly Journal of Economics, 107 (3), pp. 797-17.

BELTRAN, F S, Salas, L and Quera, V (2006) Spatial behavior in groups: An agent-based approach. Journal of Artificial Societies and Social Simulation, 9 (3) 5.

CAVAGNA, A, Giardina, I, Orlandi, A, Parisi, G, Procaccini, A, Viale, M and Zdravkovic, V (2008) The STARFLAG handbook on collective animal behaviour: 1. Empirical methods. Animal Behaviour, 76, pp. 217-236.

KUNZ, H and Hemelrijk, C K (2003) Artificial fish schools: Collective effects of school size, body size and body form. Artificial Life, 9, pp. 237-253.

QUERA, V, Herrando, S, Beltran, F S, Salas, L and Miñano, M (2007) An index for quantifying flocking behavior. Perceptual and Motor Skills, 105, pp. 977-987.

=Model source code=