libfgen  0.1.15
Library for optimization using a genetic algorithm or particle swarm optimization
seed.c
00001 /*
00002     seed.c -- seeding functions for the genetic algorithm
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 
00025 #include <stdlib.h>
00026 #include "fgen.h"               /* General includes. */
00027 #include "parameters.h"
00028 #include "population.h"         /* Module includes. */
00029 #include "bitstring.h"
00030 #include "random.h"
00031 
00036 void fgen_seed_random(FgenPopulation *pop, unsigned char *bitstring) {
00037         CreateRandomBitstring(pop->rng, bitstring, INDIVIDUAL_SIZE_IN_BYTES(pop));
00038 }
00039 
00040 
00046 void fgen_seed_permutation_random(FgenPopulation *pop, unsigned char *bitstring) {
00047         CalculateRandomOrder(pop->rng, (int *)bitstring, pop->permutation_size);
00048 }
00049 
 All Data Structures Functions Variables