next up previous
Next: Population Definition Up: The Language Previous: Gene Definition

Chromosome Definition

The Chromosome definition is very similar to the Gene definition with the only difference that it can contain members of type gene.

The chromosome definition syntax is as follows :

chrom_typedef ::= "chromosome" id
    "{" gene_decls "}"
    genome_moderators ";"

For example, if positioning 20 rectangles is the goal of our simple optimization problem, then an array of 20 genes, defined previously would be enough to hold our solution. Then, the chromosome can be defined as :

chromosome TRectangles
{
   TRectangle rectangles[20]; 
};

The chromosome has the same moderator set as the DARWIN Gene. The population moderators are involved in calling the chromosome moderators. The generated chromosome moderators rely on implicitly calling corresponding moderators of their gene members and using the same strategy as genes when generating code to handle basic typed data members.

The most important moderator is the chromosome evaluator, since it is used to obtain the fitness score of the solution encoded in the chromosome. Normally, it is specified by the user, but if not, a compromise can be obtained if all its gene members have their evaluators defined. In such a case, the chromosome evaluator is automatically generated to sum the evaluators of its gene members.

Specifically for our example chromosome, we have not declared any moderators, so they will all be generated. The generated chromosome evaluator will call the gene evaluator for each of the rectangles and sum them up.


next up previous
Next: Population Definition Up: The Language Previous: Gene Definition
Gokturk Ucoluk 2003-09-15