2 * collectd - src/sn_population.h
3 * Copyright (C) 2008-2010 Florian octo Forster
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; only version 2 of the License is applicable.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 * Florian octo Forster <ff at octo.it>
22 #ifndef SN_POPULATION_H
23 #define SN_POPULATION_H 1
26 #include "sn_network.h"
31 * Opaque data type for the population.
33 struct sn_population_s;
34 typedef struct sn_population_s sn_population_t;
36 sn_population_t *sn_population_create (uint32_t size);
37 void sn_population_destroy (sn_population_t *p);
42 * Puts a new network into the population. The network is _copied_ and may be
43 * modified by the caller after inserting the network. This won'thave an effect
44 * on the copy in the population, though. Of course, the caller must free his
47 int sn_population_push (sn_population_t *p, sn_network_t *n);
52 * Returns a _copy_ of an individuum in the population. The network is NOT
53 * removed from the population by this operation! The caller must free this
54 * copy himself. Returns NULL upon failure.
56 sn_network_t *sn_population_pop (sn_population_t *p);
58 sn_network_t *sn_population_best (sn_population_t *p);
59 int sn_population_best_rating (sn_population_t *p);
61 #endif /* SN_POPULATION_H */