The core GAUL code is datatype agnostic, that means any representation for the chromosomes may be defined. The user is encouraged to use whichever chromosome type would be most appropriate for the search or optimisation task being considered. For convenience, code for several of the more common chromosome types is included:
If none of the above chromosome types are appropriate, it is a simple matter to create a new datatype for use with GAUL. The calling program just needs to define a handful a functions which are then used as callback functions. Instructions for such user-defined chromosomes are provided.
It is even possible to mix chromosome types, for example you could use an integer-valued array chromosome and a Gray coded bitstring chromosome simulataneously. Although this would require slightly more creativity on your part.
The non-open source version of GAUL has been used with more exotic chromosome types including trees and molecular graphs. These will be ported into this version of GAUL as soon as time allows.
|
These chromosomes are simple C int arrays.
Allocator |
void ga_chromosome_integer_allocate(population *pop, entity *embryo) |
Deallocator |
void ga_chromosome_integer_deallocate(population *pop, entity *corpse) |
Replicator |
void ga_chromosome_integer_replicate(population *pop, entity *parent, entity *child, const int chromosomeid) |
Serializer |
unsigned int ga_chromosome_integer_to_bytes(population *pop, entity *joe, byte **bytes, unsigned int *max_bytes) |
Deserializer |
void ga_chromosome_integer_from_bytes(population *pop, entity *joe, byte *bytes) |
Human-readable representation |
char *ga_chromosome_integer_to_staticstring(population *pop, entity *joe) |
Crossover Operator |
void ga_crossover_integer_singlepoints(population *pop, entity *father, entity *mother, entity *son, entity *daughter)
void ga_crossover_integer_doublepoints(population *pop, entity *father, entity *mother, entity *son, entity *daughter)
void ga_crossover_integer_mixing(population *pop, entity *father, entity *mother, entity *son, entity *daughter)
void ga_crossover_integer_allele_mixing(population *pop, entity *father, entity *mother, entity *son, entity *daughter) |
Mutation Operator |
void ga_mutate_integer_singlepoint_drift(population *pop, entity *father, entity *son)
void ga_mutate_integer_singlepoint_randomize(population *pop, entity *father, entity *son)
void ga_mutate_integer_multipoint(population *pop, entity *father, entity *son) |
Seed Operator |
void ga_seed_integer_random(population *pop, entity *adam)
| void ga_seed_integer_zero(population *pop, entity *adam) |
|
In addition to the built-in chromosomes detailed above, a calling program may specify it's own chromosome handling functions to use. In such a case, the following callback functions will need to be defined: (Obviously "XXX" should be replaced by some sensible name.)
Allocator |
void chromosome_XXX_allocate(population *pop, entity *embryo) |
Deallocator |
void chromosome_XXX_deallocate(population *pop, entity *corpse) |
Replicator |
void chromosome_XXX_replicate(population *pop, entity *parent, entity *child, const int chromosomeid) |
Serializer |
unsigned int chromosome_XXX_to_bytes(population *pop, entity *joe, byte **bytes, unsigned int *max_bytes) |
Deserializer |
void chromosome_XXX_from_bytes(population *pop, entity *joe, byte *bytes) |
Human-readable representation |
char *chromosome_XXX_to_staticstring(population *pop, entity *joe) |
Crossover Operator |
void chromosome_XXX_crossover(population *pop, entity *father, entity *mother, entity *son, entity *daughter) |
Mutation Operator |
void chromosome_XXX_mutate(population *pop, entity *father, entity *son) |
Seed Operator |
void chromosome_XXX_seed(population *pop, entity *adam) |
Stubs for these functions are provided in examples/chromostubs.c, and examples/chromostubs.h. You just need to fill these functions in with you own code. The stubs contain example code for simple (i.e. inefficient) integer array chromosomes which you may use as a basis. You should note that, depending on the particular characteristics of the GA being used, not all of these functions actually need to be defined.
|