Skip to content

Continuous release #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Own stuff
build/
Makefile
.vscode/
external/lemon/
external/lemon.tar.gz

# Python
__pycache__
out/
logs/

# Prerequisites
*.d
Expand Down Expand Up @@ -40,3 +41,5 @@ __pycache__
*.exe
*.out
*.app

.vscode/*
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "external/eigen"]
path = external/eigen
url = https://gitlab.com/libeigen/eigen.git
[submodule "external/thread-pool"]
path = external/thread-pool
url = https://github.com/bshoshany/thread-pool
26 changes: 26 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
# Python 3.9 problem: see https://github.com/readthedocs/readthedocs.org/issues/7554#issuecomment-785114155
build:
os: ubuntu-20.04
tools:
python: "3.9"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: python/docs/source/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
formats:
- pdf

# Optionally declare the Python requirements required to build your docs
# python:
# install:
# - requirements: docs/requirements.txt
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"python.formatting.autopep8Args": [
"--max-line-length",
"100"
]
}
17 changes: 12 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,31 @@ option(MAJORMINER_BUILD_TESTS "Build majorminer test executable" ON)
enable_language(C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CXX_STANDARD_REQUIRED ON)
set(CMAKE_BUILD_TYPE Debug)
set(MM_INCLUDE_LIBS external/oneTBB/include external/eigen build/external/lemon/ external/lemon/ src/)
set(CMAKE_BUILD_TYPE Release)
set(MM_INCLUDE_LIBS external/oneTBB/include external/eigen build/external/lemon/ external/lemon/ external/ src/)
set(MM_LINK_LIBS TBB::tbb lemon)

# neither build tests nor tbbmalloc in oneTBB
set(TBB_TEST CACHE BOOL OFF)
set(TBBMALLOC_BUILD CACHE BOOL OFF)
set(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH CACHE BOOL OFF)

set(LEMON_ENABLE_GLPK CACHE BOOL OFF)
set(LEMON_ENABLE_ILOG CACHE BOOL OFF)
set(LEMON_ENABLE_ILOG CACHE BOOL OFF)
set(LEMON_ENABLE_COIN CACHE BOOL OFF)
set(LEMON_ENABLE_SOPLEX CACHE BOOL OFF)


# build NetworkSimplex, gtest and oneTBB
add_subdirectory(external)



if ( CMAKE_COMPILER_IS_GNUCC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fdiagnostics-color=always")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror -fdiagnostics-color=always")
endif()
if ( MSVC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX")
endif()

add_library(majorminer)
Expand Down
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
# majorminer
# graph-embedder
[![Documentation Status](https://readthedocs.org/projects/majorminer/badge/?version=latest)](https://majorminer.readthedocs.io/en/latest/?badge=latest)


Testing a bunch of graph minor embedding heuristics and related techniques to improve the embedding of QUBOs.

Our final results for the project can be found [here](doc/Studienarbeit.pdf).


| :warning: | This is a research repo, so APIs and algorithms might change frequently as were are trying out different ideas. Moreover, this means that the code is not production-ready. |

| :warning: | This is a research repo, so APIs and algorithms might change frequently as we are trying out different ideas. Moreover, this means that the code is not production-ready. |
|---------------|:------------------------|

| :point_up: | We currently do not implement the same approaches in C++ and Python, but try out different ideas in different programming languages. Make sure to check out both the C++ and Python implementation. |
|---------------|:------------------------|

# Python
All Python-related code and documentation can be found [in the Python folder](python/).


<details>
<summary>C++</summary>

# Build C++ library
# C++
## Build C++ library
Note that in order to build, you have to clone the submodules as well. That is,
if you have already cloned this repository, you should run ```git submodule update --init --recursive``` and find the submodules in ```external/```.
In the case, you are about to clone the repository, just run ```git clone --recursive https://github.com/MinorEmbedding/majorminer.git```.
Expand All @@ -27,17 +32,10 @@ cmake .. -DMAJORMINER_BUILD_TESTS=[ON|OFF] # depending on whether you want to ru
make
```

# Libraries used in the C++-Project
## Libraries used in the C++-Project
#### [oneTBB](https://github.com/oneapi-src/oneTBB) (License: [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/))
#### [GoogleTest](https://github.com/google/googletest) (License: [BSD 3-Clause "New" or "Revised"](https://choosealicense.com/licenses/bsd-3-clause/))
#### [LEMON](https://lemon.cs.elte.hu/trac/lemon) (License: [Boost Software License 1.0](https://choosealicense.com/licenses/bsl-1.0/))
#### [Eigen](https://eigen.tuxfamily.org/index.php?title=Main_Page) (License: [MPL2](https://choosealicense.com/licenses/mpl-2.0/), disabled LGPL features.)
</details>

#### [thread-pool](https://github.com/bshoshany/thread-pool) (License: [MIT](https://choosealicense.com/licenses/mit/))


<details>
<summary>Python</summary>

All Python-related code and documentation can be found [in the Python folder](python/).
</details>
Binary file added doc/Studienarbeit.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions external/thread-pool
Submodule thread-pool added at b6cd77
2 changes: 2 additions & 0 deletions img/chimera_clique_12_95.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions img/chimera_clique_15_170.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/chimera_clique_18_211.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions img/chimera_clique_21_302.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions img/chimera_clique_25_421.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions img/chimera_clique_28_543.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions img/chimera_clique_31_653.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions img/chimera_clique_33_767.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions img/chimera_clique_34_799.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion img/chimera_clique_8_19.svg → img/chimera_clique_8_52.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions include/majorminer_lib.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef __MAJORMINER_MAJORMINER_LIB_HPP_
#define __MAJORMINER_MAJORMINER_LIB_HPP_

#include <majorminer_types.hpp>

#include <src/majorminer.hpp>

#include <src/common/embedding_analyzer.hpp>
#include <src/common/graph_info.hpp>
#include <src/common/embedding_validator.hpp>
#include <src/common/embedding_visualizer.hpp>
#include <src/lmrp/lmrp_king_subgraph.hpp>
#include <src/lmrp/lmrp_chimera_subgraph.hpp>

#endif
12 changes: 12 additions & 0 deletions python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.9.10
WORKDIR /app

RUN mkdir /app/out
RUN mkdir /app/logs

COPY requirements.txt .
RUN pip install -r requirements.txt

COPY ./src /app/src

ENTRYPOINT [ "python", "-m", "src.solver.evolution" ]
5 changes: 4 additions & 1 deletion python/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Python evolutionary embedding

| :warning: | This Readme is currently outdated. You can find the [documentation here](https://majorminer.readthedocs.io/)|
|---------------|:------------------------|

## Usage
Execute (from within the python folder):

Expand All @@ -16,4 +19,4 @@ In order to get **144 unique K4 embeddings on a single chimera cell**, execute (
python -m src.solver.k4_results
```

![144 unique K4 embeddings on a single chimera cell](./images/k4_embedding.svg)
![144 unique K4 embeddings on a single chimera cell](./images/k4_embedding.svg)
1 change: 1 addition & 0 deletions python/docs/Majorminer Python class diagram.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="Electron" modified="2021-11-17T06:44:44.188Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/14.5.1 Chrome/89.0.4389.82 Electron/12.0.1 Safari/537.36" etag="YLhbU3H9Y_1-47_qsndC" version="14.5.1" type="device"><diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">7Vtdc9o4FP01zOw+pGPZfPURCEmbpiktabNvjLAFVpEtVhYh5Nf3ypYxRkBMFgJLmMlkrGtZsu85ks+RRclpBU/XAo/9r9wjrGRb3lPJuSzZdg1V4b8KzJJAGX1MAkNBvSSEskCXPhMdtHR0Qj0S5SpK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fo9HkOxTw3dfkCJ06Nk4vYFN0zEJvYb65AalPuNKbjchpPU4spLiFWXpq+sFwZx//xFvSNKhQ1ifT9tZoBkH4ETKlK3ldsTBl5KXIQODMSQF7Jy6243ArgJSEIYlfcx/edwgzjuKuJkwt628MLctJ99E8pD6KnvhU9+2DSVZMBra2ccZc/WvI/iARBE39frZYu7fYjrLlq+oxaxZL5J4hcN0ygUcZu04HCYy1y27mGE9477Dd9t88P5/nCUylykN9N671dge1qIGcm9ew1ymfFeKJUXsqCULWprpa6+ULM5SQ3Zt6V72LVnMlUa99akdQssPVPotHknzK8d5I9T+5Uul8tqNSdar9IvRX7lofwfQL+ayak/yXsjjXZcNRVYi//r73aqZWmGyHY2aMRdOe24898RwetQ9RTx3uli+PeoHXy23Tc981rD/GdZDr5fbprvEntdTUg1m6RMcxntD8uCL4rZpMgUJIL1nNLdH803Xw1duSDU/cYC96AmCXV/l8mTBfM1e0wTf49jQtBJM89tGDszeFOxboqHOuG6Ba/UN95SuxNX82twIoTyZ/0YJCvHPlAxQQUCO1WHIpVI7U59K0gWoVGwKV+RlVB+c8zBWoN8mMlFZcdzDYvRNASxVSqwPVkUhnrjvWtHUr/fAhbeEIeujgUR9BRBok99dgwQUs9+wJa40+yGg0/4D</diagram></mxfile>
37 changes: 37 additions & 0 deletions python/docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd

pause
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
31 changes: 31 additions & 0 deletions python/docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.. _api:

API Reference
=============


Graph Module
------------

.. automodule:: src.graph.undirected_graph
:members:
:undoc-members:
:show-inheritance:

.. automodule:: src.graph.embedding_graph
:members:
:undoc-members:
:show-inheritance:

.. automodule:: src.graph.chimera_graph
:members:
:undoc-members:
:show-inheritance:


More Modules
------------

.. note::

To come soon...
82 changes: 82 additions & 0 deletions python/docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Great tutorial for this setup
# https://samnicholls.net/2016/06/15/how-to-sphinx-readthedocs/#fn-841-5

# In order to build run the following commands:
# luckily ReadTheDocs is doing this automatically for us

# https://stackoverflow.com/a/46349694
# cd docs/
# sphinx-apidoc -o source/ ../src -f
# and after that run:
# ./make.bat html


# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html


# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys

# https://stackoverflow.com/a/44980548
sys.path.insert(0, os.path.abspath('../..'))


# -- Project information -----------------------------------------------------

project = 'majorminer'
copyright = '2021, Dominic Plein, Julien Meier'
author = 'Dominic Plein, Julien Meier'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.autosummary"
]

# Napoleon setup
napoleon_google_docstring = True # defaults to True
napoleon_use_ivar = True

# Inheritance Diagram
# https://www.sphinx-doc.org/en/master/usage/extensions/inheritance.html
# inheritance_graph_attrs = dict(
# rankdir="TB",
# size='""'
# )

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
25 changes: 25 additions & 0 deletions python/docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. majorminer documentation master file


Welcome to the documentation of the majorminer research project realized by two students of the DHBW Karlsruhe. This documentation only includes the API for the Python code, NOT the C++ code.

* :ref:`genindex`
* :ref:`modindex`


Overview
========

.. toctree::
:maxdepth: 2

overview


API Reference
=============

.. toctree::
:maxdepth: 2

api
7 changes: 7 additions & 0 deletions python/docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
src
===

.. toctree::
:maxdepth: 4

src
Loading