Logo by reallybigname - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. April 19, 2024, 04:31:43 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Evolutionary Automaton - The Bak-Sneppen Model  (Read 1688 times)
0 Members and 1 Guest are viewing this topic.
kram1032
Fractal Senior
******
Posts: 1863


« on: April 01, 2013, 02:57:07 AM »

I made this image according to the rules of the Bak-Sneppen Model

EDIT: Code updated to have an actually working mutation process. It previously did nothing.

A super-simple model of co-evolution.
You can find a more indepth explanation as well as a javascript simulation here
Furthermore, here is my Mathematica Implementation,
that produced the image you can see on the left.
It should be pretty straightforward to port to other languages.

Code:
(* User Parameters *)
len = 100; (* Population-size = list-length *)
count = 1000; (* While loop counter - number of timesteps *)
mRate = .001; (* Mutation rate *)

(*Initialization*)
data = RandomVariate[UniformDistribution[],
  len]; (* generate a list of random variables *)
mat = {data}; (* put generated data into a second list level - this \
will be the output matrix *)

(*Main Program*)
While[count > 1,
 smallest =
  Ordering[data][[1]];(* find the element with the smallest value *)
 replace =
  RandomVariate[UniformDistribution[],
   3];(* build a list of replace values *)
 data = If[1 < smallest < len,
   ReplacePart[
    data, {smallest - 1 -> replace[[1]], smallest -> replace[[2]],
     smallest + 1 -> replace[[3]]}], (*
   replace the correct array positions *)
   If[smallest == 1,
    ReplacePart[
     data, {len -> replace[[1]], 1 -> replace[[2]],
      2 -> replace[[3]]}], (* special-cases for borders *)
    ReplacePart[
     data, {len - 1 -> replace[[1]], len -> replace[[2]],
      1 -> replace[[3]]}]]]; (*in order to make it a full circle *)
 
 mat = Append[mat, data]; (* add a line to the history *)
 (* initialize Mutation *)
 i = 1;
 mArray =
  RandomVariate[UniformDistribution[],
   len]; (*generate a List of random variables. Again. *)
 
 While[i < len,
  
   If[mArray[[i]] < mRate,
     data = ReplacePart[data,
        i -> RandomVariate[UniformDistribution[]]];] (*
    if the variables are below the mutation rate,
    replace the data with a random value *)
    i++]
  
  
  count--] (*make sure, the two while loops finish *)

MatrixPlot[mat, ColorFunction -> "TemperatureMap", Frame -> False,
 PixelConstrained -> 1](*plot with pretty colors*)

Enjoy!

The Bak-Sneppen Model is an example of Self-organized criticality
Here is the corresponding Wiki.
It also includes a neat image to show how complex these can be:

I believe, this graph is time-colored. - Mine is based on fitness.
« Last Edit: April 01, 2013, 04:21:26 PM by kram1032 » Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Evolutionary Residue Movies Showcase (Rate My Movie) Jameses 0 497 Last post August 29, 2010, 09:02:04 AM
by Jameses
New Model Eye Images Showcase (Rate My Fractal) element90 0 723 Last post October 19, 2011, 03:50:58 PM
by element90
2D/3D Quantum Cellular Automaton Fractal News across the World kram1032 1 2254 Last post March 10, 2013, 07:25:26 AM
by Tglad
Sound from elementray cellular automaton Other Artforms huggmeister 3 3953 Last post November 04, 2016, 07:53:22 PM
by claude
MandelBulb3D 3D Model, Exported as Points Cloud in version 1.9.9 Movies Showcase (Rate My Movie) 1Bryan1 2 5593 Last post October 15, 2017, 09:58:32 AM
by Spain2points

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.141 seconds with 24 queries. (Pretty URLs adds 0.006s, 2q)