Genetic AlgorithmsGenetic Algorithms are processes that mimick Darwinian evolution where a population is generated, the fitness of each memeber of the population is scored, unfit members are removed, and fit members are maintained, bred (merged) or mutated (changed) to create a new population. This is a simplistic overview of the Genetic Algorithm (GA) classes in jMusic. We hope to get more details soon. First, the GA only works for Phrases, not any of the other music types like Scores and Parts. The central class to the GA framework is the PhrGeneticAlgorithm class. Once you've initialised the GA you can get the best phrase after a n iterations like this:
The PhrGeneticAlgorithm class has a single constructor, with most of the parameters being interfaces representing the distinct steps in the GA. These are:
So in order to create a GA you will first need to write concrete implementations of these 7 interfaces. There are implementations of these available in the jm.music.tools.ga package, however these were specifically tailored for a particular task and will probably only be useful as a guide. |