Skip to main content

FinchGE is a grammatical evolution library.

Project description

FinchGE: A Modular Grammatical Evolution Library

PyPI Python License Docs Status Tests

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!

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

finchge-1.0.1b13.tar.gz (144.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

finchge-1.0.1b13-py3-none-any.whl (193.6 kB view details)

Uploaded Python 3

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

Hashes for finchge-1.0.1b13.tar.gz
Algorithm Hash digest
SHA256 1ab40a3430d97b026386be9b0726016d05a992e6e5059b46ee5c953f53e82593
MD5 0c1a2dd03901396003e280f3fce25a7f
BLAKE2b-256 8cd06d3ef559db7f9fdd706a998372175552cec29562a01f5cd2e0420727a0cf

See more details on using hashes here.

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

Hashes for finchge-1.0.1b13-py3-none-any.whl
Algorithm Hash digest
SHA256 4573c815d8fe693512784936d9c6baf922768d7dc32631a32932a1e56e177644
MD5 a35d720338ab11b02e526b5064cdc05a
BLAKE2b-256 a05ae817cfc00fb80e5a3765179f90854a6a2090130b1c8faa4b9b9c2ae09d2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page