PyQrackIsing 7.4.2__tar.gz → 7.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-7.4.2/pyqrackising.egg-info → pyqrackising-7.4.3}/PKG-INFO +1 -1
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyproject.toml +1 -1
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/tsp.py +28 -21
- {pyqrackising-7.4.2 → pyqrackising-7.4.3/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/setup.py +1 -1
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/CMakeLists.txt +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/LICENSE.md +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/MANIFEST.in +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/README.md +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/__init__.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/_pyqrack_ising.cpp +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/maxcut_tfim_sparse.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/maxcut_tfim_streaming.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/maxcut_tfim_util.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/spin_glass_solver_util.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-7.4.2 → pyqrackising-7.4.3}/setup.cfg +0 -0
|
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
|
|
|
12
12
|
|
|
13
13
|
[project]
|
|
14
14
|
name = "pyqrackising"
|
|
15
|
-
version = "7.4.
|
|
15
|
+
version = "7.4.3"
|
|
16
16
|
requires-python = ">=3.8"
|
|
17
17
|
description = "Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)"
|
|
18
18
|
readme = {file = "README.txt", content-type = "text/markdown"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from .spin_glass_solver import spin_glass_solver
|
|
2
2
|
from .maxcut_tfim_util import binary_search, opencl_context, to_scipy_sparse_upper_triangular
|
|
3
|
-
from concurrent.futures import
|
|
3
|
+
from concurrent.futures import ProcessPoolExecutor
|
|
4
4
|
import time
|
|
5
5
|
import itertools
|
|
6
6
|
import networkx as nx
|
|
@@ -10,6 +10,9 @@ import os
|
|
|
10
10
|
from scipy.sparse import lil_matrix
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
max_parallel_level = np.log2(os.cpu_count())
|
|
14
|
+
|
|
15
|
+
|
|
13
16
|
# two_opt() and targeted_three_opt() written by Elara (OpenAI ChatGPT instance)
|
|
14
17
|
@njit
|
|
15
18
|
def path_length(path, G_m):
|
|
@@ -515,7 +518,8 @@ def tsp_symmetric(
|
|
|
515
518
|
is_cyclic=True,
|
|
516
519
|
multi_start=1,
|
|
517
520
|
is_top_level=True,
|
|
518
|
-
is_parallel=False
|
|
521
|
+
is_parallel=False,
|
|
522
|
+
parallel_level=0
|
|
519
523
|
):
|
|
520
524
|
dtype = opencl_context.dtype
|
|
521
525
|
nodes = None
|
|
@@ -575,10 +579,10 @@ def tsp_symmetric(
|
|
|
575
579
|
|
|
576
580
|
G_a, G_b = init_G_a_b(G_m, a, b)
|
|
577
581
|
|
|
578
|
-
if monte_carlo and is_parallel and (len(a) > 3) and (len(b) > 3):
|
|
579
|
-
with
|
|
580
|
-
f = executor.submit(tsp_symmetric, G_a, None, None, quality, shots, is_alt_gpu_sampling, is_base_maxcut_gpu, is_combo_maxcut_gpu, True, 0, False, multi_start, False, True)
|
|
581
|
-
sol_b = tsp_symmetric(G_b, None, None, quality, shots, is_alt_gpu_sampling, is_base_maxcut_gpu, is_combo_maxcut_gpu, True, 0, False, multi_start, False, True)
|
|
582
|
+
if monte_carlo and is_parallel and (parallel_level < max_parallel_level) and (len(a) > 3) and (len(b) > 3):
|
|
583
|
+
with ProcessPoolExecutor(max_workers=1) as executor:
|
|
584
|
+
f = executor.submit(tsp_symmetric, G_a, None, None, quality, shots, is_alt_gpu_sampling, is_base_maxcut_gpu, is_combo_maxcut_gpu, True, 0, False, multi_start, False, True, parallel_level + 1)
|
|
585
|
+
sol_b = tsp_symmetric(G_b, None, None, quality, shots, is_alt_gpu_sampling, is_base_maxcut_gpu, is_combo_maxcut_gpu, True, 0, False, multi_start, False, True, parallel_level + 1)
|
|
582
586
|
sol_a = f.result()
|
|
583
587
|
else:
|
|
584
588
|
sol_a = tsp_symmetric(
|
|
@@ -723,7 +727,8 @@ def tsp_asymmetric(
|
|
|
723
727
|
is_cyclic=True,
|
|
724
728
|
multi_start=1,
|
|
725
729
|
is_top_level=True,
|
|
726
|
-
is_parallel=False
|
|
730
|
+
is_parallel=False,
|
|
731
|
+
parallel_level=0
|
|
727
732
|
):
|
|
728
733
|
dtype = opencl_context.dtype
|
|
729
734
|
nodes = None
|
|
@@ -787,10 +792,10 @@ def tsp_asymmetric(
|
|
|
787
792
|
|
|
788
793
|
G_a, G_b = init_G_a_b(G_m, a, b)
|
|
789
794
|
|
|
790
|
-
if monte_carlo and is_parallel and (len(a) > 2) and (len(b) > 2):
|
|
791
|
-
with
|
|
792
|
-
f = executor.submit(tsp_asymmetric, G_a, None, None, quality, shots, is_alt_gpu_sampling, is_base_maxcut_gpu, is_combo_maxcut_gpu, True, 0, False, multi_start, False, True)
|
|
793
|
-
sol_b = tsp_asymmetric(G_b, None, None, quality, shots, is_alt_gpu_sampling, is_base_maxcut_gpu, is_combo_maxcut_gpu, True, 0, False, multi_start, False, True)
|
|
795
|
+
if monte_carlo and is_parallel and (parallel_level < max_parallel_level) and (len(a) > 2) and (len(b) > 2):
|
|
796
|
+
with ProcessPoolExecutor(max_workers=1) as executor:
|
|
797
|
+
f = executor.submit(tsp_asymmetric, G_a, None, None, quality, shots, is_alt_gpu_sampling, is_base_maxcut_gpu, is_combo_maxcut_gpu, True, 0, False, multi_start, False, True, parallel_level + 1)
|
|
798
|
+
sol_b = tsp_asymmetric(G_b, None, None, quality, shots, is_alt_gpu_sampling, is_base_maxcut_gpu, is_combo_maxcut_gpu, True, 0, False, multi_start, False, True, parallel_level + 1)
|
|
794
799
|
sol_a = f.result()
|
|
795
800
|
else:
|
|
796
801
|
sol_a = tsp_asymmetric(
|
|
@@ -1136,7 +1141,8 @@ def tsp_symmetric_sparse(
|
|
|
1136
1141
|
G,
|
|
1137
1142
|
k_neighbors=20,
|
|
1138
1143
|
is_top_level=True,
|
|
1139
|
-
is_parallel=True
|
|
1144
|
+
is_parallel=True,
|
|
1145
|
+
parallel_level=0
|
|
1140
1146
|
):
|
|
1141
1147
|
dtype = opencl_context.dtype
|
|
1142
1148
|
nodes = None
|
|
@@ -1163,10 +1169,10 @@ def tsp_symmetric_sparse(
|
|
|
1163
1169
|
|
|
1164
1170
|
G_a, G_b = init_G_a_b_sparse(G_m, a, b, dtype)
|
|
1165
1171
|
|
|
1166
|
-
if is_parallel and (len(a) > 3) and (len(b) > 3):
|
|
1167
|
-
with
|
|
1168
|
-
f = executor.submit(tsp_symmetric_sparse, G_a, False, True)
|
|
1169
|
-
sol_b = tsp_symmetric_sparse(G_b, False, True)
|
|
1172
|
+
if is_parallel and (parallel_level < max_parallel_level) and (len(a) > 3) and (len(b) > 3):
|
|
1173
|
+
with ProcessPoolExecutor(max_workers=1) as executor:
|
|
1174
|
+
f = executor.submit(tsp_symmetric_sparse, G_a, False, True, parallel_level + 1)
|
|
1175
|
+
sol_b = tsp_symmetric_sparse(G_b, False, True, parallel_level + 1)
|
|
1170
1176
|
sol_a = f.result()
|
|
1171
1177
|
else:
|
|
1172
1178
|
sol_a = tsp_symmetric_sparse(
|
|
@@ -1454,7 +1460,8 @@ def tsp_symmetric_streaming(
|
|
|
1454
1460
|
nodes,
|
|
1455
1461
|
k_neighbors=20,
|
|
1456
1462
|
is_top_level=True,
|
|
1457
|
-
is_parallel=True
|
|
1463
|
+
is_parallel=True,
|
|
1464
|
+
parallel_level=0
|
|
1458
1465
|
):
|
|
1459
1466
|
dtype = opencl_context.dtype
|
|
1460
1467
|
n_nodes = len(nodes)
|
|
@@ -1469,10 +1476,10 @@ def tsp_symmetric_streaming(
|
|
|
1469
1476
|
|
|
1470
1477
|
a, b = monte_carlo_loop(n_nodes)
|
|
1471
1478
|
|
|
1472
|
-
if is_parallel and (len(a) > 3) and (len(b) > 3):
|
|
1473
|
-
with
|
|
1474
|
-
f = executor.submit(tsp_symmetric_streaming, G_func, a, False, True)
|
|
1475
|
-
sol_b = tsp_symmetric_streaming(G_func, b, False, True)
|
|
1479
|
+
if is_parallel and (parallel_level < max_parallel_level) and (len(a) > 3) and (len(b) > 3):
|
|
1480
|
+
with ProcessPoolExecutor(max_workers=1) as executor:
|
|
1481
|
+
f = executor.submit(tsp_symmetric_streaming, G_func, a, False, True, parallel_level + 1)
|
|
1482
|
+
sol_b = tsp_symmetric_streaming(G_func, b, False, True, parallel_level + 1)
|
|
1476
1483
|
sol_a = f.result()
|
|
1477
1484
|
else:
|
|
1478
1485
|
sol_a = tsp_symmetric_streaming(
|
|
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
|
|
|
51
51
|
|
|
52
52
|
setup(
|
|
53
53
|
name='pyqrackising',
|
|
54
|
-
version='7.4.
|
|
54
|
+
version='7.4.3',
|
|
55
55
|
author='Dan Strano',
|
|
56
56
|
author_email='stranoj@gmail.com',
|
|
57
57
|
description='Fast MAXCUT, TSP, and sampling heuristics from near-ideal 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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|