Skip to content

Latest commit

 

History

History
executable file
·
55 lines (38 loc) · 1.56 KB

README.md

File metadata and controls

executable file
·
55 lines (38 loc) · 1.56 KB

README

Ant Colony Optimization Demo

Live

Ant Colony Optimization (ACO) is a computer algorithm used to solve the classic traveling salesman problem. It simulates "ants" traveling between the cities", and leaving "pheromone" trails that disapates over time, which influences the probability of other ants picking to travel the same trail.

Architecture and Technologies

  • Vanilla JavaScript for the overall structure as well as the algorithm logic
  • HTML5 Canvas for DOM manipulation and rendering
  • Webpack to bundle and serve up the various scripts

Features

HTML5 Canvas

Used to display dynamic and interactive graphics and animations

alt text

click(mouseEvent) {
        this.canvasPos = this.element.getBoundingClientRect();
        const mouseX = mouseEvent.clientX - this.canvasPos.left;
        const mouseY = mouseEvent.clientY - this.canvasPos.top;
        this.mousePos.x = mouseX;
        this.mousePos.y = mouseY;

        if (typeof(this.clickHook) === 'function') {
            this.clickHook();
        };
    }

Objective Oriented Programming standards

Employed Object Oriented Programming standards in order to achieve an organized, scalable, and intuitive codebase.

import Graph from './graph';
import Ant from './ant';

class Colony {
    ...
}

export default Colony