Skip to content
This repository has been archived by the owner on Aug 3, 2018. It is now read-only.

Latest commit

 

History

History
41 lines (27 loc) · 1.61 KB

CONTRIBUTING.md

File metadata and controls

41 lines (27 loc) · 1.61 KB

Ideas

Code style

Guidelines

  • Keep names short
  • Aim for 100 characters per line

Variable declaration

// Bad
x := 42

// Good
var x = 42

Naming convention

Please inspire yourself from the existing algorithms before implementing, the naming conventions are easy to grasp.

Parallelism and random number generation caveat

Genetic algorithms are notorious for being embarrassingly parallel. Indeed, most calculations can be run in parallel because they only affect part of the GA. Luckily Go provides good support for parallelism. As some gophers may have encountered, the math/rand module can be problematic because there is a global lock attached to the random number generator. The problem is described in this StackOverflow post. This can be circumvented by providing each population with it's own random number generator.

Performance

  1. go test -bench . -cpuprofile=cpu.prof
  2. go tool pprof -pdf gago.test cpu.prof > profile.pdf