Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 1.75 KB

CONTRIBUTING.md

File metadata and controls

43 lines (29 loc) · 1.75 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 eaopt.test cpu.prof > profile.pdf