Code Monkey home page Code Monkey logo

mqt-qubomaker's Introduction

PyPI OS License: MIT CI CD Documentation codecov

MQT QUBOMaker: Automatic Generation of QUBO Formulations from Optimization Problem Specifications

MQT QUBOMaker is a framework that can be used to automatically generate QUBO formulations for various optimization problems based on a selection of constraints that define the problem. It is developed by the Chair for Design Automation at the Technical University of Munich as part of the Munich Quantum Toolkit (MQT).

The tool allows users to create QUBO formulations, and, thus, interact with quantum algorithms, without requiring any background knowledge in the field of quantum computing. End-users can stay entirely within their domain of expertise while being shielded from the complex and error-prone mathematical tasks of QUBO reformulation.

Furthermore, MQT QUBOMaker supports a variety of different encodings. End users can easily switch between the encodings for evaluation purposes without any additional effort, a task that would otherwise require a large amount of tedious mathematical reformulation.

Currently, MQT QUBOMaker provides the following submodule:

  • Pathfinder: This submodule provides a specialization of the QUBOMaker class for the solution of optimization problems involving the search for paths in a directed graph. It provides a large set of pathfinding-related constraints that are used to define individual problem instances.

The Pathfinder submodule also has a supporting GUI to further facilitate its use.

For more details, please refer to:

Documentation

If you have any questions, feel free to create a discussion or an issue on GitHub.

Getting Started

mqt-qubomaker is available via PyPI.

(venv) $ pip install mqt.qubomaker

The following code gives an example of the usage with the pathfinder submodule:

import mqt.qubomaker as qm
import mqt.qubomaker.pathfinder as pf

# define an example graph to investigate.
graph = qm.Graph.from_adjacency_matrix(
    [
        [0, 1, 3, 4],
        [2, 0, 4, 2],
        [1, 5, 0, 3],
        [3, 8, 1, 0],
    ]
)

# select the settings for the QUBO formulation.
settings = pf.PathFindingQUBOGeneratorSettings(
    encoding_type=pf.EncodingType.ONE_HOT, n_paths=1, max_path_length=4, loops=True
)

# define the generator to be used for the QUBO formulation.
generator = pf.PathFindingQUBOGenerator(
    objective_function=pf.MinimizePathLength(path_ids=[1]),
    graph=graph,
    settings=settings,
)

# add the constraints that define the problem instance.
generator.add_constraint(pf.PathIsValid(path_ids=[1]))
generator.add_constraint(
    pf.PathContainsVerticesExactlyOnce(vertex_ids=graph.all_vertices, path_ids=[1])
)

# generate and view the QUBO formulation as a QUBO matrix.
print(generator.construct_qubo_matrix())

Detailed documentation and examples are available at ReadTheDocs.

References

MQT QUBOMaker has been developed based on methods proposed in the following paper:

Acknowledgements

The Munich Quantum Toolkit has been supported by the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation program (grant agreement No. 101001318), the Bavarian State Ministry for Science and Arts through the Distinguished Professorship Program, as well as the Munich Quantum Valley, which is supported by the Bavarian state government with funds from the Hightech Agenda Bayern Plus.

TUM Logo Coat of Arms of Bavaria ERC Logo MQV Logo

mqt-qubomaker's People

Contributors

burgholzer avatar dependabot[bot] avatar drovara avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ibrahimarris

mqt-qubomaker's Issues

๐Ÿ› Performance is remarkably worse for Python

Environment information

Python version: 3.12

Description

The generation and processing of QUBO functions seems to perform worse (tests requiring more than twice the time compared to 3.11).
If anything, it should perform better on 3.12.

This could be caused by one of the dependencies (most likely sympy). It still has to be investigated, whether this performance issue can be fixed from our side or if it requires changes in the library the issue stems from.

Expected behavior

We expect the Python 3.12 version of test cases to run as fast or faster than on Python 3.11.

How to Reproduce

  1. Create a Python 3.12 environment.
  2. Clone the mqt-qubomaker repository.
  3. Run the tests locally using pytest.

Resolve non-QUBO constraints

Currently, some cost functions are not QUBO. Employ one of these solutions:

  • Reduce the order by introducing additional variables in the final step
  • Pick variables in a smart fashion
    • re-use existing ones
    • re-order variables for maximum re-use
      • greedy
      • good algorithm (NP-hard?)
    • simplify some cases (e.g.: given $y = x_1x2$, reduce $yx_2$ to $y$)

Use TSPLib as input

Includes the following tasks:

  • Support TSP
  • Support ATSP
  • Support HCP
  • Support SOP
  • Support constraints of forced edges

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.