Coder Social home page Coder Social logo

geneticalgorithmsrepo's Introduction

GeneticAlgorithmsRepo

An assortment of genetic algorithms - all written from scratch, for Python 3.5.

Objective Function Maximization

fmga is a genetic algorithms package for arbitrary function maximization.
fmga is available on PyPI - latest version 2.4.0 - and now supports multiprocessing!

pip install fmga

Then, use with:

import fmga
fmga.maximize(f, population_size=200, iterations=40, multiprocessing=True)

The objective function doesn't have to be differentiable, or even continuous in the specified domain!
The population of multi-dimensional points undergoes random mutations - and is selected through elitism and raking selection with selection weights inversely proportional to fitness and diversity ranks.

fmga_plots.py contains relevant code on obtaining surface plots of the function (if 2-dimensional), initial population and final population graphs, as well as line plots of mean population fitness and L1 diversity through the iterations.
Completely customizable - licensed under the MIT License.


A neural network trained by fmga by code in fmga_neuro.py, inspired by this exercise.

See the README in the fmga subdirectory for more details.

Minimum Vertex Cover for Graphs

vertex_cover.py gives a genetic algorithm heuristic to the well-known NP-Complete Minimum Vertex Cover problem - given a graph, find a subset of its vertices such that every edge has an endpoint in this subset.
This is an implementation of the OBIG heuristic with an indirect binary decision diagram encoding for the chromosomes, which is described in this paper by Isaac K. Evans, here.
A networkx graph is used as an input - and a population of vertex covers mutates and breeds to find an minimum vertex cover. As above, elitism and breeding with selection weights inversely proportional to fitness and diversity ranks are used to generate the new population.
The fitness of each vertex cover is defined as:

geneticalgorithmsrepo's People

Contributors

ameya98 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.