A genetic simulator written in Go

BioGo

This is a simple genetic simulator written in Go.

Heavily inspired by https://github.com/davidrmiller/biosim4/tree/main/src

About

This project simulates natural selection and genetic inheritence.

To start, we represent behaviour via a genome, which is a collection of bytes that determine general characteristics, as well as a slice of genes responsible for generating a neural network.

A genome may look something like this:\

00101011|01001010|00000111|11110110|01010000|1|00000010|0|00000110|1|10110110|10000111|1|10110110|0|01110001|10101110

where each section of bits represents a single characteristic:\

OscPeriod|MaxEnergy|SightDistance|Responsiveness|MutationRate|ReproductionType|NeuronCount|BrainLength|...NeuralGenes

with neural genes representing a neural pathway:

SourceType|SourceID|SinkType|SinkID  |Weight
----------|--------|--------|--------|--------
         0|00000110|       1|10110110|10000111
         1|10110110|       0|01110001|10101110

In the simple case above, we create a simple neural network with three neurons:

    |--------|    weight   |--------|   weight    |--------|
    | Sensor |---10000111->| Neuron |--10101110-->| Action |
    |--------|             |--------|             |--------|

At the start of the simulation a number of creatures are created with random genomes. The creatures must solve a challenge, e.g. reach the left 10% of the map, before the "generation" is over. At first, the creatures are terrible at solving the problem: Generation 1

However, those that succeed go on to populate the next generation. Eventually, those that are most able to move left are able to dominate the genetic makeup of the population. However, some of these creatures are still blocked by the wall, and as such the survival rate stabilises at around 70%. Generation 51

The final piece of the puzzle is that there is a chance of genetic mutation when children inherit their parent's genome. This means that a more optimal strategy emerges and this new genome flourishes. In this example, a mutation occured that allowed the children to first travel down to below the wall before heading left. By the 500th generation 99.6% of creatures managed to survive the challenge and reach the left hand side: Generation 508

Install

cd biogo/ go run . Parameters can be adjusted in biogo/v2/simulation/parameters.go

Requirements

Go 1.15

Dependencies:

  • github.com/hajimehoshi/ebiten
  • github.com/hajimehoshi/ebiten/v2
  • golang.org/x/exp
  • golang.org/x/image

TODO

  • Concurrent execution of neural FFward steps to improve performance
  • Continuous environment rather than "Generations"
  • Redo the hastily made test UI
  • Output data to file for analysis
Similar Resources

Genetic algorithms using Golang Generics

Package genetic Package genetic implements genetic algorithms using Golang's Gen

Sep 23, 2022

A simple low bandwidth simulator written in go

NETSNAIL 0.8 ABOUT Netsnail is a simple network proxy that simulates low bandwidth. RUNNING Usage of netsnail: -d=0: the delay on data transfe

May 19, 2021

MIPS simulator written in Go

MIPS simulator written in Go

FUM-MIPS is a 5-stage CPU, that supports a subset of the MIPS Instruction Set. It is a 32-bit CPU with 32 general-purpose registers. The figure below shows an overview of the architecture.

Aug 8, 2022

Busy is a mouse movement simulator

Busy is a mouse movement simulator

Busy is a mouse movement simulator. It stops your system from going to sleep / idling and makes sure that you keep getting those notifications while you take that well deserved break.

Mar 31, 2021

2D particle system simulator for Go

2D particle system simulator for Go

twodeeparticles An engine-agnostic 2D particle system simulator for Go twodeeparticles does not render particles itself. Any rendering engine can be u

Dec 6, 2022

FLoC Simulator

FLoC Simulator

FLoC Simulator Command line FLoC simulator to calculate CohortID with using host list and cluster data. Build and Run Demo $ cd $ cd demos/floc_sampl

May 5, 2022

Autopilot in Go for docking the SpaceX Dragon capsule in the simulator

Autopilot in Go for docking the SpaceX Dragon capsule in the simulator

Dragon ISS Docking Autopilot in Go Autopilot written in Go and executed as WebAssembly for docking the SpaceX Dragon capsule in the official simulator

Sep 11, 2022

connect to microsoft flight simulator 2020 using golang

msfs2020-go simconnect package msfs2020-go/simconnect connects to microsoft flight simulator 2020 using golang. cross-compiles from macos/linux, no ot

Nov 23, 2022

secure scuttlebutt network simulator

Network Simulator a brief exposition on the network simulator to be built as part of SSB's NGI Pointer grant For the remainder of May—and likely parts

May 13, 2022

A LoRaWAN nodes' and network simulator that works with a real LoRaWAN environment (such as Chirpstack) and equipped with a web interface for real-time interaction.

A LoRaWAN nodes' and network simulator that works with a real LoRaWAN environment (such as Chirpstack) and equipped with a web interface for real-time interaction.

