/* ---------------------------------------------------------------------------- ex15.C mbwall 28jul94 Copyright (c) 1995-1996 Massachusetts Institute of Technology DESCRIPTION: This example nearly identical to example 2, but it uses convergence as the stopping criterion for the GA rather than number-of-generations. ---------------------------------------------------------------------------- */ #include #include #include #include #include float objective(GAGenome &); int main(int argc, char **argv) { cout << "Example 15\n\n"; cout << "This program generates a sequence of random numbers then uses\n"; cout << "a simple GA and binary-to-decimal genome to match the\n"; cout << "sequence. It uses the convergence of the best-of-generation\n"; cout << "as the criterion for when to stop.\n\n"; // See if we've been given a seed to use (for testing purposes). When you // specify a random seed, the evolution will be exactly the same each time // you use that seed number. unsigned int seed = 0; for(int ii=1; ii