A package for simulating evolution via the use of genetic algorithms
Project description
EvoSim
EvoSim is a package developed to enable the simulation of various types of speciation in the simplest possible enviornment that would enable such a behavior. EvoSim allows for allopatric speciation to occur by implimenting spatial gentic transfer and reproduction between agents inside the simulation. As agents move around, eat food, and reproduce; the agents evolve over many generations to develop specific fitness-agnostic traits and preferences for those traits. EvoSim creates a single population of these agents then splits this population in half, allowing each half to evolve on their own further. After some time, random mutations cause the two groups to seperate to such a degree that they will not choose to reproduce across groups, thus achieving allopatric speciation.
Example Usage
EvoSim first creates a simulation of some size, with some initial population and food density. Then, we burn in the inital population for a number of steps before adding a barrier. After the barrier is added, EvoSim periodically checks if speciation has occured, and to what degree. A full simulation loop and speciation check can be seen below:
from EvoSim import Simulation, DefaultController
sim = Simulation(size=(100,100),
pop_density=0.5,
food_density=0.75,
controller=DefaultController(),
logger=None,
barrier_orientation='vertical')
extinct, _ = sim.run(num_steps=20000)
sim.add_barrier()
speciated = False
while not speciated and not extinct:
extinct, hybrid_rate = sim.run(num_steps=1000)
if hybrid_rate < 0.05:
speciated = True
individuals = [c for c in sim.grid.values() if c['individual']]
print(f"Hybrid Rate: {hybrid_rate} Population Size: {len(individuals)}")
Visualization
The internal simulation of EvoSim can be visualized via the following at any point:
vis = GridVisualizer(sim, interval=100, show_energy=True)
vis.show()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file evosim-0.1.0.tar.gz.
File metadata
- Download URL: evosim-0.1.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
886997cdcda95aec2c1b3b7e08f4e1869df318d2fb6e26f90f3693efbbb36f44
|
|
| MD5 |
b2c8f8dce307470283c682d5fcac8160
|
|
| BLAKE2b-256 |
ea4ba15d74d102ef6d1087b14c9e7a8b08a8a713a209f166972ea59fb1bfcfa1
|
File details
Details for the file evosim-0.1.0-py3-none-any.whl.
File metadata
- Download URL: evosim-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7352aedecd71de1a6810eb4044dba95d97684b24b7bce0e47932c151e254d10d
|
|
| MD5 |
b7f402a9bbd93723e4cda7eb2201e794
|
|
| BLAKE2b-256 |
571f5000f36fb5076e68e4ce5632bf3b383730b931e19c6f4d8b7d9eb268e3ae
|