[ Home | Docs | News | Resources | Download] |
GAUL Documentation: Reading and Writing Entities and Populations |
Storing populations and entities on disk Functions are provided by GAUL to store both individual entities and entire populations on disk in a binary format. These might be useful for resuming previous evolutionary simulations. Currently, the binary format is not platform independant, but a portable XML-based format is likely to be used in the future. boolean ga_population_write(population *pop, char *filename); population *ga_population_read(char *filename); boolean ga_entity_write(population *pop, entity *entity, char *filename); entity *ga_entity_read(population *pop, char *filename); Look at saveload.c, an example program which illustrates the use of the ga_population_read() and ga_population_write() functions. As you can see, these functions are very straight-forward. Use of the population read/write functions will automatically include all of the constituent entities. I recommend experimentation with this example program, saveload. What is stored, and what isn't? Unfortunately, there are some portions of the entity and population structures which can not be recorded on disk. While most hook functions are stored, custom functions can not be stored in a way that would allow restoration independent of platform and executable. Consequently, the fitness evaluation function and any other custom code must be manually defined in any population structure read back from disk. Also, the userdata fields of both population and entity structures must be redefined after restoration. What next? Well done, you have reached the end of the GAUL tutorial. If you have comments, questions, or queries then please consider posting these on the GAUL mailing list. Instructions for subscribing to, or posting on, this list are provided on the GAUL homepage. |
[ BACK TO TOP | BACK TO START OF TUTORIAL ]
[ Home | Docs | News | Resources | Download] |
Hosted by: |
© 2001-2003, "Stewart Adcock" <stewart@linux-domain.com> All rights reserved. |
All trademarks on this page are probably owned by their respective companies. You can insert you own favourite disclaimer here. |