PyQrackIsing 1.20.0__tar.gz → 1.21.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.
- {pyqrackising-1.20.0/PyQrackIsing.egg-info → pyqrackising-1.21.1}/PKG-INFO +1 -1
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/PyQrackIsing/tsp_symmetric.py +16 -8
- {pyqrackising-1.20.0 → pyqrackising-1.21.1/PyQrackIsing.egg-info}/PKG-INFO +1 -1
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/README.md +2 -2
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/pyproject.toml +1 -1
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/setup.py +1 -1
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/CMakeLists.txt +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/LICENSE.md +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/MANIFEST.in +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/PyQrackIsing/__init__.py +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/PyQrackIsing/_pyqrack_ising.cpp +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/PyQrackIsing/generate_tfim_samples.py +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/PyQrackIsing/maxcut_tfim.py +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/PyQrackIsing/spin_glass_solver.py +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/PyQrackIsing/tfim_magnetization.py +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/PyQrackIsing/tfim_square_magnetization.py +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/PyQrackIsing.egg-info/SOURCES.txt +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/PyQrackIsing.egg-info/dependency_links.txt +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/PyQrackIsing.egg-info/not-zip-safe +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/PyQrackIsing.egg-info/top_level.txt +0 -0
- {pyqrackising-1.20.0 → pyqrackising-1.21.1}/setup.cfg +0 -0
|
@@ -120,7 +120,7 @@ def targeted_three_opt(path, W, k_neighbors=20):
|
|
|
120
120
|
|
|
121
121
|
return best_path, best_dist
|
|
122
122
|
|
|
123
|
-
def tsp_symmetric(G, quality=0, shots=None, correction_quality=2, is_3_opt=True, k_neighbors=20, is_cyclic=True, is_cyclic_at_top=False):
|
|
123
|
+
def tsp_symmetric(G, quality=0, shots=None, correction_quality=2, is_3_opt=True, k_neighbors=20, is_cyclic=True, is_cyclic_at_top=False, multi_start=1):
|
|
124
124
|
is_cyclic_at_top |= is_cyclic
|
|
125
125
|
|
|
126
126
|
nodes = None
|
|
@@ -147,11 +147,19 @@ def tsp_symmetric(G, quality=0, shots=None, correction_quality=2, is_3_opt=True,
|
|
|
147
147
|
|
|
148
148
|
a = []
|
|
149
149
|
b = []
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
best_energy = float("inf")
|
|
151
|
+
for _ in range(multi_start):
|
|
152
|
+
energy = 0.0
|
|
153
|
+
_a = []
|
|
154
|
+
_b = []
|
|
155
|
+
while (len(_a) == 0) or (len(_b) == 0):
|
|
156
|
+
bits = ''
|
|
157
|
+
_, _, bits, energy = spin_glass_solver(G_m, quality=quality, shots=shots, correction_quality=correction_quality)
|
|
158
|
+
_a = list(bits[0])
|
|
159
|
+
_b = list(bits[1])
|
|
160
|
+
if energy < best_energy:
|
|
161
|
+
best_energy = energy
|
|
162
|
+
a, b = _a, _b
|
|
155
163
|
|
|
156
164
|
n_a_nodes = len(a)
|
|
157
165
|
n_b_nodes = len(b)
|
|
@@ -168,8 +176,8 @@ def tsp_symmetric(G, quality=0, shots=None, correction_quality=2, is_3_opt=True,
|
|
|
168
176
|
continue
|
|
169
177
|
G_b[i, j] = G_m[b[i], b[j]]
|
|
170
178
|
|
|
171
|
-
sol_a = tsp_symmetric(G_a, quality=quality, is_cyclic=False, is_cyclic_at_top=is_cyclic_at_top, is_3_opt=False)
|
|
172
|
-
sol_b = tsp_symmetric(G_b, quality=quality, is_cyclic=False, is_cyclic_at_top=is_cyclic_at_top, is_3_opt=False)
|
|
179
|
+
sol_a = tsp_symmetric(G_a, quality=quality, correction_quality=correction_quality, is_cyclic=False, is_cyclic_at_top=is_cyclic_at_top, is_3_opt=False, multi_start=multi_start)
|
|
180
|
+
sol_b = tsp_symmetric(G_b, quality=quality, correction_quality=correction_quality, is_cyclic=False, is_cyclic_at_top=is_cyclic_at_top, is_3_opt=False, multi_start=multi_start)
|
|
173
181
|
|
|
174
182
|
path_a = [a[x] for x in sol_a[0]]
|
|
175
183
|
path_b = [b[x] for x in sol_b[0]]
|
|
@@ -93,13 +93,13 @@ def generate_tsp_graph(n_nodes=64, seed=None):
|
|
|
93
93
|
|
|
94
94
|
n_nodes = 128
|
|
95
95
|
G = generate_tsp_graph(n_nodes=n_nodes, seed=42)
|
|
96
|
-
circuit, path_length = tsp_symmetric(G, quality=0, correction_quality=2, is_3_opt=True, k_neighbors=20)
|
|
96
|
+
circuit, path_length = tsp_symmetric(G, quality=0, correction_quality=2, is_cyclic=True, multi_start=1, is_3_opt=True, k_neighbors=20)
|
|
97
97
|
|
|
98
98
|
print(f"Node count: {n_nodes}")
|
|
99
99
|
print(f"Path: {circuit}")
|
|
100
100
|
print(f"Path length: {path_length}")
|
|
101
101
|
```
|
|
102
|
-
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").
|
|
102
|
+
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"). `multi_start` controls how many stochastic repeats of MAXCUT are tried to select the best result, at every level of recursion.
|
|
103
103
|
|
|
104
104
|
## About
|
|
105
105
|
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.
|
|
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
|
|
|
12
12
|
|
|
13
13
|
[project]
|
|
14
14
|
name = "PyQrackIsing"
|
|
15
|
-
version = "1.
|
|
15
|
+
version = "1.21.1"
|
|
16
16
|
requires-python = ">=3.8"
|
|
17
17
|
description = "Near-ideal closed-form solutions for transverse field Ising model (TFIM)"
|
|
18
18
|
readme = {file = "README.txt", content-type = "text/markdown"}
|
|
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
|
|
|
51
51
|
|
|
52
52
|
setup(
|
|
53
53
|
name='PyQrackIsing',
|
|
54
|
-
version='1.
|
|
54
|
+
version='1.21.1',
|
|
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
|