qubo-solver 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. qubo_solver-0.0.1/.github/ISSUE_TEMPLATE/bug-report.yml +52 -0
  2. qubo_solver-0.0.1/.github/ISSUE_TEMPLATE/config.yml +5 -0
  3. qubo_solver-0.0.1/.github/ISSUE_TEMPLATE/new-feature.yml +36 -0
  4. qubo_solver-0.0.1/.github/workflows/lint.yml +30 -0
  5. qubo_solver-0.0.1/.github/workflows/publish.yml +79 -0
  6. qubo_solver-0.0.1/.github/workflows/test.yml +88 -0
  7. qubo_solver-0.0.1/.gitignore +211 -0
  8. qubo_solver-0.0.1/.pre-commit-config.yaml +34 -0
  9. qubo_solver-0.0.1/LICENSE +13 -0
  10. qubo_solver-0.0.1/PKG-INFO +162 -0
  11. qubo_solver-0.0.1/README.md +122 -0
  12. qubo_solver-0.0.1/mkdocs.yml +133 -0
  13. qubo_solver-0.0.1/pyproject.toml +191 -0
  14. qubo_solver-0.0.1/qubosolver/__init__.py +14 -0
  15. qubo_solver-0.0.1/qubosolver/algorithms/__init__.py +0 -0
  16. qubo_solver-0.0.1/qubosolver/algorithms/greedy/__init__.py +7 -0
  17. qubo_solver-0.0.1/qubosolver/algorithms/greedy/greedy.py +711 -0
  18. qubo_solver-0.0.1/qubosolver/classical_solver/__init__.py +9 -0
  19. qubo_solver-0.0.1/qubosolver/classical_solver/classical_solver.py +193 -0
  20. qubo_solver-0.0.1/qubosolver/classical_solver/classical_solver_conversion_tools.py +107 -0
  21. qubo_solver-0.0.1/qubosolver/classical_solver/simulated_annealing.py +26 -0
  22. qubo_solver-0.0.1/qubosolver/classical_solver/tabu_search.py +25 -0
  23. qubo_solver-0.0.1/qubosolver/config.py +345 -0
  24. qubo_solver-0.0.1/qubosolver/data.py +298 -0
  25. qubo_solver-0.0.1/qubosolver/data_utils.py +121 -0
  26. qubo_solver-0.0.1/qubosolver/main.py +15 -0
  27. qubo_solver-0.0.1/qubosolver/pipeline/__init__.py +16 -0
  28. qubo_solver-0.0.1/qubosolver/pipeline/basesolver.py +163 -0
  29. qubo_solver-0.0.1/qubosolver/pipeline/embedder.py +133 -0
  30. qubo_solver-0.0.1/qubosolver/pipeline/fixtures.py +329 -0
  31. qubo_solver-0.0.1/qubosolver/pipeline/pulse.py +472 -0
  32. qubo_solver-0.0.1/qubosolver/pipeline/targets.py +61 -0
  33. qubo_solver-0.0.1/qubosolver/qubo_analyzer.py +696 -0
  34. qubo_solver-0.0.1/qubosolver/qubo_instance.py +195 -0
  35. qubo_solver-0.0.1/qubosolver/qubo_types.py +81 -0
  36. qubo_solver-0.0.1/qubosolver/saveload.py +125 -0
  37. qubo_solver-0.0.1/qubosolver/solver.py +245 -0
  38. qubo_solver-0.0.1/qubosolver/utils/__init__.py +14 -0
  39. qubo_solver-0.0.1/qubosolver/utils/density.py +56 -0
  40. qubo_solver-0.0.1/qubosolver/utils/qubo_eval.py +21 -0
  41. qubo_solver-0.0.1/renovate.json +15 -0
@@ -0,0 +1,52 @@
1
+ name: Bug Report
2
+ description: Report a bug
3
+ labels: ["bug"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Please fill out the sections below to help everyone identify and fix the bug
9
+ - type: textarea
10
+ id: description
11
+ attributes:
12
+ label: Short description
13
+ placeholder: Describe here
14
+ validations:
15
+ required: true
16
+ - type: textarea
17
+ id: expected
18
+ attributes:
19
+ label: What is the expected result?
20
+ placeholder: Describe here
21
+ - type: textarea
22
+ id: actual
23
+ attributes:
24
+ label: What is the actual result?
25
+ placeholder: Describe here
26
+ - type: textarea
27
+ id: code_bug
28
+ attributes:
29
+ label: Steps/Code to reproduce
30
+ placeholder: |
31
+ from qubosolver import *
32
+ validations:
33
+ required: true
34
+ - type: textarea
35
+ id: texterror
36
+ attributes:
37
+ label: Tracebacks (optional)
38
+ - type: textarea
39
+ id: textenv
40
+ attributes:
41
+ label: Environment details (optional)
42
+ placeholder: Pulser version, Qoolqit version
43
+ - type: dropdown
44
+ id: assign
45
+ attributes:
46
+ label: "Would you like to work on this issue?"
47
+ options:
48
+ - "Yes"
49
+ - type: markdown
50
+ attributes:
51
+ value: |
52
+ Thanks for reporting this issue! We will get back to you as soon as possible.
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Contribution guidelines
4
+ url: https://pasqal-io.github.io/qubo-solver/latest/CONTRIBUTING/
5
+ about: How to contribute
@@ -0,0 +1,36 @@
1
+ name: New feature
2
+ description: Suggest or request a new feature
3
+ labels: ["feature"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Please fill out the sections below to properly describe the new feature you are suggesting.
9
+ - type: textarea
10
+ id: description
11
+ attributes:
12
+ label: Describe the feature
13
+ placeholder: I want ...
14
+ validations:
15
+ required: true
16
+ - type: textarea
17
+ id: rationale
18
+ attributes:
19
+ label: It should be implemented because
20
+ placeholder: It will allow ...
21
+ - type: textarea
22
+ id: context
23
+ attributes:
24
+ label: Additional context
25
+ placeholder: |
26
+ Add any other context or screenshots about the feature request here.
27
+ - type: dropdown
28
+ id: assign
29
+ attributes:
30
+ label: "Would you like to work on this issue?"
31
+ options:
32
+ - "Yes"
33
+ - type: markdown
34
+ attributes:
35
+ value: |
36
+ Thanks for your suggestion! Let's see together if it can be implemented.
@@ -0,0 +1,30 @@
1
+ name: Linting
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request: {}
8
+ workflow_dispatch: {}
9
+
10
+ jobs:
11
+ lint:
12
+ name: Linting
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ python-version: ["3.10"]
17
+ steps:
18
+ - name: Checkout main code
19
+ uses: actions/checkout@v4
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+ - name: Install pre-commit
25
+ run: |
26
+ pip install pre-commit
27
+ pre-commit install
28
+ - name: Check files and lint
29
+ run: |
30
+ pre-commit run --all-files
@@ -0,0 +1,79 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types:
6
+ [published]
7
+
8
+ concurrency:
9
+ group: fast-${{ github.head_ref || github.run_id }}
10
+ cancel-in-progress: true
11
+
12
+ jobs:
13
+ publish_pypi:
14
+ name: Publish package to PyPI
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ # IMPORTANT: this permission is mandatory for trusted publishing
18
+ id-token: write
19
+ steps:
20
+ - name: Check out mis
21
+ uses: actions/checkout@v5
22
+ with:
23
+ ref: ${{ github.ref }}
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.11"
28
+ - name: Install Python dependencies
29
+ run: |
30
+ python -m pip install --upgrade pip
31
+ pip install hatch
32
+ - name: Build and publish package
33
+ run: |
34
+ hatch build
35
+ - name: Publish to PyPI
36
+ uses: pypa/gh-action-pypi-publish@release/v1
37
+ - name: Confirm deployment
38
+ timeout-minutes: 5
39
+ run: |
40
+ VERSION=${GITHUB_REF#refs/tags/v}
41
+ until pip download maximum-independent-set==$VERSION
42
+ do
43
+ echo "Failed to download from PyPI, will wait for upload and retry."
44
+ sleep 1
45
+ done
46
+
47
+ public_docs:
48
+ name: Publish docs to github pages
49
+ runs-on: ubuntu-latest
50
+ steps:
51
+ - name: Checkout mis
52
+ uses: actions/checkout@v5
53
+ - name: Install JetBrains Mono font
54
+ run: |
55
+ sudo apt install -y wget unzip fontconfig
56
+ wget https://download.jetbrains.com/fonts/JetBrainsMono-2.304.zip
57
+ unzip JetBrainsMono-2.304.zip -d JetBrainsMono
58
+ mkdir -p /usr/share/fonts/truetype/jetbrains
59
+ cp JetBrainsMono/fonts/ttf/*.ttf /usr/share/fonts/truetype/jetbrains/
60
+ fc-cache -f -v
61
+ - name: Install graphviz
62
+ run: sudo apt-get install -y graphviz
63
+ - name: Set up Python 3.11
64
+ uses: actions/setup-python@v5
65
+ with:
66
+ python-version: '3.11'
67
+ - name: Install Hatch
68
+ run: |
69
+ pip install hatch
70
+ - name: Copy notebooks and test files to build docs
71
+ run: |
72
+ cp examples/*.ipynb docs/
73
+ cp -r examples/datasets/ docs/
74
+ - name: Deploy docs
75
+ run: |
76
+ git config user.name "GitHub Actions"
77
+ git config user.email "actions@github.com"
78
+ git fetch origin gh-pages
79
+ hatch -v run docs:mike deploy --push --update-aliases ${{ github.ref_name }} latest
@@ -0,0 +1,88 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - 'v[0-9]+.[0-9]+.[0-9]+'
9
+ pull_request:
10
+ branches:
11
+ - main
12
+ workflow_dispatch: {}
13
+
14
+ concurrency:
15
+ group: ${{ github.head_ref || github.run_id }}
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ unit_tests:
20
+ name: Unit testing
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ matrix:
24
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
25
+ steps:
26
+ - name: Checkout main code and submodules
27
+ uses: actions/checkout@v4
28
+ - name: Set up Python ${{ matrix.python-version }}
29
+ uses: actions/setup-python@v5
30
+ with:
31
+ python-version: ${{ matrix.python-version }}
32
+ - name: Install hatch
33
+ run: |
34
+ pip install --upgrade pip
35
+ pip install hatch
36
+ - name: Perform unit tests
37
+ run: |
38
+ hatch -v run test
39
+ - name: Upload coverage reports to Codecov
40
+ uses: codecov/codecov-action@v5
41
+ with:
42
+ token: ${{ secrets.CODECOV_TOKEN }}
43
+ slug: pasqal-io/qubo-solver
44
+
45
+ test_notebook:
46
+ name: Run the Jupyter notebook tutorial (Unix)
47
+ strategy:
48
+ matrix:
49
+ os: [ubuntu-latest, macos-latest]
50
+ python-version: ["3.11"]
51
+ runs-on: ${{ matrix.os }}
52
+ steps:
53
+ - name: Checkout mis
54
+ uses: actions/checkout@v5
55
+ - name: Set up Python ${{ matrix.python-version }}
56
+ uses: actions/setup-python@v5
57
+ with:
58
+ python-version: ${{ matrix.python-version }}
59
+ - name: Install Hatch
60
+ run: |
61
+ pip install hatch
62
+ - name: Run notebooks
63
+ run: |
64
+ hatch -v run test-notebooks
65
+
66
+ test_docs:
67
+ name: Documentation
68
+ runs-on: ubuntu-latest
69
+ strategy:
70
+ matrix:
71
+ python-version: ["3.11"]
72
+ steps:
73
+ - name: Checkout main code and submodules
74
+ uses: actions/checkout@v4
75
+ - name: Set up Python ${{ matrix.python-version }}
76
+ uses: actions/setup-python@v5
77
+ with:
78
+ python-version: ${{ matrix.python-version }}
79
+ - name: Install hatch
80
+ run: |
81
+ pip install --upgrade pip
82
+ pip install hatch
83
+ - name: Install main dependencies
84
+ run: |
85
+ hatch -v -e docs
86
+ - name: Test docs
87
+ run: |
88
+ hatch run docs:build
@@ -0,0 +1,211 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ /__pycache__/
4
+ *.py[codz]
5
+ *$py.class
6
+
7
+ # custom
8
+ qubosolver_logs
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py.cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ cover/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ .pybuilder/
80
+ target/
81
+
82
+ # Jupyter Notebook
83
+ .ipynb_checkpoints
84
+
85
+ # IPython
86
+ profile_default/
87
+ ipython_config.py
88
+
89
+ # pyenv
90
+ # For a library or package, you might want to ignore these files since the code is
91
+ # intended to run in multiple environments; otherwise, check them in:
92
+ # .python-version
93
+
94
+ # pipenv
95
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
97
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
98
+ # install all needed dependencies.
99
+ #Pipfile.lock
100
+
101
+ # UV
102
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
103
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
104
+ # commonly ignored for libraries.
105
+ #uv.lock
106
+
107
+ # poetry
108
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
109
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
110
+ # commonly ignored for libraries.
111
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
112
+ #poetry.lock
113
+ #poetry.toml
114
+
115
+ # pdm
116
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
117
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
118
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
119
+ #pdm.lock
120
+ #pdm.toml
121
+ .pdm-python
122
+ .pdm-build/
123
+
124
+ # pixi
125
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
126
+ #pixi.lock
127
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
128
+ # in the .venv directory. It is recommended not to include this directory in version control.
129
+ .pixi
130
+
131
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
132
+ __pypackages__/
133
+
134
+ # Celery stuff
135
+ celerybeat-schedule
136
+ celerybeat.pid
137
+
138
+ # SageMath parsed files
139
+ *.sage.py
140
+
141
+ # Environments
142
+ .env
143
+ .envrc
144
+ .venv
145
+ env/
146
+ venv/
147
+ ENV/
148
+ env.bak/
149
+ venv.bak/
150
+
151
+ # Spyder project settings
152
+ .spyderproject
153
+ .spyproject
154
+
155
+ # Rope project settings
156
+ .ropeproject
157
+
158
+ # mkdocs documentation
159
+ /site
160
+
161
+ # mypy
162
+ .mypy_cache/
163
+ .dmypy.json
164
+ dmypy.json
165
+
166
+ # Pyre type checker
167
+ .pyre/
168
+
169
+ # pytype static type analyzer
170
+ .pytype/
171
+
172
+ # Cython debug symbols
173
+ cython_debug/
174
+
175
+ # PyCharm
176
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
177
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
178
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
179
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
180
+ #.idea/
181
+
182
+ # Abstra
183
+ # Abstra is an AI-powered process automation framework.
184
+ # Ignore directories containing user credentials, local state, and settings.
185
+ # Learn more at https://abstra.io/docs
186
+ .abstra/
187
+
188
+ # Visual Studio Code
189
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
190
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
191
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
192
+ # you could uncomment the following to ignore the entire vscode folder
193
+ .vscode/
194
+
195
+ # Ruff stuff:
196
+ .ruff_cache/
197
+
198
+ # PyPI configuration file
199
+ .pypirc
200
+
201
+ # Cursor
202
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
203
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
204
+ # refer to https://docs.cursor.com/context/ignore-files
205
+ .cursorignore
206
+ .cursorindexingignore
207
+
208
+ # Marimo
209
+ marimo/_static/
210
+ marimo/_lsp/
211
+ __marimo__/
@@ -0,0 +1,34 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.6.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+
10
+ - repo: https://github.com/ambv/black
11
+ rev: 24.8.0
12
+ hooks:
13
+ - id: black
14
+
15
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
16
+ rev: "v0.5.6"
17
+ hooks:
18
+ - id: ruff
19
+ args: [--fix]
20
+
21
+ - repo: https://github.com/pre-commit/mirrors-mypy
22
+ rev: v1.11.1
23
+ hooks:
24
+ - id: mypy
25
+ exclude: examples|docs
26
+
27
+ # Cleanup jupyter notebooks
28
+ - repo: https://github.com/srstevenson/nb-clean
29
+ rev: 4.0.1
30
+ hooks:
31
+ - id: nb-clean
32
+ args:
33
+ - --remove-empty-cells
34
+ - --preserve-cell-outputs
@@ -0,0 +1,13 @@
1
+ PASQAL OPEN-SOURCE SOFTWARE LICENSE AGREEMENT (MIT-derived)
2
+
3
+ The author of the License is:
4
+ Pasqal, a Société par Actions Simplifiée (Simplified Joint Stock Company) registered under number 849 441 522 at the Registre du commerce et des sociétés (Trade and Companies Register) of Evry – France, headquartered at 24 rue Émile Baudot – 91120 – Palaiseau – France, duly represented by its Président, M. Georges-Olivier REYMOND, Hereafter referred to as « the Licensor »
5
+
6
+ - Permission is hereby granted, free of charge, to any person obtaining a copy of this software (the “Licensee”) and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software is “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise arising from, out of or in connection with the Software or the use or other dealings in the Software.
8
+
9
+ - If use of the Software leads to the necessary use of any patent of the Licensor and/or any of its Affiliates (defined as a company owned or controlled by the Licensor), the Licensee is granted a royalty-free license, in any country where such patent is in force, to use the object of such patent; or use the process covered by such patent,
10
+
11
+ - Such a patent license is granted for internal research or academic use of the Licensee's, which includes use by employees and students of the Licensee, acting on behalf of the Licensee, for research purposes only.
12
+
13
+ - The License is governed by the laws of France. Any dispute relating to the License, notably its execution, performance and/or termination shall be brought to, heard and tried by the Tribunal Judiciaire de Paris, regardless of the rules of jurisdiction in the matter.