PyQrackIsing 3.4.2__tar.gz → 3.4.3__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-3.4.2/pyqrackising.egg-info → pyqrackising-3.4.3}/PKG-INFO +1 -1
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyproject.toml +1 -1
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising/tsp.py +16 -23
- {pyqrackising-3.4.2 → pyqrackising-3.4.3/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/setup.py +1 -1
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/CMakeLists.txt +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/LICENSE.md +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/MANIFEST.in +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/README.md +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising/__init__.py +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising/_pyqrack_ising.cpp +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-3.4.2 → pyqrackising-3.4.3}/setup.cfg +0 -0
|
@@ -11,7 +11,7 @@ build-backend = "setuptools.build_meta"
|
|
|
11
11
|
|
|
12
12
|
[project]
|
|
13
13
|
name = "pyqrackising"
|
|
14
|
-
version = "3.4.
|
|
14
|
+
version = "3.4.3"
|
|
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"}
|
|
@@ -207,7 +207,7 @@ def init_G_a_b(G_m, a, b):
|
|
|
207
207
|
|
|
208
208
|
|
|
209
209
|
@njit
|
|
210
|
-
def stitch(G_m, path_a, path_b,
|
|
210
|
+
def stitch(G_m, path_a, path_b, is_asym):
|
|
211
211
|
is_single_a = len(path_a) == 1
|
|
212
212
|
is_single_b = len(path_b) == 1
|
|
213
213
|
best_path = [0]
|
|
@@ -245,25 +245,32 @@ def stitch(G_m, path_a, path_b, sol_weight):
|
|
|
245
245
|
terminals_a = [path_a[0], path_a[-1]]
|
|
246
246
|
terminals_b = [path_b[0], path_b[-1]]
|
|
247
247
|
|
|
248
|
-
|
|
248
|
+
best_connect = G_m[terminals_a[1], terminals_b[0]]
|
|
249
249
|
best_path = path_b.copy()
|
|
250
250
|
weight = G_m[terminals_a[0], terminals_b[1]]
|
|
251
|
-
if weight <
|
|
252
|
-
|
|
251
|
+
if weight < best_connect:
|
|
252
|
+
best_connect = weight
|
|
253
253
|
best_path += path_a
|
|
254
254
|
else:
|
|
255
255
|
best_path = path_a + best_path
|
|
256
256
|
|
|
257
|
+
if not is_asym:
|
|
258
|
+
path_weight = path_length(path_a, G_m) + path_length(path_a, G_m)
|
|
259
|
+
best_weight = best_connect + path_weight
|
|
260
|
+
|
|
257
261
|
for _ in range(2):
|
|
258
262
|
for _ in range(2):
|
|
263
|
+
if is_asym:
|
|
264
|
+
path_weight = path_length(path_a, G_m) + path_length(path_a, G_m)
|
|
265
|
+
best_weight = best_connect + path_weight
|
|
259
266
|
for i in range(1, len(path_b)):
|
|
260
267
|
weight = (
|
|
261
268
|
G_m[terminals_a[0], path_b[i - 1]] +
|
|
262
269
|
G_m[terminals_a[1], path_b[i]] -
|
|
263
270
|
G_m[path_b[i - 1], path_b[i]]
|
|
264
271
|
)
|
|
265
|
-
if weight < best_weight:
|
|
266
|
-
best_weight = weight
|
|
272
|
+
if (weight + path_weight) < best_weight:
|
|
273
|
+
best_weight = weight + path_weight
|
|
267
274
|
best_path = path_b.copy()
|
|
268
275
|
best_path[i:i] = path_a
|
|
269
276
|
path_a.reverse()
|
|
@@ -271,7 +278,7 @@ def stitch(G_m, path_a, path_b, sol_weight):
|
|
|
271
278
|
path_a, path_b = path_b, path_a
|
|
272
279
|
terminals_a, terminals_b = terminals_b, terminals_a
|
|
273
280
|
|
|
274
|
-
return best_path
|
|
281
|
+
return best_path
|
|
275
282
|
|
|
276
283
|
|
|
277
284
|
|
|
@@ -375,13 +382,8 @@ def tsp_symmetric(G, start_node=None, end_node=None, quality=2, shots=None, corr
|
|
|
375
382
|
path_a = [a[x] for x in sol_a[0]]
|
|
376
383
|
path_b = [b[x] for x in sol_b[0]]
|
|
377
384
|
|
|
378
|
-
sol_weight = sol_a[1] + sol_b[1]
|
|
379
|
-
|
|
380
|
-
if len(c):
|
|
381
|
-
sol_weight += G_m[b[-1], c[0]]
|
|
382
|
-
|
|
383
385
|
if start_node is None:
|
|
384
|
-
best_path
|
|
386
|
+
best_path = stitch(G_m, path_a, path_b, False)
|
|
385
387
|
else:
|
|
386
388
|
best_path = path_a + path_b
|
|
387
389
|
best_weight = G_m[path_a[0], path_b[0]]
|
|
@@ -390,11 +392,9 @@ def tsp_symmetric(G, start_node=None, end_node=None, quality=2, shots=None, corr
|
|
|
390
392
|
path_b.reverse()
|
|
391
393
|
best_path = path_a + path_b
|
|
392
394
|
best_weight = weight
|
|
393
|
-
best_weight += sol_weight
|
|
394
395
|
|
|
395
396
|
if len(c):
|
|
396
397
|
best_path += c
|
|
397
|
-
best_weight += G_m[best_path[-1], c[0]]
|
|
398
398
|
|
|
399
399
|
if is_top_level:
|
|
400
400
|
if is_cyclic:
|
|
@@ -491,13 +491,8 @@ def tsp_asymmetric(G, start_node=None, end_node=None, quality=1, shots=None, cor
|
|
|
491
491
|
path_a = [a[x] for x in sol_a[0]]
|
|
492
492
|
path_b = [b[x] for x in sol_b[0]]
|
|
493
493
|
|
|
494
|
-
sol_weight = sol_a[1] + sol_b[1]
|
|
495
|
-
|
|
496
|
-
if len(c):
|
|
497
|
-
sol_weight += G_m[b[-1], c[0]]
|
|
498
|
-
|
|
499
494
|
if start_node is None:
|
|
500
|
-
best_path
|
|
495
|
+
best_path = stitch(G_m, path_a, path_b, True)
|
|
501
496
|
else:
|
|
502
497
|
best_path = path_a + path_b
|
|
503
498
|
best_weight = G_m[path_a[0], path_b[0]]
|
|
@@ -506,11 +501,9 @@ def tsp_asymmetric(G, start_node=None, end_node=None, quality=1, shots=None, cor
|
|
|
506
501
|
path_b.reverse()
|
|
507
502
|
best_path = path_a + path_b
|
|
508
503
|
best_weight = weight
|
|
509
|
-
best_weight += sol_weight
|
|
510
504
|
|
|
511
505
|
if len(c):
|
|
512
506
|
best_path += c
|
|
513
|
-
best_weight += G_m[best_path[-1], c[0]]
|
|
514
507
|
|
|
515
508
|
if is_top_level:
|
|
516
509
|
if is_cyclic:
|
|
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
|
|
|
51
51
|
|
|
52
52
|
setup(
|
|
53
53
|
name='pyqrackising',
|
|
54
|
-
version='3.4.
|
|
54
|
+
version='3.4.3',
|
|
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
|
|
File without changes
|