Menu

Home

Harm Hanemaaijer

libfgen --Library for optimization using a genetic algorithm or particle swarm optimization

Introduction

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.

fgen

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 parallel computation, especially for archipelagos, and the library is thread-safe as long as two threads do not call member functions with the same population.

fpso

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

ffit is the interface to straightforward multi-dimensional function minimization. It can be used for model fitting where a set of parameters is evaluated resulting in an error value. A genetic algorithm or PSO can be used to find the global minimum. Parameters can be distributed withinin 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 real-valued parameters directly.

Examples
  • ones.c is a trivial GA problem using bitstrings.
  • func.c is a trivial function maximization problem using a GA.
  • tsp.c implements the Travelling Salesman Problem using a genetic algorithm with permutation representation using the invert mutation and order-based crossover.
  • tsp_archipelago.c does the same with an archipelago of concurrent genetic algorithms.
  • ffit_rastrigin.c uses the ffit API to find the minimum of a multi-dimensional Rastrigin function using a genetic algorithm or PSO.
  • ffit_rosenbrock.c does the same for the two-dimensional Rosenbrock-function.
  • pict is a program that decomposes an image into filled rectangles using the genetic algorithm. It can also compress textures into the DXT1 or ETC1 format.
  • tsp_gtk is a graphical example program for the Travelling Salesman Problem.
  • gp is an example of linear genetic programming, using the genetic algorithm to generate assembly language programs.

Documentation can be found on the project's SourceForge webpages at http://libfgen.sourceforge.net.


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.