Skip to main content
Logo of GOLEM framework

Acknowledgement to SAI Acknowledgement to ITMO

Supported Python Versions PyPI Package Version Build Status Integration Build Status Coverage Status Documentation Status License Telegram Chat rus GitLab mirror for this repository

Graph Optimization and Learning by Evolutionary Methods

GOLEM is an open-source AI framework for optimization and learning of structured graph-based models with meta-heuristic methods. It is centered around 2 ideas:

  1. The potential of meta-heuristic methods in complex problem spaces.

The focus on meta-heuristics allows approaching the kinds of problems where gradient-based learning methods (notably, neural networks) can’t be easily applied, like optimization problems with multiple conflicting objectives or having a combinatorial nature.

  1. The importance of structured models in multiple problem domains.

Graph-based learning enables solutions in the form of structured and hybrid probabilistic models, not to mention that a wide range of domain-specific problems have a natural formulation in the form of graphs.

Together this constitutes an approach to AI that potentially leads to structured, intuitive, interpretable methods and solutions for a wide range of tasks.

Core Features

  • Structured models with joint optimization of graph structure and properties (node attributes).

  • Metaheuristic methods (mainly evolutionary) applicable to any task with a well-defined objective.

  • Multi-objective optimization that can take into account both quality and complexity.

  • Constrained optimization with support for arbitrary domain-specific constraints.

  • Extensible to new domains.

  • Interpretable thanks to meta-heuristics, structured models, and visualisation tools.

  • Reproducible thanks to rich optimization history and model serialization.

Applications

GOLEM is potentially applicable to any optimization problem structures:

  • that can be represented as directed graphs;

  • that have some clearly defined fitness function on them.

Graph models can represent fixed structures (e.g. physical models such as truss structures) or functional models that define a data-flow or inference process (e.g. bayesian networks that can be fitted and queried).

Examples of GOLEM applications:

As GOLEM is a general-purpose framework, it’s easy to imagine potential applications, for example, finite state automata search for robotics control or molecular graph learning for drug discovery, and more.

Installation

GOLEM can be installed with pip:

$ pip install thegolem

Quick Start Example

Following example demonstrates graph search using reference graph & edit distance metric. Optimizer is set up with a minimal set of parameters and simple single-point mutations. For more details see examples simple_run.py, graph_search.py and tree_search.py in directory examples/synthetic_graph_evolution.

def run_graph_search(size=16, timeout=8):
    # Generate target graph sought by optimizer using edit distance objective
    node_types = ('a', 'b')  # Available node types that can appear in graphs
    target_graph = generate_labeled_graph('tree', size, node_types)
    objective = Objective(partial(tree_edit_dist, target_graph))
    initial_population = [generate_labeled_graph('tree', 5, node_types) for _ in range(10)]

    # Setup optimization parameters
    requirements = GraphRequirements(timeout=timedelta(minutes=timeout))
    gen_params = GraphGenerationParams(adapter=BaseNetworkxAdapter(), available_node_types=node_types)
    algo_params = GPAlgorithmParameters(pop_size=30)

    # Build and run the optimizer
    optimiser = EvoGraphOptimizer(objective, initial_population, requirements, gen_params, algo_params)
    found_graphs = optimiser.optimise(objective)

    # Visualize results
    found_graph = gen_params.adapter.restore(found_graphs[0])  # Transform back to NetworkX graph
    draw_graphs_subplots(target_graph, found_graph, titles=['Target Graph', 'Found Graph'])
    optimiser.history.show.fitness_line()
    return found_graph

Tracing the lineage of the found_graph reveals how genetic operators (mutations, crossovers, etc.) are applied to a random graph one after another, eventually leading to the target graph:

Evolution process

One can also notice that despite the fact that the edit distance generally decreases along the genealogical path, the optimizer sometimes sacrifices local fitness gain of some graphs in order to achieve diversity and thus obtain the best possible solution at the end.

Project Structure

The repository includes the following packages and directories:

  • Package core contains the main classes and scripts.

  • Package core.adapter is responsible for transformation between domain graphs and internal graph representation used by optimisers.

  • Package core.dag contains classes and algorithms for representation and processing of graphs.

  • Package core.optimisers contains graph optimisers and all related classes (like those representing fitness, individuals, populations, etc.), including optimization history.

  • Package core.optimisers.genetic contains genetic (also called evolutionary) graph optimiser and operators (mutation, selection, and so on).

  • Package core.utilities contains utilities and data structures used by other modules.

  • Package serializers contains class Serializer with required facilities, and is responsible for serialization of project classes (graphs, optimization history, and everything related).

  • Package visualisation contains classes that allow to visualise optimization history, graphs, and certain plots useful for analysis.

  • Package examples includes several use-cases where you can start to discover how the framework works.

  • All unit and integration tests are contained in the test directory.

  • The sources of the documentation are in the docs directory.

Current R&D and future plans

Any contribution is welcome. Our R&D team is open for cooperation with other scientific teams as well as with industrial partners.

Contribution Guide

  • The contribution guide is available in the repository.

Acknowledgments

We acknowledge the contributors for their important impact and the participants of the numerous scientific conferences and workshops for their valuable advice and suggestions.

Supported by

The study is supported by the Research Center Strong Artificial Intelligence in Industry of ITMO University as part of the plan of the center’s program: Development and testing of an experimental prototype of the library of strong AI algorithms in terms of basic algorithms of automatic ML for structural training of composite AI models, including automation of feature selection

Contacts

Citation

If you use our project in your work or research, we would appreciate citations:

@inproceedings{pinchuk2024golem,
  title={GOLEM: Flexible Evolutionary Design of Graph Representations of Physical and Digital Objects},
  author={Pinchuk, Maiia and Kirgizov, Grigorii and Yamshchikova, Lyubov and Nikitin, Nikolay and Deeva, Irina and Shakhkyan, Karine and Borisov, Ivan and Zharkov, Kirill and Kalyuzhnaya, Anna},
  booktitle={Proceedings of the Genetic and Evolutionary Computation Conference Companion},
  pages={1668--1675},
  year={2024}
}

Metadata

Release files for thegolem 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for thegolem 0.5.0
File Size Uploaded
thegolem-0.5.0.tar.gz 177.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for thegolem 0.5.0
File Interpreter ABI Platform
thegolem-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 413.0 kB

Release files / thegolem-0.5.0.tar.gz

Download URL thegolem-0.5.0.tar.gz
Size 177.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5241a7d0223fa1e30ceb5930ad87688855379af289d03361963551454fb4049c
BLAKE2b-256 checksum
How to use checksums
7b87aa0eb4e1dadc5ba6b2a78b60916c493b18d9eba53ff1fca90bb7fcc43fab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / thegolem-0.5.0-py3-none-any.whl

Download URL thegolem-0.5.0-py3-none-any.whl
Size 235.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ab685a30d12e7d4fdb6a932b9cfa31c0dc2d9f9e75e5c34043e2842303ffd5b
BLAKE2b-256 checksum
How to use checksums
60ab9b3a884ce6e3705394a450d6f585d84dc0396625f34564721608b628e373
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page