PyQrackIsing 1.21.1__tar.gz → 1.22.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-1.21.1/PyQrackIsing.egg-info → pyqrackising-1.22.0}/PKG-INFO +1 -1
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/PyQrackIsing/tsp_symmetric.py +6 -14
- {pyqrackising-1.21.1 → pyqrackising-1.22.0/PyQrackIsing.egg-info}/PKG-INFO +1 -1
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/README.md +1 -1
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/pyproject.toml +1 -1
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/setup.py +1 -1
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/CMakeLists.txt +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/LICENSE.md +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/MANIFEST.in +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/PyQrackIsing/__init__.py +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/PyQrackIsing/_pyqrack_ising.cpp +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/PyQrackIsing/generate_tfim_samples.py +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/PyQrackIsing/maxcut_tfim.py +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/PyQrackIsing/spin_glass_solver.py +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/PyQrackIsing/tfim_magnetization.py +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/PyQrackIsing/tfim_square_magnetization.py +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/PyQrackIsing.egg-info/SOURCES.txt +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/PyQrackIsing.egg-info/dependency_links.txt +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/PyQrackIsing.egg-info/not-zip-safe +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/PyQrackIsing.egg-info/top_level.txt +0 -0
- {pyqrackising-1.21.1 → pyqrackising-1.22.0}/setup.cfg +0 -0
|
@@ -120,9 +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=
|
|
124
|
-
is_cyclic_at_top |= is_cyclic
|
|
125
|
-
|
|
123
|
+
def tsp_symmetric(G, quality=1, shots=None, correction_quality=2, is_3_opt=True, k_neighbors=20, is_cyclic=True, multi_start=1):
|
|
126
124
|
nodes = None
|
|
127
125
|
n_nodes = 0
|
|
128
126
|
G_m = None
|
|
@@ -176,8 +174,8 @@ def tsp_symmetric(G, quality=0, shots=None, correction_quality=2, is_3_opt=True,
|
|
|
176
174
|
continue
|
|
177
175
|
G_b[i, j] = G_m[b[i], b[j]]
|
|
178
176
|
|
|
179
|
-
sol_a = tsp_symmetric(G_a, quality=quality, correction_quality=correction_quality, is_cyclic=False,
|
|
180
|
-
sol_b = tsp_symmetric(G_b, quality=quality, correction_quality=correction_quality, is_cyclic=False,
|
|
177
|
+
sol_a = tsp_symmetric(G_a, quality=quality, correction_quality=correction_quality, is_cyclic=False, is_3_opt=False, multi_start=multi_start)
|
|
178
|
+
sol_b = tsp_symmetric(G_b, quality=quality, correction_quality=correction_quality, is_cyclic=False, is_3_opt=False, multi_start=multi_start)
|
|
181
179
|
|
|
182
180
|
path_a = [a[x] for x in sol_a[0]]
|
|
183
181
|
path_b = [b[x] for x in sol_b[0]]
|
|
@@ -244,23 +242,17 @@ def tsp_symmetric(G, quality=0, shots=None, correction_quality=2, is_3_opt=True,
|
|
|
244
242
|
path_a, path_b = path_b, path_a
|
|
245
243
|
terminals_a, terminals_b = terminals_b, terminals_a
|
|
246
244
|
|
|
247
|
-
cycle_node =
|
|
248
|
-
|
|
249
|
-
cycle_node = best_path[0]
|
|
250
|
-
best_path += [cycle_node]
|
|
245
|
+
cycle_node = best_path[0]
|
|
246
|
+
best_path += [cycle_node]
|
|
251
247
|
|
|
252
248
|
best_path, best_weight = two_opt(best_path, G_m)
|
|
253
249
|
|
|
254
250
|
if is_3_opt:
|
|
255
251
|
best_path, best_weight = targeted_three_opt(best_path, G_m, k_neighbors)
|
|
256
252
|
|
|
257
|
-
if
|
|
253
|
+
if not is_cyclic:
|
|
258
254
|
cycle_index = best_path.index(cycle_node)
|
|
259
255
|
best_weight -= G_m[best_path[cycle_index], best_path[cycle_index + 1]]
|
|
260
256
|
best_path = best_path[cycle_index + 1:] + best_path[:cycle_index]
|
|
261
257
|
|
|
262
|
-
if is_cyclic:
|
|
263
|
-
best_weight += G_m[best_path[-1], best_path[0]]
|
|
264
|
-
best_path += [best_path[0]]
|
|
265
|
-
|
|
266
258
|
return [nodes[x] for x in best_path], best_weight
|
|
@@ -93,7 +93,7 @@ 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=
|
|
96
|
+
circuit, path_length = tsp_symmetric(G, quality=1, 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}")
|
|
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
|
|
|
12
12
|
|
|
13
13
|
[project]
|
|
14
14
|
name = "PyQrackIsing"
|
|
15
|
-
version = "1.
|
|
15
|
+
version = "1.22.0"
|
|
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.22.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
|