heuristic optimization algorithm templates for JavaScript