libfgen
0.1.15
Library for optimization using a genetic algorithm or particle swarm optimization
|
00001 /* 00002 population.h -- prototypes of functions defined in population.c. 00003 00004 fgen -- Library for optimization using a genetic algorithm or particle swarm optimization. 00005 Copyright 2012, Harm Hanemaaijer 00006 00007 This file is part of fgen. 00008 00009 fgen is free software: you can redistribute it and/or modify it 00010 under the terms of the GNU Lesser General Public License as published 00011 by the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 fgen is distributed in the hope that it will be useful, but WITHOUT 00015 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00016 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00017 License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with fgen. If not, see <http://www.gnu.org/licenses/>. 00021 00022 */ 00023 00024 void CreateInitialPopulation(FgenPopulation *pop); 00025 00026 /* Fill in the fitness of the individual (calculate if necessary). */ 00027 00028 void CalculateIndividualFitness(FgenPopulation *, FgenIndividual *); 00029 00030 /* Allocate a population (array of pointers to individuals). */ 00031 00032 FgenIndividual **AllocatePopulation(FgenPopulation *pop); 00033 00034 /* Fill in the fitness of all individuals in the population, and */ 00035 /* calculate the sum and minimum fitness. */ 00036 00037 void CalculatePopulationFitness(FgenPopulation *, double *sum_out, double *min_fitness_out); 00038 00039 /* Fill in the fitness of all individuals using threads. */ 00040 00041 void CalculatePopulationFitnessThreaded(FgenPopulation *); 00042 void CalculatePopulationFitnessHeavilyThreaded(FgenPopulation *); 00043 00044 /* Copy a bitstring from one individual to another (not shared). */ 00045 00046 void CopyIndividualBitstring(FgenPopulation *pop, FgenIndividual *src, FgenIndividual *dest); 00047 00048 /* Reduce the reference count of the individual, and deallocate if it zero. */ 00049 00050 void FreeIndividual(FgenIndividual *ind); 00051 00052 /* Allocate a new individual and initialize the fields. */ 00053 00054 FgenIndividual *NewIndividual(FgenPopulation *pop); 00055 00056 /* Free all invididuals in the population. */ 00057 00058 void FreePopulation(FgenPopulation *pop, FgenIndividual **ind); 00059 00060 /* Return the best individual of the population. */ 00061 00062 FgenIndividual *BestIndividualOfPopulation(FgenPopulation *pop); 00063