next up previous
Next: The Language Up: The DARWIN Language Previous: The DARWIN Language

Design Idea

The DARWIN language is designed to be simple, GA oriented language. In order to achieve fast learning and adaptation, the syntax of the language resembles the standard C language syntax. For example, the DARWIN statements look just the same in C, with the minor difference that DARWIN is not as rich with build-in types as C and there are no pointers. The reason for excluding pointers from the language is that they are not currently needed, since all the storage in the generated code is linear. This does not lead to inefficient implementation since the generated code will contain C pointers. If in the future versions of DARWIN pointer type are required, then reference type will be introduced.

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 :

A detailed specification of the problem can be found in section 5 and its complete DARWIN program in section 6.


next up previous
Next: The Language Up: The DARWIN Language Previous: The DARWIN Language
Gokturk Ucoluk 2003-09-15