evol
a python grammar for evolutionary algorithms and heuristics
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 7 committers (14.3%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.0%) to scientific vocabulary
Keywords
Repository
a python grammar for evolutionary algorithms and heuristics
Basic Info
- Host: GitHub
- Owner: godatadriven
- License: mit
- Language: Python
- Default Branch: master
- Homepage: https://evol.rtfd.io
- Size: 1.31 MB
Statistics
- Stars: 190
- Watchers: 6
- Forks: 12
- Open Issues: 10
- Releases: 0
Topics
Metadata Files
README.md

Evol is clear dsl for composable evolutionary algorithms that optimised for joy.
Installation
We currently support python3.6 and python3.7 and you can install it via pip.
pip install evol
Documentation
For more details you can read the docs but we advice everyone to get start by first checking out the examples in the /examples directory. These stand alone examples should show the spirit of usage better than the docs.
The Gist
The main idea is that you should be able to define a complex algorithm in a composable way. To explain what we mean by this: let's consider two evolutionary algorithms for travelling salesman problems.
The first approach takes a collections of solutions and applies:
- a survival where only the top 50% solutions survive
- the population reproduces using a crossover of genes
- certain members mutate
- repeat this, maybe 1000 times or more!

We can also think of another approach:
- pick the best solution of the population
- make random changes to this parent and generate new solutions
- repeat this, maybe 1000 times or more!

One could even combine the two algorithms into a new one:
- run algorithm 1 50 times
- run algorithm 2 10 times
- repeat this, maybe 1000 times or more!

You might notice that many parts of these algorithms are similar and it is the goal of this library is to automate these parts. We hope to provide an API that is fun to use and easy to tweak your heuristics in.
A working example of something silimar to what is depicted above is shown below. You can also find this code as an example in the /examples/simple_nonlinear.py.
```python import random from evol import Population, Evolution
random.seed(42)
def random_start(): """ This function generates a random (x,y) coordinate """ return (random.random() - 0.5) * 20, (random.random() - 0.5) * 20
def functooptimise(xy): """ This is the function we want to optimise (maximize) """ x, y = xy return -(1-x)2 - 2*(2-x2)**2
def pickrandomparents(pop): """ This is how we are going to select parents from the population """ mom = random.choice(pop) dad = random.choice(pop) return mom, dad
def makechild(mom, dad): """ This function describes how two candidates combine into a new candidate Note that the output is a tuple, just like the output of `randomstart` We leave it to the developer to ensure that chromosomes are of the same type """ childx = (mom[0] + dad[0])/2 childy = (mom[1] + dad[1])/2 return childx, childy
def addnoise(chromosome, sigma): """ This is a function that will add some noise to the chromosome. """ newx = chromosome[0] + (random.random()-0.5) * sigma newy = chromosome[1] + (random.random()-0.5) * sigma return newx, new_y
We start by defining a population with candidates.
pop = Population(chromosomes=[randomstart() for _ in range(200)], evalfunction=functooptimise, maximize=True)
We define a sequence of steps to change these candidates
evo1 = (Evolution() .survive(fraction=0.5) .breed(parentpicker=pickrandomparents, combiner=makechild) .mutate(func=add_noise, sigma=1))
We define another sequence of steps to change these candidates
evo2 = (Evolution() .survive(n=1) .breed(parentpicker=pickrandomparents, combiner=makechild) .mutate(func=add_noise, sigma=0.2))
We are combining two evolutions into a third one. You don't have to
but this approach demonstrates the flexibility of the library.
evo3 = (Evolution() .repeat(evo1, n=50) .repeat(evo2, n=10) .evaluate())
In this step we are telling evol to apply the evolutions
to the population of candidates.
pop = pop.evolve(evo3, n=5) print(f"the best score found: {max([i.fitness for i in pop])}") ```
Getting Started
The best place to get started is the /examples folder on github.
This folder contains self contained examples that work out of the
box.
How does it compare to ...
- ... deap? We think our library is more composable and pythonic while not removing any functionality. Our library may be a bit slower though.
- ... hyperopt? Since we force the user to make the actual algorithm we are less black boxy. Hyperopt is meant for hyperparameter tuning for machine learning and has better support for search in scikit learn.
- ... inspyred? The library offers a simple way to get started but it seems the project is less actively maintained than ours.
Owner
- Name: Xebia Data
- Login: godatadriven
- Kind: organization
- Location: Amsterdam
- Website: https://xebia.com/digital-transformation/data-and-ai/
- Repositories: 103
- Profile: https://github.com/godatadriven
GitHub Events
Total
- Watch event: 4
- Pull request event: 1
- Fork event: 1
Last Year
- Watch event: 4
- Pull request event: 1
- Fork event: 1
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Rogier van der Geer | r****r@g****m | 197 |
| vincent | v****m@g****m | 94 |
| Warmerdam, Vincent | v****m@r****m | 50 |
| Jason | j****w@g****m | 20 |
| EC2 Default User | e****r@i****l | 1 |
| Niels Zeilemaker | n****s@z****l | 1 |
| Fokko Driesprong | f****g@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 8 months ago
All Time
- Total issues: 34
- Total pull requests: 66
- Average time to close issues: 6 months
- Average time to close pull requests: about 2 months
- Total issue authors: 7
- Total pull request authors: 6
- Average comments per issue: 2.88
- Average comments per pull request: 1.94
- Merged pull requests: 51
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- koaning (22)
- rogiervandergeer (7)
- ELC (1)
- GiliardGodoi (1)
- Alfie8362 (1)
- Fokko (1)
- mattc-eostar (1)
Pull Request Authors
- rogiervandergeer (31)
- koaning (31)
- jasondemorrow (1)
- NielsZeilemaker (1)
- gglanzani (1)
- Fokko (1)
- triplechecker-com (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 175 last-month
- Total dependent packages: 0
- Total dependent repositories: 4
- Total versions: 14
- Total maintainers: 1
pypi.org: evol
A Grammar for Evolutionary Algorithms and Heuristics
- Homepage: https://github.com/godatadriven/evol
- Documentation: https://evol.readthedocs.io/
- License: MIT License
-
Latest release: 0.5.3
published almost 4 years ago
Rankings
Maintainers (1)
Dependencies
- multiprocess >=0.70.6.1