libfgen  0.1.15
Library for optimization using a genetic algorithm or particle swarm optimization
libfgen Documentation


libfgen is a library that implements an efficient and customizable genetic algorithm (GA). It also provides particle swarm optimization (PSO) functionality and an interface for real-valued function minimization or model fitting. It is written in C with a partial C++ wrapper.


fgen is the interface to the genetic algorithm implementation. In addition to bitstring operators, permutation-based operators are also provided and custom seeding, mutation and crossover operators can be defined by the application, also allowing use of real-valued parameters. Archipelagos of multiple concurrent GAs are supported. Steady-state evolution is also supported. Internal threading allows efficient parallel computation. The library is thread-safe.


fgenpp is the C++ wrapper interface to fgen (the genetic algorithm implementation). It offers direct equivalents to the functions in the C version. A sub-class must be used to define the application specific operators.


fpso is the interface to the particle swarm optimization implementation, which provides a simple PSO with GBEST or LBEST topology and other customizable parameters. Although it can converge quickly for simple problems, for more complex higher dimensional problems the genetic algorithm generally performs much better.


ffit is the interface to straightforward multi-dimensional function minimization. It can be used for model fitting where a set of floating point parameters is evaluated resulting in an error value. It is also convenient for general optimization problems with real-valued parameters. A genetic algorithm or PSO can be used to find the global minimum. Parameters can be distributed within a range with a profile other than linear (for example logarithmic or binomial) to optimize the searching process. When using the genetic algorithm ffit uses 16, 32 or 64-bit bitstring representations mapped to real values, or alternatively normalized real values.


libfgen can be downloaded from the page for the project:


libfgen is copyright 2012-2013 Harm Hanemaaijer (fgenfb at and released under the GNU Lesser General Public License.

 All Data Structures Functions Variables