LWN Simulator A LoRaWAN nodes' simulator to simulate a LoRaWAN Network. Table of Contents General Info Requirements Installation General Info LWN Simu

Nov 20, 2022

Scalable package delivery logistics simulator built using SingleStore and Vectorized Redpanda

Scalable package delivery logistics simulator built using SingleStore and Vectorized Redpanda

Reference Architecture using SingleStore and Redpanda for global logistics 📯 INFO: For the story behind this code (and epic dashboards), check out th

Oct 29, 2022

A web-based simulator for the Kubernetes scheduler

A web-based simulator for the Kubernetes scheduler

Web-based Kubernetes scheduler simulator Hello world. Here is web-based Kubernetes scheduler simulator. On the simulator, you can create/edit/delete t

Dec 22, 2022

An easy-to-use, flexible network simulator library in Go.

ns-x An easy-to-use, flexible network simulator library for Go. Feature Programmatically build customizable and scalable network topology from basic n

Dec 13, 2022

K8s cluster simulator for workload scheduling.

K8s cluster simulator for workload scheduling.

Open-Simulator Motivation 概念定义 Open-Simulator 是 K8s 下的仿真调度组件。用户准备一批待创建 Workload 资源,Workload 资源指定好资源配额、绑核规则、亲和性规则、优先级等,通过 Open-Simulator 的仿真调度能力可判断当前集群

Dec 25, 2022

Wirewold cellular automata simulator, running entirely on GPU.

Wireworld-gpu Wireworld implements the data and rules for the Wireworld cellular automata. This particular version is an experiment whereby the simula

Dec 31, 2022

AutoTrackIR will automatically re-enabled your Track IR if flight simulator disabled it. (bug introduce in SU7)

AutoTrackIR AutoTrackIR will automatically re-enable your Track IR if flight simulator disabled it. (bug introduce in SU7) How it works ? It just watc

Oct 7, 2022

This repo contains implementation of Conway's Game of Life simulator

Conway's Game of Life simulation This repo contains implementation of Conway's Game of Life simulator. Build Prerequisite: Tho Go programming language

Aug 1, 2022

A cloud-native application simulator for golang

Build and upload Docker images Build docker images for main application and work

Aug 10, 2022

golife is a cell evolution simulator.

golife is a cell evolution simulator.

golife WORK IN PROGRESS golife is a cell evolution simulator. It presents autonomous organism with inner properties and behavior (hunter or prey) that

Dec 30, 2021
Related tags
Bzip2 Compression Tool written in Go

Bzip2 Compression Tool written in Go

Dec 28, 2021
Parallel implementation of Gzip for modern multi-core machines written in Go

gzip Parallel implementation of gzip for modern multi-core machines written in Go Usage: gzip [OPTION]... [FILE] Compress or uncompress FILE (by defau

Nov 16, 2021
zlib compression tool for modern multi-core machines written in Go

zlib compression tool for modern multi-core machines written in Go

Jan 21, 2022
Genetic Algorithms library written in Go / golang

Description Genetic Algorithms for Go/Golang Install $ go install git://github.com/thoj/go-galib.git Compiling examples: $ git clone git://github.com

Sep 27, 2022
Genetic Algorithm written in go

This genetic algorithm is designed to minimise the problem specific code from a genetic algorithm. The three interfaces Gene, Initialiser, an Evaluato

Feb 15, 2022
Genetic Algorithms library written in Go / golang

Description Genetic Algorithms for Go/Golang Install $ go install git://github.com/thoj/go-galib.git Compiling examples: $ git clone git://github.com

Sep 27, 2022
Evolutionary optimization library for Go (genetic algorithm, partical swarm optimization, differential evolution)
Evolutionary optimization library for Go (genetic algorithm, partical swarm optimization, differential evolution)

eaopt is an evolutionary optimization library Table of Contents Changelog Example Background Features Usage General advice Genetic algorithms Overview

Dec 30, 2022
Genetic Algorithm and Particle Swarm Optimization

evoli Genetic Algorithm and Particle Swarm Optimization written in Go Example Problem Given f(x,y) = cos(x^2 * y^2) * 1/(x^2 * y^2 + 1) Find (x,y) suc

Dec 22, 2022
Golang Genetic Algorithm
Golang Genetic Algorithm

goga Golang implementation of a genetic algorithm. See ./examples for info on how to use the library. Overview Goga is a genetic algorithm solution wr

Dec 19, 2022
Cook amazing genetic parts using our cookbook. Recipes and synthetic biology tools to take your breath away.

friendzymes-cookbook Friendly tools for a friendly community. A collection of tutorials and genetic tools for synthetic biology. This cookbook is a su

Aug 19, 2022