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, modular, and user-friendly Python library for Grammatical Evolution (GE) - a powerful evolutionary algorithm that uses formal grammars to evolve programs, expressions, and solutions.

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

Why finchGE

  • Modular and extensible: Plug-and-play mutation, election, fitness, and search strategies.
  • Designed for research and industry: Convenient and flexible API for quicker implementation.

Installation

# Basic installation
pip install finchge

# With optional dependencies
pip install finchge[pytorch]    # PyTorch support for using pytorch models (for HPO or NAS)
pip install finchge[all]        # All optional dependencies

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

Development Status

Note: This is version 1.0.1-beta.11 - a beta release. Expect breaking changes and bugs.

What to expect:

  • Bugs and unexpected behavior
  • Rapid API changes
  • Frequent updates
  • Limited test coverage (improving daily)

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.1b11.tar.gz (138.5 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.1b11-py3-none-any.whl (186.2 kB view details)

Uploaded Python 3

File details

Details for the file finchge-1.0.1b11.tar.gz.

File metadata

  • Download URL: finchge-1.0.1b11.tar.gz
  • Upload date:
  • Size: 138.5 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.1b11.tar.gz
Algorithm Hash digest
SHA256 30e935ac33bc6b602ab4ebe5027dc34853f4ed3c26c0f84f1c199790b0aa9fae
MD5 2d94261cbb48e8fc0a526fd8c2d54425
BLAKE2b-256 4e6f298b0974e3e7729b2932154d7d6bb407c3f4c6ba3b458887b7113bd34501

See more details on using hashes here.

File details

Details for the file finchge-1.0.1b11-py3-none-any.whl.

File metadata

  • Download URL: finchge-1.0.1b11-py3-none-any.whl
  • Upload date:
  • Size: 186.2 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.1b11-py3-none-any.whl
Algorithm Hash digest
SHA256 2727d20c53b62581db160d6a6fecd00bdcc7f3aa9deedfdc4a7241045445a90e
MD5 cd75ed0a516718ec10a9f93ef11c0195
BLAKE2b-256 0cd2f7cf773b2f472134311fe89462cc5d33ab04dce071ef42acce763b1fedcb

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