FinchGE is a grammatical evolution library.
Project description
FinchGE: A Modular Grammatical Evolution Library
FinchGE is a modern Python library for grammar-constrained evolutionary search, built around grammatical evolution, modular operators, reproducible experiments, and benchmark-driven research workflows.
Features
- Define grammars using BNF-style syntax
- Supports standard genetic operations: selection, crossover, mutation, replacement
- Flexible fitness evaluation for various problem domains
- Modular and extensible design allowing conveniently plugin custom components
- Easy-to-read in-built logging and visualization
- Intuitive API with extensive documentation and examples
- Benchmark suite for regression, logic and control problems
Who is FinchGE for?
- Researchers experimenting with grammatical evolution and grammar-guided search.
- Python users who want to evolve programs, expressions, rules, or structured solutions from BNF grammars.
- Symbolic regression users who need grammar constraints or multi-objective search.
- Students learning genotype-to-phenotype mapping, derivation trees, and evolutionary search.
- Developers building custom evolutionary workflows with custom fitness, operators, or benchmarks.
Why FinchGE?
FinchGE is designed around grammar-first evolutionary workflows:
- BNF-style grammars define valid programs, expressions, rules, or policies.
- Genotypes map to phenotypes through explicit GE mapping.
- Derivation trees and mapping metadata can be inspected.
- Operators, fitness functions, initializers, runners, and algorithms are modular.
- Runs can be configured, logged, checkpointed, and reproduced.
- Benchmark suites are included for symbolic regression, logic, and control problems.
Installation
# Basic installation
python -m pip install finchge
# With optional dependencies
python -m pip install finchge[pytorch] # PyTorch support for using pytorch models (for HPO or NAS)
Quick Example
Using finchGE is straightforward.
Step 1. Define grammar
grammar_file = "grammar.bnf"
grammar = Grammar.from_file(grammar_file)
Step 2. Define a Fitness Evaluator ; fitness_evaluator
fitness_evaluator = FitnessEvaluator(
fitness_functions=StringMatchFitness(target="hello"),
mapper=GenotypeMapper(grammar=grammar)
)
Step 3. Create GrammaticalEvolution instance and run
ge = GrammaticalEvolution(config=FinchConfig.default(),
grammar=grammar,
fitness_evaluator=fitness_evaluator)
ge.run()
For further details and more advanced usage, please check documentation at finchge.readthedocs.io, including Getting Started, API docReference and Examples
Status
FinchGE is currently beta software. The core library is usable for experiments, but APIs may still evolve as the project moves toward a stable release.
Contributing
All contributions are welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Bug Reports and Feature Requests
Found a bug or have a feature request? Please open an issue on GitHub.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 finchge-1.0.1b13.tar.gz.
File metadata
- Download URL: finchge-1.0.1b13.tar.gz
- Upload date:
- Size: 144.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ab40a3430d97b026386be9b0726016d05a992e6e5059b46ee5c953f53e82593
|
|
| MD5 |
0c1a2dd03901396003e280f3fce25a7f
|
|
| BLAKE2b-256 |
8cd06d3ef559db7f9fdd706a998372175552cec29562a01f5cd2e0420727a0cf
|
File details
Details for the file finchge-1.0.1b13-py3-none-any.whl.
File metadata
- Download URL: finchge-1.0.1b13-py3-none-any.whl
- Upload date:
- Size: 193.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4573c815d8fe693512784936d9c6baf922768d7dc32631a32932a1e56e177644
|
|
| MD5 |
a35d720338ab11b02e526b5064cdc05a
|
|
| BLAKE2b-256 |
a05ae817cfc00fb80e5a3765179f90854a6a2090130b1c8faa4b9b9c2ae09d2e
|