Skip to content
Pheromone-based internally optimizing resource gathering network simulation using automata inspired by ants.
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.


Ant-inspired Resource Gathering Simulation

© 2013 Sam Pottinger
Released under the GNU GPL v3 license.
Done for CU Boulder CSCI 4900 – Independent Study (Software Engineering, Emergence, and Complex Adaptive Sys.)
Produced under the guidance of Professor Ken Anderson

Background and Motivation

Ant hills, as described by Deborah Gordon, self-organize to create complex adaptive systems optimized to gather materials from various surrounding food sources. Ants, the agents in this complex system, do not have a gloval view of the system but can communicate with each other via pheromones. This simulation takes that idea of ant-like agents coordinating optimized resource gathering networks.

Of course, if simulations can model ant hills, man-made systems can leverage the same optimization behavior to create better networks for gathering resources, physical transportation, etc.

Model Description

These ant-inspired automata begin by a weighted random walk through adjacent spaces where they are more likely to go to locations with higher pheromone values. When an “ant” finds food, it brings a piece of it to the center of the grid (the nest) and leaves a pheromone trail behind it to encourage other ants to visit the same food source.

Visual Representation

The following color coding scheme is used:

  • Green squares contain pheromone.
  • Grey squares are food sources.
  • Red circles indiciate how much food remains at a food source.
  • White squares are empty.
  • Black squares are occupied by an “ant” automaton.

Development Environment and Standards

The development environment requires Node.js and nodeunit. Most development operations, including changes to the specific behavior of pheromones, can be performed simply by editing constants.js. Inline documentation follows JSDoc standards. However, the use of the “int” and “float” types in documentation is allowed. All lines in .js files should be limited to 80 characters. An 80% code coverage requirement should be enforced for all code outside of view logic and code dealing directly with probabilities where dependency injection requirements are deemed too high.


All automated unit tests can be run via:
$ nodeunit *_test.js

Technologies and Resources Used

Uses Ants at Work: How an Insect Society is Organized as a very general guide. The entire solution runs in JavaScript (ECMAScript), targeting the HTML5 canvas element. Other technologies used include jQuery and Trevor Norris’ cbuffer, both released under the MIT License.

You can’t perform that action at this time.