Emergent behaviour - 10000000 agents - butterfly cyclic migrationThis is a simulation of an initially random population of ten million butterflies. Some constraints are applied (feeding in one area, feeding and breeding in another) and from this emerges, eventually, a cyclic migration pattern broadly similar to that of the Monarch butterfly. This is an extremely simplified model of a butterfly, and its life cycle takes place on an likewise simplified map of North America. The blue rectangle when it appears corresponds roughly to the US North East and Canada during the summer when there is both nectar and milkweed available; the green rectangle corresponds to Michaocan in Mexico during winter where there is an alternative food supply available. Details such as the exact dates that food is available (and the weather is not too inclement), how large the areas are, how fast the butterflies can fly, etc, were arbitrarily chosen; this is not an exact simulation. The model is believed to be robust in face of changes to these parameters. Our basic assumption is that butterflies will stay in a region where there is food, and will forage in random directions for random distances when there is no food. Butterflies die when their food is exhausted or if they fly too far into the frozen north, desert south, or into the oceans to the east and west. They breed when they are old enough and in a region where there is food for the emergent caterpillars. That pretty much sums up the entire programming behind each single butterfly agent. In order to avoid simulating the entire world back to the first amoeba, we seed the world with an excess of butterflies (10 million) which cover the central land mass; each butterfly has a random gene string. This gene string is consulted whenever a decision is needed about whether to fly or not, and in which direction to fly. What we see is that butterflies which stay in roughly the same place die of starvation, as neither region produces enough food to allow them to survive a year. Butterflies which randomly fly to the other food-producing region survive a little longer. If they -- or their offspring -- in turn randomly manage to return to the original food-producing region in time, they live long enough to reproduce. The descendants of the butterflies which randomly succeeded in establishing a cyclic route have the same genes, and therefore follow roughly the same route. (To simplify the simulation enough to allow for 10,000,000 initial agents, this model breeds by parthenogenesis rather than sexual reproduction. It is probably a fair assumption to make that sexual reproduction and mixing of genes would converge on a stable migration pattern even quicker in simulated time; however the computation to determine that would take far far longer in real time). Also note that this model is not a true genetic algorithm as no mutation of the genes has been programmed, so the final gene pool has less genetic variation that might be expected in real life and therefore would not adapt to changes in the environment as well as real butterflies would. The decision for which direction a butterfly flies is a function of their genes as well as of outside influences. Their genes are randomly created in the initial population. To simplify the simulation all outside influences are merged into a single variable which is, effectively, the current time of year. The code is given absolutely no concept of migration, far less cyclic migration across generations. This is entirely an emergent behaviour coming from a combination of random foraging and seasonal availability of suitable food. The code that generated this specific video is available -- warts and all -- for inspection at http://www.gtoal.com/butterfly-sim/simple02.c.html -- it's crude, it may have bugs (no pun intended) and certainly has poor assumptions, but it works despite those. Readers are welcome to improve the code to remove any assumptions they find too grating; I am reasonably sure that the basic evolutionary mechanism is sufficiently robust that a cyclic migration pattern will emerge under any reasonable model. This was the second successful run to show emergent behaviour. (The first run seeded with 1,000,000 random agents created a stable population of only 30; this run created a population of over 3000). A longer write-up explaining all the assumptions made in detail is available at http://www.gtoal.com/butterfly-sim/simple02-writeup.html code pour embarquer la vidéo : >>> http://www.youtube.com/embed/xInsoESNPpY <<< |