Finch: Evolutionary Algorithm Framework
Finch is a Python framework for implementing evolutionary algorithms. It provides a modular approach to building and experimenting with various evolutionary computation techniques.
Key Features
- Modular design with customizable components
- Support for different types of genes (float arrays, strings, arrays)
- Various selection, crossover, and mutation operators
- GPU acceleration support using CuPy
- Visualization tools for monitoring evolution progress
Main Components
-
GenePool: Generates initial populations
- FloatPool, StringPool, ArrayPool, ImagePool
-
Individual: Represents a single solution in the population
-
Layer: Defines genetic operators
- Selection layers
- Crossover layers (e.g., N-Point, Uniform)
- Mutation layers (e.g., Gaussian, Uniform, Polynomial, Swap, Inversion, Scramble)
-
Environment: Manages the evolution process
-
Competition: Allows comparing multiple evolutionary strategies
Usage
- Define your fitness function
- Create a GenePool
- Set up Layers for selection, crossover, and mutation
- Initialize an Environment with your layers and individuals
- Run the evolution process
Example
import Finch.layers as layers
from Finch.selectors import *
from Finch.generic import *
def fitness_function(individual):
return sum(individual.item)
gene_pool = layers.float_arrays.FloatPool(ranges=[[-5, 5]] * 10, length=10, fitness_function=fitness_function)
mutation_selection = RandomSelection(percent_to_select=.1)
crossover_selection = RandomSelection(amount_to_select=2)
# Set up layers
layers = [
layers.universal_layers.Populate(population=500, gene_pool=gene_pool),
layers.array_layers.ParentNPoint(selection_function=crossover_selection.select, families=4, children=4),
layers.float_arrays.GaussianMutation(mutation_rate=0.1, sigma=0.5, selection_function=mutation_selection.select),
layers.universal_layers.SortByFitness(),
layers.universal_layers.CapPopulation(1000),
]
env = Environment(layers)
env.compile()
env.evolve(generations=1000)
print(env.best_ever.item)
env.plot()
Installation
pip install finch-genetics
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.
Metadata
Release files for finch-genetics 3.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| finch-genetics-3.5.3.tar.gz | 10.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| finch_genetics-3.5.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.3 kB
Release files / finch-genetics-3.5.3.tar.gz
| Download URL | finch-genetics-3.5.3.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8507ac298ee874b06fa8c3882e8b0335ef16dd257daa82463d39faebfcd045c
|
|
BLAKE2b-256 checksum How to use checksums |
d99d45250ce60269db8dd982ad9eace850c80d9e894f124df87c8aba5599c63b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.1
|
Release files / finch_genetics-3.5.3-py3-none-any.whl
| Download URL | finch_genetics-3.5.3-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c429858548b3dd7405196f71b2e5eb99ef6b11a0e152dde06183a14a2fea46bb
|
|
BLAKE2b-256 checksum How to use checksums |
b95f9ae440c75ee5d3f034ea906dc797e2c57ec18ff3539536b68a838977a872
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.1
|
Security for finch-genetics 3.5.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.