Giter Club home page Giter Club logo

avalanche2d-js's Introduction

A partial JavaScript adaptation of Bob Tinker’s NetLogo model Bureaucrats.v6 exploring Self-Organised Criticality

The mathematics of avalanche size and frequency follows a power law that can be simulated to
a first approximation by any system that exhibits self-organized criticality (SOC). In “How
Nature Works”" Per Bak reports a simplified model of a sandpile that he, Chao Tang, and Curt
Wiesenfeld developed that shows SOC, the so-called BTW model. Bak also mentions that
Grassberger describes a representation of this model that is fanciful but equivalent to the
BTW model. Imagine an N-by-N grid of office desks and a bureaucrat sitting at each. A folder
is randomly assigned to one desk. The bureaucrat does nothing until four or more folders are
on his desk at which time he sends one to each of his four nearest neighbors. Any bureaucrat
sitting at the edge of this array throws a folder out the window if there is no desk to send
it to. Sometimes, adding one folder can cause multiple redistributions of folders as one
bureaucrat’s actions causes neighbors to exceed three folders, which then ripples through
the office. In principle, just adding one new folder might involve redistribution at every
desk, sometimes multiple times.

The screen after approximately 5000 avalanches.

screenshot of avalanche2d-js

I’m working on new ways of being able to create and run models in html5 browser-technologies that we used to build with Java and wanted to see how hard it would be to convert one of Bob’s NetLogo models. The avalanche/bureaucrat model was a good first choice because it only uses the patches feature of NetLogo and not turtles.

While it would take a good deal more work to make a whole authoring environment that would be effective and productive for non-professional programmers I think this is a very successful proof-of-concept. At this point I think it would be relatively easy to convert a model that had turtles also.

Benchmarks

Seth Tisue, the lead NetLogo developer contributed both Bureaucrats-fast a simplified re-write of Bureaucrats.v6 that runs about 20 times as fast as the original and a version of the model algorithm written in straight Scala Bureaucrats.scala. The speed of the Scala version should be comparable to the speed of a native Java adaptation.

Testing Oct 28 2011 show this JavaScript adaptation runs the model about the same speed as the native Scala version and about 12 times faster than Bureaucrats-fast" in NetLogo 5.0RC2 and about 18 times faster when also displaying the folder visualization and graph (Chrome 14.0.835.186 on a Mac OS X 10.6.8 system with a 2.66 GHz Intel Core i7).

A Google Spreadsheet is available with more complete Avalanche2D-JS Benchmarks comparing the performance of the model and the model, visualization, and grapher in Scala and NetLogo and on various browsers and operating systems including Android and iOS tablets and smartphone systems.

Self-Organised Criticality References

  1. Review of: How Nature Works: The Science of Self-Organised Criticality, Per Bak, New York, NY: Copernicus Press 1996
  2. Self organized criticality in earth systems By Stefan Hergarten, page 94
  3. On the avalanche size distribution in the BTW model
  4. Wikipedia: Self-Organised Criticality

Programming References

  1. Efficient Script Yielding
  2. setImmediate
  3. W3C: Timing control for script-based animations
  4. W3C: Real-Time Web Communications Working Group
  5. Real-Time Web Communication Use-cases and Requirements
  6. W3C: Audio Working Group"
  7. Beyond HTML5 Audio Capture in Web Browsers
  8. W3C: Web Audio API
  9. Web Audio Examples

avalanche2d-js's People

Contributors

stepheneb avatar sethtisue avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.