Skip to content

Instantly share code, notes, and snippets.

@halfdan
Last active August 29, 2015 13:57
Show Gist options
  • Save halfdan/9758330 to your computer and use it in GitHub Desktop.
Save halfdan/9758330 to your computer and use it in GitHub Desktop.
interface Optimizer {
double optimize();
}
// Many implementations can exist
interface Mutation {}
// Many implementations can exist
interface Selection {}
class GeneticAlgorithm implements Optimizer {
Mutation mutator;
Selection selection;
double pc, pm;
public GeneticAlgorithm(double pc, double pm) {
this.pc = pc;
this.pm = pm;
}
public double optimize() {
// compute stuff
return 0.0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment