PyQrackIsing 2.0.3__tar.gz → 3.0.0__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.
- {pyqrackising-2.0.3/pyqrackising.egg-info → pyqrackising-3.0.0}/PKG-INFO +1 -1
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/README.md +2 -3
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyproject.toml +1 -1
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising/tsp_symmetric.py +8 -8
- {pyqrackising-2.0.3 → pyqrackising-3.0.0/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/setup.py +1 -1
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/CMakeLists.txt +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/LICENSE.md +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/MANIFEST.in +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising/__init__.py +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising/_pyqrack_ising.cpp +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-2.0.3 → pyqrackising-3.0.0}/setup.cfg +0 -0
|
@@ -101,12 +101,11 @@ circuit, path_length = tsp_symmetric(
|
|
|
101
101
|
G,
|
|
102
102
|
start_node=None,
|
|
103
103
|
end_node=None,
|
|
104
|
-
|
|
104
|
+
monte_carlo=False,
|
|
105
105
|
quality=1,
|
|
106
106
|
correction_quality=2,
|
|
107
107
|
is_cyclic=True,
|
|
108
108
|
multi_start=1,
|
|
109
|
-
is_3_opt=True,
|
|
110
109
|
k_neighbors=20
|
|
111
110
|
)
|
|
112
111
|
|
|
@@ -114,7 +113,7 @@ print(f"Node count: {n_nodes}")
|
|
|
114
113
|
print(f"Path: {circuit}")
|
|
115
114
|
print(f"Path length: {path_length}")
|
|
116
115
|
```
|
|
117
|
-
We only provide a solver for the symmetric version of the TSP (i.e., the distance from "A" to "B" is considered the same as from "B" to "A"). `
|
|
116
|
+
We only provide a solver for the symmetric version of the TSP (i.e., the distance from "A" to "B" is considered the same as from "B" to "A"). `monte_carlo=True` switches out the MAXCUT-based heuristic for pure Monte Carlo recursive bipartitioning. `multi_start` controls how many stochastic repeats of MAXCUT are tried to select the best result, at every level of recursion.
|
|
118
117
|
|
|
119
118
|
## About
|
|
120
119
|
Transverse field Ising model (TFIM) is the basis of most claimed algorithmic "quantum advantage," circa 2025, with the notable exception of Shor's integer factoring algorithm.
|
|
@@ -11,7 +11,7 @@ build-backend = "setuptools.build_meta"
|
|
|
11
11
|
|
|
12
12
|
[project]
|
|
13
13
|
name = "pyqrackising"
|
|
14
|
-
version = "
|
|
14
|
+
version = "3.0.0"
|
|
15
15
|
requires-python = ">=3.8"
|
|
16
16
|
description = "Near-ideal closed-form solutions for transverse field Ising model (TFIM)"
|
|
17
17
|
readme = {file = "README.txt", content-type = "text/markdown"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from .spin_glass_solver import spin_glass_solver
|
|
2
2
|
import networkx as nx
|
|
3
|
-
from numba import njit
|
|
3
|
+
from numba import njit
|
|
4
4
|
import numpy as np
|
|
5
5
|
|
|
6
6
|
|
|
@@ -164,18 +164,18 @@ def targeted_three_opt(path, W, k_neighbors=20):
|
|
|
164
164
|
return best_path, best_dist
|
|
165
165
|
|
|
166
166
|
|
|
167
|
-
@njit
|
|
167
|
+
@njit
|
|
168
168
|
def init_G_a_b(G_m, a, b):
|
|
169
169
|
n_a_nodes = len(a)
|
|
170
170
|
n_b_nodes = len(b)
|
|
171
171
|
G_a = np.zeros((n_a_nodes, n_a_nodes), dtype=np.float64)
|
|
172
172
|
G_b = np.zeros((n_b_nodes, n_b_nodes), dtype=np.float64)
|
|
173
|
-
for i in
|
|
173
|
+
for i in range(n_a_nodes):
|
|
174
174
|
for j in range(n_a_nodes):
|
|
175
175
|
if i == j:
|
|
176
176
|
continue
|
|
177
177
|
G_a[i, j] = G_m[a[i], a[j]]
|
|
178
|
-
for i in
|
|
178
|
+
for i in range(n_b_nodes):
|
|
179
179
|
for j in range(n_b_nodes):
|
|
180
180
|
if i == j:
|
|
181
181
|
continue
|
|
@@ -259,7 +259,7 @@ def monte_carlo_loop(n_nodes):
|
|
|
259
259
|
return bits
|
|
260
260
|
|
|
261
261
|
|
|
262
|
-
def tsp_symmetric(G, start_node=None, end_node=None, quality=1, shots=None, correction_quality=2, monte_carlo=False,
|
|
262
|
+
def tsp_symmetric(G, start_node=None, end_node=None, quality=1, shots=None, correction_quality=2, monte_carlo=False, k_neighbors=20, is_cyclic=True, multi_start=1, is_top_level=True):
|
|
263
263
|
nodes = None
|
|
264
264
|
n_nodes = 0
|
|
265
265
|
G_m = None
|
|
@@ -312,8 +312,8 @@ def tsp_symmetric(G, start_node=None, end_node=None, quality=1, shots=None, corr
|
|
|
312
312
|
|
|
313
313
|
G_a, G_b = init_G_a_b(G_m, a, b)
|
|
314
314
|
|
|
315
|
-
sol_a = tsp_symmetric(G_a, quality=quality, correction_quality=correction_quality, monte_carlo=monte_carlo, is_cyclic=False, is_top_level=False,
|
|
316
|
-
sol_b = tsp_symmetric(G_b, quality=quality, correction_quality=correction_quality, monte_carlo=monte_carlo, is_cyclic=False, is_top_level=False,
|
|
315
|
+
sol_a = tsp_symmetric(G_a, quality=quality, correction_quality=correction_quality, monte_carlo=monte_carlo, is_cyclic=False, is_top_level=False, k_neighbors=0, multi_start=multi_start)
|
|
316
|
+
sol_b = tsp_symmetric(G_b, quality=quality, correction_quality=correction_quality, monte_carlo=monte_carlo, is_cyclic=False, is_top_level=False, k_neighbors=0, multi_start=multi_start)
|
|
317
317
|
|
|
318
318
|
path_a = [a[x] for x in sol_a[0]]
|
|
319
319
|
path_b = [b[x] for x in sol_b[0]]
|
|
@@ -355,7 +355,7 @@ def tsp_symmetric(G, start_node=None, end_node=None, quality=1, shots=None, corr
|
|
|
355
355
|
else:
|
|
356
356
|
best_path, best_weight = one_way_two_opt(best_path, G_m)
|
|
357
357
|
|
|
358
|
-
if
|
|
358
|
+
if k_neighbors > 0:
|
|
359
359
|
best_path, best_weight = targeted_three_opt(best_path, G_m, k_neighbors)
|
|
360
360
|
else:
|
|
361
361
|
best_path, best_weight = one_way_two_opt(best_path, G_m)
|
|
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
|
|
|
51
51
|
|
|
52
52
|
setup(
|
|
53
53
|
name='pyqrackising',
|
|
54
|
-
version='
|
|
54
|
+
version='3.0.0',
|
|
55
55
|
author='Dan Strano',
|
|
56
56
|
author_email='stranoj@gmail.com',
|
|
57
57
|
description='Near-ideal closed-form solutions for transverse field Ising model (TFIM)',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|