The DARWIN language, by its definition, is capable of distinguishing genetic algorithm constructs. In the first place, DARWIN syntax provides means for defining genes, chromosomes, populations and the genetic algorithm. For simplicity, these key entities will be referred as genetic algorithm constructs. It is easy to see that there are different, but standard sets of operations on the genes, chromosomes, populations and genetic algorithm, and thus the best possible way to represent them would be to have object classes. But since DARWIN generates plain C code, the DARWIN language has a special syntax construct called moderators. Moderator is a function that effectively associates an operation on a data structure, thus creating the effect of encapsulation present in Object Oriented programming. By introducing the concept of moderators, the DARWIN language becomes powerful enough to express a genetic algorithm construct and provide the standard set of operators associated with it. For example, the gene construct has the print, initialize, crossover, mutate and evaluate operations defined on it. These form the moderator set of the DARWIN gene.
In general, a DARWIN program is composed of three parts - the genetic algorithm constructs specification, the moderator definitions specified in the first part, and the user-defined set of functions. In the genetic algorithm constructs section, the gene, chromosome, population and genetic algorithm constructs are defined and the sets of their moderators identified. The programmer needs to specify only a minimal set of moderators, the rest is generated by the compiler. Furthermore, moderators can be provided as a library, or even better a moderator generator can be added to the already available ones.
The different kinds of GA constructs and their moderator sets will be explained in more detail during the following section, where a fully functional DARWIN program will be created for a sample problem. The example problem aims at finding a two dimensional distribution of 20 rectangles such that :