/* * GENESIS Copyright (c) 1986, 1990 by John J. Grefenstette * This program may be freely copied for educational * and research purposes. All other rights reserved. * * file: best.c * * purpose: input, maintenance and output of best structures * * modified: 15 apr 86 * 12 nov 86: pass Length to Pack() and Unpack() * 16 dec 86: don't print Bestsize to minfile in Printbest() * 15 sep 90: handle float representation in i/o */ #include "extern.h" static double worst_value; /* worst value in the Bestset */ static int worst; /* pointer to element with worst_value */ Savebest(i) register int i; /* index of structure to consider for Bestset */ { /* Save the ith structure in current population */ /* if it is one of the Savesize best seen so far */ register int j; /* loop control var */ register int k; int found; if (Bestsize < Savesize) { /* Bestsize is the number saved so far, so */ /* there are still empty slots in the Bestset. */ /* Check if an identical structure is already there */ for (j=0, found=0; j