PyQrackIsing 8.9.1__tar.gz → 8.9.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-8.9.1/pyqrackising.egg-info → pyqrackising-8.9.3}/PKG-INFO +1 -1
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyproject.toml +1 -1
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/maxcut_tfim.py +6 -64
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/maxcut_tfim_sparse.py +6 -65
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/maxcut_tfim_streaming.py +6 -65
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/maxcut_tfim_util.py +60 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/tsp.py +4 -4
- {pyqrackising-8.9.1 → pyqrackising-8.9.3/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/setup.py +1 -1
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/CMakeLists.txt +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/LICENSE.md +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/MANIFEST.in +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/README.md +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/__init__.py +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/_pyqrack_ising.cpp +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/spin_glass_solver_util.py +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.3}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-8.9.1 → pyqrackising-8.9.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 = "8.9.
|
|
15
|
+
version = "8.9.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"}
|
|
@@ -4,7 +4,7 @@ import numpy as np
|
|
|
4
4
|
import os
|
|
5
5
|
from numba import njit, prange
|
|
6
6
|
|
|
7
|
-
from .maxcut_tfim_util import get_cut, maxcut_hamming_cdf, opencl_context
|
|
7
|
+
from .maxcut_tfim_util import get_cut, maxcut_hamming_cdf, opencl_context, sample_mag, bit_pick, init_bit_pick
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
epsilon = opencl_context.epsilon
|
|
@@ -38,14 +38,7 @@ def local_repulsion_choice(G_m, max_edge, weights, tot_init_weight, repulsion_ba
|
|
|
38
38
|
used = np.zeros(n, dtype=np.bool_) # False = available, True = used
|
|
39
39
|
|
|
40
40
|
# First bit:
|
|
41
|
-
|
|
42
|
-
cum = 0.0
|
|
43
|
-
node = 0
|
|
44
|
-
for i in range(n):
|
|
45
|
-
cum += weights[i]
|
|
46
|
-
if (tot_init_weight * r) < cum:
|
|
47
|
-
node = i
|
|
48
|
-
break
|
|
41
|
+
node = init_bit_pick(weights, tot_init_weight, n)
|
|
49
42
|
|
|
50
43
|
if m == 1:
|
|
51
44
|
used[node] = True
|
|
@@ -54,56 +47,13 @@ def local_repulsion_choice(G_m, max_edge, weights, tot_init_weight, repulsion_ba
|
|
|
54
47
|
update_repulsion_choice(G_m, max_edge, weights, n, used, node, repulsion_base)
|
|
55
48
|
|
|
56
49
|
for _ in range(1, m - 1):
|
|
57
|
-
|
|
58
|
-
total_w = 0.0
|
|
59
|
-
for i in range(n):
|
|
60
|
-
if used[i]:
|
|
61
|
-
continue
|
|
62
|
-
total_w += weights[i]
|
|
63
|
-
|
|
64
|
-
# Normalize & sample
|
|
65
|
-
r = np.random.rand()
|
|
66
|
-
cum = 0.0
|
|
67
|
-
node = -1
|
|
68
|
-
for i in range(n):
|
|
69
|
-
if used[i]:
|
|
70
|
-
continue
|
|
71
|
-
cum += weights[i]
|
|
72
|
-
if (total_w * r) < cum:
|
|
73
|
-
node = i
|
|
74
|
-
break
|
|
75
|
-
|
|
76
|
-
if node == -1:
|
|
77
|
-
node = 0
|
|
78
|
-
while used[node]:
|
|
79
|
-
node += 1
|
|
50
|
+
node = bit_pick(weights, used, n)
|
|
80
51
|
|
|
81
52
|
# Update answer and weights
|
|
82
53
|
update_repulsion_choice(G_m, max_edge, weights, n, used, node, repulsion_base)
|
|
83
54
|
|
|
84
55
|
# Count available
|
|
85
|
-
|
|
86
|
-
for i in range(n):
|
|
87
|
-
if used[i]:
|
|
88
|
-
continue
|
|
89
|
-
total_w += weights[i]
|
|
90
|
-
|
|
91
|
-
# Normalize & sample
|
|
92
|
-
r = np.random.rand()
|
|
93
|
-
cum = 0.0
|
|
94
|
-
node = -1
|
|
95
|
-
for i in range(n):
|
|
96
|
-
if used[i]:
|
|
97
|
-
continue
|
|
98
|
-
cum += weights[i]
|
|
99
|
-
if (total_w * r) < cum:
|
|
100
|
-
node = i
|
|
101
|
-
break
|
|
102
|
-
|
|
103
|
-
if node == -1:
|
|
104
|
-
node = 0
|
|
105
|
-
while used[node]:
|
|
106
|
-
node += 1
|
|
56
|
+
node = bit_pick(weights, used, n)
|
|
107
57
|
|
|
108
58
|
used[node] = True
|
|
109
59
|
|
|
@@ -149,11 +99,7 @@ def sample_for_energy(G_m, max_edge, shots, thresholds, weights, repulsion_base)
|
|
|
149
99
|
improved = False
|
|
150
100
|
for s in prange(shots):
|
|
151
101
|
# First dimension: Hamming weight
|
|
152
|
-
|
|
153
|
-
m = 0
|
|
154
|
-
while thresholds[m] < mag_prob:
|
|
155
|
-
m += 1
|
|
156
|
-
m += 1
|
|
102
|
+
m = sample_mag(thresholds)
|
|
157
103
|
|
|
158
104
|
# Second dimension: permutation within Hamming weight
|
|
159
105
|
sample = local_repulsion_choice(G_m, max_edge, weights, tot_init_weight, repulsion_base, n, m)
|
|
@@ -187,11 +133,7 @@ def sample_for_cut(G_m, max_edge, shots, thresholds, weights, repulsion_base):
|
|
|
187
133
|
improved = False
|
|
188
134
|
for s in prange(shots):
|
|
189
135
|
# First dimension: Hamming weight
|
|
190
|
-
|
|
191
|
-
m = 0
|
|
192
|
-
while thresholds[m] < mag_prob:
|
|
193
|
-
m += 1
|
|
194
|
-
m += 1
|
|
136
|
+
m = sample_mag(thresholds)
|
|
195
137
|
|
|
196
138
|
# Second dimension: permutation within Hamming weight
|
|
197
139
|
sample = local_repulsion_choice(G_m, max_edge, weights, tot_init_weight, repulsion_base, n, m)
|
|
@@ -4,7 +4,7 @@ import numpy as np
|
|
|
4
4
|
import os
|
|
5
5
|
from numba import njit, prange
|
|
6
6
|
|
|
7
|
-
from .maxcut_tfim_util import binary_search, get_cut, maxcut_hamming_cdf, opencl_context, to_scipy_sparse_upper_triangular
|
|
7
|
+
from .maxcut_tfim_util import binary_search, get_cut, maxcut_hamming_cdf, opencl_context, sample_mag, bit_pick, init_bit_pick, to_scipy_sparse_upper_triangular
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
epsilon = opencl_context.epsilon
|
|
@@ -48,14 +48,7 @@ def local_repulsion_choice(G_cols, G_data, G_rows, max_edge, weights, tot_init_w
|
|
|
48
48
|
used = np.zeros(n, dtype=np.bool_) # False = available, True = used
|
|
49
49
|
|
|
50
50
|
# First bit:
|
|
51
|
-
|
|
52
|
-
cum = 0.0
|
|
53
|
-
node = 0
|
|
54
|
-
for i in range(n):
|
|
55
|
-
cum += weights[i]
|
|
56
|
-
if (tot_init_weight * r) < cum:
|
|
57
|
-
node = i
|
|
58
|
-
break
|
|
51
|
+
node = init_bit_pick(weights, tot_init_weight, n)
|
|
59
52
|
|
|
60
53
|
if m == 1:
|
|
61
54
|
used[node] = True
|
|
@@ -64,56 +57,12 @@ def local_repulsion_choice(G_cols, G_data, G_rows, max_edge, weights, tot_init_w
|
|
|
64
57
|
update_repulsion_choice(G_cols, G_data, G_rows, max_edge, weights, n, used, node, repulsion_base)
|
|
65
58
|
|
|
66
59
|
for _ in range(1, m - 1):
|
|
67
|
-
|
|
68
|
-
total_w = 0.0
|
|
69
|
-
for i in range(n):
|
|
70
|
-
if used[i]:
|
|
71
|
-
continue
|
|
72
|
-
total_w += weights[i]
|
|
73
|
-
|
|
74
|
-
# Normalize & sample
|
|
75
|
-
r = np.random.rand()
|
|
76
|
-
cum = 0.0
|
|
77
|
-
node = -1
|
|
78
|
-
for i in range(n):
|
|
79
|
-
if used[i]:
|
|
80
|
-
continue
|
|
81
|
-
cum += weights[i]
|
|
82
|
-
if (total_w * r) < cum:
|
|
83
|
-
node = i
|
|
84
|
-
break
|
|
85
|
-
|
|
86
|
-
if node == -1:
|
|
87
|
-
node = 0
|
|
88
|
-
while used[node]:
|
|
89
|
-
node += 1
|
|
60
|
+
node = bit_pick(weights, used, n)
|
|
90
61
|
|
|
91
62
|
# Update answer and weights
|
|
92
63
|
update_repulsion_choice(G_cols, G_data, G_rows, max_edge, weights, n, used, node, repulsion_base)
|
|
93
64
|
|
|
94
|
-
|
|
95
|
-
total_w = 0.0
|
|
96
|
-
for i in range(n):
|
|
97
|
-
if used[i]:
|
|
98
|
-
continue
|
|
99
|
-
total_w += weights[i]
|
|
100
|
-
|
|
101
|
-
# Normalize & sample
|
|
102
|
-
r = np.random.rand()
|
|
103
|
-
cum = 0.0
|
|
104
|
-
node = -1
|
|
105
|
-
for i in range(n):
|
|
106
|
-
if used[i]:
|
|
107
|
-
continue
|
|
108
|
-
cum += weights[i]
|
|
109
|
-
if (total_w * r) < cum:
|
|
110
|
-
node = i
|
|
111
|
-
break
|
|
112
|
-
|
|
113
|
-
if node == -1:
|
|
114
|
-
node = 0
|
|
115
|
-
while used[node]:
|
|
116
|
-
node += 1
|
|
65
|
+
node = bit_pick(weights, used, n)
|
|
117
66
|
|
|
118
67
|
used[node] = True
|
|
119
68
|
|
|
@@ -161,11 +110,7 @@ def sample_for_energy(max_edge, G_data, G_rows, G_cols, shots, thresholds, weigh
|
|
|
161
110
|
improved = False
|
|
162
111
|
for s in prange(shots):
|
|
163
112
|
# First dimension: Hamming weight
|
|
164
|
-
|
|
165
|
-
m = 0
|
|
166
|
-
while thresholds[m] < mag_prob:
|
|
167
|
-
m += 1
|
|
168
|
-
m += 1
|
|
113
|
+
m = sample_mag(thresholds)
|
|
169
114
|
|
|
170
115
|
# Second dimension: permutation within Hamming weight
|
|
171
116
|
sample = local_repulsion_choice(G_cols, G_data, G_rows, max_edge, weights, tot_init_weight, repulsion_base, n, m)
|
|
@@ -199,11 +144,7 @@ def sample_for_cut(max_edge, G_data, G_rows, G_cols, shots, thresholds, weights,
|
|
|
199
144
|
improved = False
|
|
200
145
|
for s in prange(shots):
|
|
201
146
|
# First dimension: Hamming weight
|
|
202
|
-
|
|
203
|
-
m = 0
|
|
204
|
-
while thresholds[m] < mag_prob:
|
|
205
|
-
m += 1
|
|
206
|
-
m += 1
|
|
147
|
+
m = sample_mag(thresholds)
|
|
207
148
|
|
|
208
149
|
# Second dimension: permutation within Hamming weight
|
|
209
150
|
sample = local_repulsion_choice(G_cols, G_data, G_rows, max_edge, weights, tot_init_weight, repulsion_base, n, m)
|
|
@@ -4,7 +4,7 @@ import numpy as np
|
|
|
4
4
|
import os
|
|
5
5
|
from numba import njit, prange
|
|
6
6
|
|
|
7
|
-
from .maxcut_tfim_util import get_cut, maxcut_hamming_cdf, opencl_context
|
|
7
|
+
from .maxcut_tfim_util import get_cut, maxcut_hamming_cdf, opencl_context, sample_mag, bit_pick, init_bit_pick
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
epsilon = opencl_context.epsilon
|
|
@@ -38,14 +38,7 @@ def local_repulsion_choice(G_func, nodes, max_edge, weights, tot_init_weight, re
|
|
|
38
38
|
used = np.zeros(n, dtype=np.bool_) # False = available, True = used
|
|
39
39
|
|
|
40
40
|
# First bit:
|
|
41
|
-
|
|
42
|
-
cum = 0.0
|
|
43
|
-
node = 0
|
|
44
|
-
for i in range(n):
|
|
45
|
-
cum += weights[i]
|
|
46
|
-
if (tot_init_weight * r) < cum:
|
|
47
|
-
node = i
|
|
48
|
-
break
|
|
41
|
+
node = init_bit_pick(weights, tot_init_weight, n)
|
|
49
42
|
|
|
50
43
|
if m == 1:
|
|
51
44
|
used[node] = True
|
|
@@ -54,56 +47,12 @@ def local_repulsion_choice(G_func, nodes, max_edge, weights, tot_init_weight, re
|
|
|
54
47
|
update_repulsion_choice(G_func, nodes, max_edge, weights, n, used, node, repulsion_base)
|
|
55
48
|
|
|
56
49
|
for _ in range(1, m - 1):
|
|
57
|
-
|
|
58
|
-
total_w = 0.0
|
|
59
|
-
for i in range(n):
|
|
60
|
-
if used[i]:
|
|
61
|
-
continue
|
|
62
|
-
total_w += weights[i]
|
|
63
|
-
|
|
64
|
-
# Normalize & sample
|
|
65
|
-
r = np.random.rand()
|
|
66
|
-
cum = 0.0
|
|
67
|
-
node = -1
|
|
68
|
-
for i in range(n):
|
|
69
|
-
if used[i]:
|
|
70
|
-
continue
|
|
71
|
-
cum += weights[i]
|
|
72
|
-
if (total_w * r) < cum:
|
|
73
|
-
node = i
|
|
74
|
-
break
|
|
75
|
-
|
|
76
|
-
if node == -1:
|
|
77
|
-
node = 0
|
|
78
|
-
while used[node]:
|
|
79
|
-
node += 1
|
|
50
|
+
node = bit_pick(weights, used, n)
|
|
80
51
|
|
|
81
52
|
# Update answer and weights
|
|
82
53
|
update_repulsion_choice(G_func, nodes, max_edge, weights, n, used, node, repulsion_base)
|
|
83
54
|
|
|
84
|
-
|
|
85
|
-
total_w = 0.0
|
|
86
|
-
for i in range(n):
|
|
87
|
-
if used[i]:
|
|
88
|
-
continue
|
|
89
|
-
total_w += weights[i]
|
|
90
|
-
|
|
91
|
-
# Normalize & sample
|
|
92
|
-
r = np.random.rand()
|
|
93
|
-
cum = 0.0
|
|
94
|
-
node = -1
|
|
95
|
-
for i in range(n):
|
|
96
|
-
if used[i]:
|
|
97
|
-
continue
|
|
98
|
-
cum += weights[i]
|
|
99
|
-
if (total_w * r) < cum:
|
|
100
|
-
node = i
|
|
101
|
-
break
|
|
102
|
-
|
|
103
|
-
if node == -1:
|
|
104
|
-
node = 0
|
|
105
|
-
while used[node]:
|
|
106
|
-
node += 1
|
|
55
|
+
node = bit_pick(weights, used, n)
|
|
107
56
|
|
|
108
57
|
# Select node
|
|
109
58
|
used[node] = True
|
|
@@ -149,11 +98,7 @@ def sample_for_energy(G_func, nodes, max_edge, shots, thresholds, degrees_sum, w
|
|
|
149
98
|
improved = False
|
|
150
99
|
for s in prange(shots):
|
|
151
100
|
# First dimension: Hamming weight
|
|
152
|
-
|
|
153
|
-
m = 0
|
|
154
|
-
while thresholds[m] < mag_prob:
|
|
155
|
-
m += 1
|
|
156
|
-
m += 1
|
|
101
|
+
m = sample_mag(thresholds)
|
|
157
102
|
|
|
158
103
|
# Second dimension: permutation within Hamming weight
|
|
159
104
|
sample = local_repulsion_choice(G_func, nodes, max_edge, weights, tot_init_weight, repulsion_base, n, m)
|
|
@@ -186,11 +131,7 @@ def sample_for_cut(G_func, nodes, max_edge, shots, thresholds, degrees_sum, weig
|
|
|
186
131
|
improved = False
|
|
187
132
|
for s in prange(shots):
|
|
188
133
|
# First dimension: Hamming weight
|
|
189
|
-
|
|
190
|
-
m = 0
|
|
191
|
-
while thresholds[m] < mag_prob:
|
|
192
|
-
m += 1
|
|
193
|
-
m += 1
|
|
134
|
+
m = sample_mag(thresholds)
|
|
194
135
|
|
|
195
136
|
# Second dimension: permutation within Hamming weight
|
|
196
137
|
sample = local_repulsion_choice(G_func, nodes, max_edge, weights, tot_init_weight, repulsion_base, n, m)
|
|
@@ -255,3 +255,63 @@ def fix_cdf(hamming_prob):
|
|
|
255
255
|
cum_prob[-1] = 2.0
|
|
256
256
|
|
|
257
257
|
return cum_prob
|
|
258
|
+
|
|
259
|
+
@njit
|
|
260
|
+
def sample_mag(cum_prob):
|
|
261
|
+
p = np.random.random()
|
|
262
|
+
m = 0
|
|
263
|
+
left = 0
|
|
264
|
+
right = len(cum_prob) - 1
|
|
265
|
+
while True:
|
|
266
|
+
m = (left + right) >> 1
|
|
267
|
+
|
|
268
|
+
if (cum_prob[m] >= p) and ((m == 0) or cum_prob[m - 1] < p):
|
|
269
|
+
break
|
|
270
|
+
|
|
271
|
+
if cum_prob[m] < p:
|
|
272
|
+
left = m + 1
|
|
273
|
+
else:
|
|
274
|
+
right = m - 1
|
|
275
|
+
|
|
276
|
+
return m + 1
|
|
277
|
+
|
|
278
|
+
@njit
|
|
279
|
+
def init_bit_pick(weights, tot_init_weight, n):
|
|
280
|
+
r = np.random.rand()
|
|
281
|
+
cum = 0.0
|
|
282
|
+
node = 0
|
|
283
|
+
for i in range(n):
|
|
284
|
+
cum += weights[i]
|
|
285
|
+
if (tot_init_weight * r) < cum:
|
|
286
|
+
node = i
|
|
287
|
+
break
|
|
288
|
+
|
|
289
|
+
return node
|
|
290
|
+
|
|
291
|
+
@njit
|
|
292
|
+
def bit_pick(weights, used, n):
|
|
293
|
+
# Count available
|
|
294
|
+
total_w = 0.0
|
|
295
|
+
for i in range(n):
|
|
296
|
+
if used[i]:
|
|
297
|
+
continue
|
|
298
|
+
total_w += weights[i]
|
|
299
|
+
|
|
300
|
+
# Normalize & sample
|
|
301
|
+
r = np.random.rand()
|
|
302
|
+
cum = 0.0
|
|
303
|
+
node = -1
|
|
304
|
+
for i in range(n):
|
|
305
|
+
if used[i]:
|
|
306
|
+
continue
|
|
307
|
+
cum += weights[i]
|
|
308
|
+
if (total_w * r) < cum:
|
|
309
|
+
node = i
|
|
310
|
+
break
|
|
311
|
+
|
|
312
|
+
if node == -1:
|
|
313
|
+
node = 0
|
|
314
|
+
while used[node]:
|
|
315
|
+
node += 1
|
|
316
|
+
|
|
317
|
+
return node
|
|
@@ -585,6 +585,8 @@ def tsp_symmetric_driver(G_m, is_cyclic, is_top_level, start_node, end_node, k_n
|
|
|
585
585
|
if not c is None:
|
|
586
586
|
best_path.append(c)
|
|
587
587
|
|
|
588
|
+
best_path = restitch(G_m, best_path, True)
|
|
589
|
+
|
|
588
590
|
if is_top_level:
|
|
589
591
|
if is_cyclic:
|
|
590
592
|
best_path += [best_path[0]]
|
|
@@ -614,8 +616,6 @@ def tsp_symmetric_driver(G_m, is_cyclic, is_top_level, start_node, end_node, k_n
|
|
|
614
616
|
else:
|
|
615
617
|
best_path, _ = targeted_three_opt(best_path, G_m, neighbor_lists, k_neighbors)
|
|
616
618
|
|
|
617
|
-
best_path = restitch(G_m, best_path, True)
|
|
618
|
-
|
|
619
619
|
best_weight = path_length(best_path, G_m)
|
|
620
620
|
|
|
621
621
|
return [nodes[x] for x in best_path], best_weight
|
|
@@ -780,6 +780,8 @@ def tsp_asymmetric_driver(G_m, is_reversed, is_cyclic, is_top_level, start_node,
|
|
|
780
780
|
if not c is None:
|
|
781
781
|
best_path.append(c)
|
|
782
782
|
|
|
783
|
+
best_path = restitch(G_m, best_path, False)
|
|
784
|
+
|
|
783
785
|
if is_top_level:
|
|
784
786
|
if is_cyclic:
|
|
785
787
|
best_path += [best_path[0]]
|
|
@@ -817,8 +819,6 @@ def tsp_asymmetric_driver(G_m, is_reversed, is_cyclic, is_top_level, start_node,
|
|
|
817
819
|
else:
|
|
818
820
|
final_path = best_path
|
|
819
821
|
|
|
820
|
-
final_path = restitch(G_m, final_path, False)
|
|
821
|
-
|
|
822
822
|
best_weight = path_length(final_path, G_m)
|
|
823
823
|
|
|
824
824
|
if is_reversed:
|
|
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
|
|
|
51
51
|
|
|
52
52
|
setup(
|
|
53
53
|
name='pyqrackising',
|
|
54
|
-
version='8.9.
|
|
54
|
+
version='8.9.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
|