# mewuto/mqt-ion-shuttler architecture

> Architecture diagram of the GitHub repository mewuto/mqt-ion-shuttler, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mewuto/mqt-ion-shuttler
- Repository: https://github.com/mewuto/mqt-ion-shuttler

## Overview

##### Project Type and Purpose
- This is an open-source command-line tool (part of the Munich Quantum Toolkit) for generating ion-shuttling schedules on grid-like memory zones of trapped-ion quantum computers.
- It offers two modes:
- Exact scheduling via SAT solving (small devices)
- Heuristic scheduling (large devices)

##### Top-Level File Structure Analysis
- CLI entrypoints:
- run.py            – exact scheduler CLI
- run_heuristic.py  – heuristic scheduler CLI
- run_benchmarks.py – batch runs
- Core modules:
- Memory_grid.py    – data model for the ion-trap grid
- Cycles.py         – cycle enumeration utilities
- SAT.py            – SAT-based scheduling engine
- scheduling.py     – heuristic algorithm engine
- compilation.py    – translator from QASM to internal model
- graph_utils.py    – graph-theoretic helper routines
- plotting.py       – visualization of schedules
- Data/config directories:
- algorithms/            – JSON specs for exact runs
- algorithms_heuristic/  – JSON specs for heuristics
- QASM_files/            – sample quantum circuits
- Devops/CI:
- Dockerfile
- .github/workflows/python.yml
- Makefile, pre-commit config

##### Key README Insights
- Workflow for exact and heuristic runs use JSON algorithm spec + optional “--plot”
- Architecture and algorithm are fully specified in JSON files
- Outputs are schedules (and optionally plots)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% CLI Layer
    subgraph "CLI Interface Layer"
        CLI_EX("Exact Scheduler CLI"):::core
        CLI_HE("Heuristic Scheduler CLI"):::core
        CLI_BEN("Batch Runs CLI"):::core
    end

    %% Input Specification
    subgraph "Input Specification"
        JSON_EX("algorithms/ (Exact JSON Specs)"):::data
        JSON_HE("algorithms_heuristic/ (Heuristic JSON Specs)"):::data
        QASM("QASM_files/ (Sample QASM Circuits)"):::data
    end

    %% Parser & Compiler
    comp("Parser & Compiler: compilation.py"):::core

    %% Internal Models & Utilities
    subgraph "Internal Models & Utilities"
        MG("Memory_grid.py"):::core
        CY("Cycles.py"):::core
        GU("graph_utils.py"):::core
    end

    %% Scheduling Engines
    subgraph "Scheduling Engines"
        ES("ExactScheduler (SAT.py)"):::core
        HS("HeuristicScheduler (scheduling.py)"):::core
        SAT_EXT("SAT Solver Lib"):::ext
    end

    %% Visualization
    VIS("Visualization: plotting.py"):::core
    NOTEBOOK("Interactive Notebook Demo: heuristic.ipynb"):::core

    %% External Dependencies
    subgraph "External Dependencies"
        REQ("requirements.txt"):::ext
        PYPROJ("pyproject.toml"):::ext
    end

    %% Devops & CI
    subgraph "Devops & CI"
        DOCKER("Dockerfile"):::devops
        CI("GitHub Actions CI (.github/workflows/python.yml)"):::devops
        MAKE("Makefile"):::devops
        PRE("Pre-commit Hooks (.pre-commit-config.yaml)"):::devops
    end

    %% Data and Control Flow
    CLI_EX --> comp
    CLI_HE --> comp
    CLI_BEN --> comp
    JSON_EX --> comp
    JSON_HE --> comp
    QASM --> comp

    comp --> MG
    comp --> CY
    comp --> GU

    MG --> ES
    MG --> HS
    ES --> SAT_EXT
    ES --> VIS
    HS ---> VIS

    VIS --> NOTEBOOK

    CLI_EX --> DOCKER
    CLI_HE --> DOCKER
    CLI_BEN --> DOCKER
    MAKE --> DOCKER
    MAKE --> CI

    %% Click Events
    click CLI_EX "https://github.com/mewuto/mqt-ion-shuttler/blob/main/run.py"
    click CLI_HE "https://github.com/mewuto/mqt-ion-shuttler/blob/main/run_heuristic.py"
    click CLI_BEN "https://github.com/mewuto/mqt-ion-shuttler/blob/main/run_benchmarks.py"
    click JSON_EX "https://github.com/mewuto/mqt-ion-shuttler/tree/main/algorithms/"
    click JSON_HE "https://github.com/mewuto/mqt-ion-shuttler/tree/main/algorithms_heuristic/"
    click QASM "https://github.com/mewuto/mqt-ion-shuttler/tree/main/QASM_files/"
    click comp "https://github.com/mewuto/mqt-ion-shuttler/blob/main/compilation.py"
    click MG "https://github.com/mewuto/mqt-ion-shuttler/blob/main/Memory_grid.py"
    click CY "https://github.com/mewuto/mqt-ion-shuttler/blob/main/Cycles.py"
    click GU "https://github.com/mewuto/mqt-ion-shuttler/blob/main/graph_utils.py"
    click ES "https://github.com/mewuto/mqt-ion-shuttler/blob/main/SAT.py"
    click HS "https://github.com/mewuto/mqt-ion-shuttler/blob/main/scheduling.py"
    click VIS "https://github.com/mewuto/mqt-ion-shuttler/blob/main/plotting.py"
    click NOTEBOOK "https://github.com/mewuto/mqt-ion-shuttler/blob/main/heuristic.ipynb"
    click REQ "https://github.com/mewuto/mqt-ion-shuttler/blob/main/requirements.txt"
    click PYPROJ "https://github.com/mewuto/mqt-ion-shuttler/blob/main/pyproject.toml"
    click DOCKER "https://github.com/mewuto/mqt-ion-shuttler/tree/main/Dockerfile"
    click CI "https://github.com/mewuto/mqt-ion-shuttler/blob/main/.github/workflows/python.yml"
    click MAKE "https://github.com/mewuto/mqt-ion-shuttler/tree/main/Makefile"
    click PRE "https://github.com/mewuto/mqt-ion-shuttler/blob/main/.pre-commit-config.yaml"

    %% Styles
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef data fill:#98FB98,stroke:#333,stroke-width:1px
    classDef ext fill:#FFA500,stroke:#333,stroke-width:1px
    classDef devops fill:#D3D3D3,stroke:#333,stroke-width:1px
```
