PyQrackIsing 9.2.0__tar.gz → 9.2.2__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-9.2.0/pyqrackising.egg-info → pyqrackising-9.2.2}/PKG-INFO +1 -1
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyproject.toml +1 -1
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/spin_glass_solver.py +22 -12
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/spin_glass_solver_sparse.py +22 -12
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/spin_glass_solver_streaming.py +22 -12
- {pyqrackising-9.2.0 → pyqrackising-9.2.2/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/setup.py +1 -1
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/LICENSE.md +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/MANIFEST.in +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/README.md +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/__init__.py +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/maxcut_tfim_sparse.py +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/maxcut_tfim_streaming.py +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/maxcut_tfim_util.py +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/tsp.py +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-9.2.0 → pyqrackising-9.2.2}/setup.cfg +0 -0
|
@@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
|
|
|
10
10
|
|
|
11
11
|
[project]
|
|
12
12
|
name = "pyqrackising"
|
|
13
|
-
version = "9.2.
|
|
13
|
+
version = "9.2.2"
|
|
14
14
|
requires-python = ">=3.8"
|
|
15
15
|
description = "Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)"
|
|
16
16
|
readme = {file = "README.txt", content-type = "text/markdown"}
|
|
@@ -105,7 +105,7 @@ def run_double_bit_flips(best_theta, is_spin_glass, G_m, thread_count):
|
|
|
105
105
|
|
|
106
106
|
@njit(parallel=True)
|
|
107
107
|
def pick_gray_seeds(best_theta, thread_count, gray_seed_multiple, G_m, n, is_spin_glass):
|
|
108
|
-
blocks = (n +
|
|
108
|
+
blocks = (n + 63) // 64
|
|
109
109
|
block_size = thread_count * gray_seed_multiple
|
|
110
110
|
seed_count = block_size * blocks
|
|
111
111
|
|
|
@@ -115,14 +115,14 @@ def pick_gray_seeds(best_theta, thread_count, gray_seed_multiple, G_m, n, is_spi
|
|
|
115
115
|
if is_spin_glass:
|
|
116
116
|
for s in prange(seed_count):
|
|
117
117
|
i = s % block_size
|
|
118
|
-
offset = (s // block_size) *
|
|
118
|
+
offset = (s // block_size) * 64
|
|
119
119
|
seed = gray_mutation(i, best_theta, offset)
|
|
120
120
|
energies[s] = compute_energy(seed, G_m, n)
|
|
121
121
|
seeds[s] = seed
|
|
122
122
|
else:
|
|
123
123
|
for s in prange(seed_count):
|
|
124
124
|
i = s % block_size
|
|
125
|
-
offset = (s // block_size) *
|
|
125
|
+
offset = (s // block_size) * 64
|
|
126
126
|
seed = gray_mutation(i, best_theta, offset)
|
|
127
127
|
energies[s] = compute_cut(seed, G_m, n)
|
|
128
128
|
seeds[s] = seed
|
|
@@ -143,29 +143,39 @@ def pick_gray_seeds(best_theta, thread_count, gray_seed_multiple, G_m, n, is_spi
|
|
|
143
143
|
def run_gray_optimization(best_theta, iterators, gray_iterations, thread_count, is_spin_glass, G_m):
|
|
144
144
|
n = len(best_theta)
|
|
145
145
|
thread_iterations = (gray_iterations + thread_count - 1) // thread_count
|
|
146
|
-
blocks = (n +
|
|
146
|
+
blocks = (n + 63) // 64
|
|
147
147
|
|
|
148
148
|
states = np.empty((thread_count, n), dtype=np.bool_)
|
|
149
149
|
energies = np.full(thread_count, np.finfo(dtype).min, dtype=dtype)
|
|
150
150
|
|
|
151
151
|
if is_spin_glass:
|
|
152
152
|
for i in prange(thread_count):
|
|
153
|
-
iterator = iterators[i]
|
|
153
|
+
iterator = iterators[i].copy()
|
|
154
|
+
best_energy, best_iterator = -float("inf"), iterator.copy()
|
|
154
155
|
for curr_idx in range(thread_iterations):
|
|
155
156
|
for block in range(blocks):
|
|
156
|
-
gray_code_next(iterator, curr_idx, block *
|
|
157
|
+
gray_code_next(iterator, curr_idx, block * 64)
|
|
157
158
|
energy = compute_energy(iterator, G_m, n)
|
|
158
|
-
if energy >
|
|
159
|
-
|
|
159
|
+
if energy > best_energy:
|
|
160
|
+
best_iterator, best_energy = iterator.copy(), energy
|
|
161
|
+
else:
|
|
162
|
+
iterator = best_iterator.copy()
|
|
163
|
+
if best_energy > energies[i]:
|
|
164
|
+
states[i], energies[i] = best_iterator.copy(), best_energy
|
|
160
165
|
else:
|
|
161
166
|
for i in prange(thread_count):
|
|
162
|
-
iterator = iterators[i]
|
|
167
|
+
iterator = iterators[i].copy()
|
|
168
|
+
best_energy, best_iterator = -float("inf"), iterator.copy()
|
|
163
169
|
for curr_idx in range(thread_iterations):
|
|
164
170
|
for block in range(blocks):
|
|
165
|
-
gray_code_next(iterator, curr_idx, block *
|
|
171
|
+
gray_code_next(iterator, curr_idx, block * 64)
|
|
166
172
|
energy = compute_cut(iterator, G_m, n)
|
|
167
|
-
if energy >
|
|
168
|
-
|
|
173
|
+
if energy > best_energy:
|
|
174
|
+
best_iterator, best_energy = iterator.copy(), energy
|
|
175
|
+
else:
|
|
176
|
+
iterator = best_iterator.copy()
|
|
177
|
+
if best_energy > energies[i]:
|
|
178
|
+
states[i], energies[i] = best_iterator.copy(), best_energy
|
|
169
179
|
|
|
170
180
|
best_index = np.argmax(energies)
|
|
171
181
|
best_energy = energies[best_index]
|
|
@@ -105,7 +105,7 @@ def run_double_bit_flips(best_theta, is_spin_glass, G_data, G_rows, G_cols, thre
|
|
|
105
105
|
|
|
106
106
|
@njit(parallel=True)
|
|
107
107
|
def pick_gray_seeds(best_theta, thread_count, gray_seed_multiple, G_data, G_rows, G_cols, n, is_spin_glass):
|
|
108
|
-
blocks = (n +
|
|
108
|
+
blocks = (n + 63) // 64
|
|
109
109
|
block_size = thread_count * gray_seed_multiple
|
|
110
110
|
seed_count = block_size * blocks
|
|
111
111
|
|
|
@@ -115,14 +115,14 @@ def pick_gray_seeds(best_theta, thread_count, gray_seed_multiple, G_data, G_rows
|
|
|
115
115
|
if is_spin_glass:
|
|
116
116
|
for s in prange(seed_count):
|
|
117
117
|
i = s % block_size
|
|
118
|
-
offset = (s // block_size) *
|
|
118
|
+
offset = (s // block_size) * 64
|
|
119
119
|
seed = gray_mutation(i, best_theta, offset)
|
|
120
120
|
energies[s] = compute_energy_sparse(seed, G_data, G_rows, G_cols, n)
|
|
121
121
|
seeds[s] = seed
|
|
122
122
|
else:
|
|
123
123
|
for s in prange(seed_count):
|
|
124
124
|
i = s % block_size
|
|
125
|
-
offset = (s // block_size) *
|
|
125
|
+
offset = (s // block_size) * 64
|
|
126
126
|
seed = gray_mutation(i, best_theta, offset)
|
|
127
127
|
energies[s] = compute_cut_sparse(seed, G_data, G_rows, G_cols, n)
|
|
128
128
|
seeds[s] = seed
|
|
@@ -143,29 +143,39 @@ def pick_gray_seeds(best_theta, thread_count, gray_seed_multiple, G_data, G_rows
|
|
|
143
143
|
def run_gray_optimization(best_theta, iterators, gray_iterations, thread_count, is_spin_glass, G_data, G_rows, G_cols):
|
|
144
144
|
n = len(best_theta)
|
|
145
145
|
thread_iterations = (gray_iterations + thread_count - 1) // thread_count
|
|
146
|
-
blocks = (n +
|
|
146
|
+
blocks = (n + 63) // 64
|
|
147
147
|
|
|
148
148
|
states = np.empty((thread_count, n), dtype=np.bool_)
|
|
149
149
|
energies = np.full(thread_count, np.finfo(dtype).min, dtype=dtype)
|
|
150
150
|
|
|
151
151
|
if is_spin_glass:
|
|
152
152
|
for i in prange(thread_count):
|
|
153
|
-
iterator = iterators[i]
|
|
153
|
+
iterator = iterators[i].copy()
|
|
154
|
+
best_energy, best_iterator = -float("inf"), iterator.copy()
|
|
154
155
|
for curr_idx in range(thread_iterations):
|
|
155
156
|
for block in range(blocks):
|
|
156
|
-
gray_code_next(iterator, curr_idx, block *
|
|
157
|
+
gray_code_next(iterator, curr_idx, block * 64)
|
|
157
158
|
energy = compute_energy_sparse(iterator, G_data, G_rows, G_cols, n)
|
|
158
|
-
if energy >
|
|
159
|
-
|
|
159
|
+
if energy > best_energy:
|
|
160
|
+
best_iterator, best_energy = iterator.copy(), energy
|
|
161
|
+
else:
|
|
162
|
+
iterator = best_iterator.copy()
|
|
163
|
+
if best_energy > energies[i]:
|
|
164
|
+
states[i], energies[i] = best_iterator.copy(), best_energy
|
|
160
165
|
else:
|
|
161
166
|
for i in prange(thread_count):
|
|
162
|
-
iterator = iterators[i]
|
|
167
|
+
iterator = iterators[i].copy()
|
|
168
|
+
best_energy, best_iterator = -float("inf"), iterator.copy()
|
|
163
169
|
for curr_idx in range(thread_iterations):
|
|
164
170
|
for block in range(blocks):
|
|
165
|
-
gray_code_next(iterator, curr_idx, block *
|
|
171
|
+
gray_code_next(iterator, curr_idx, block * 64)
|
|
166
172
|
energy = compute_cut_sparse(iterator, G_data, G_rows, G_cols, n)
|
|
167
|
-
if energy >
|
|
168
|
-
|
|
173
|
+
if energy > best_energy:
|
|
174
|
+
best_iterator, best_energy = iterator.copy(), energy
|
|
175
|
+
else:
|
|
176
|
+
iterator = best_iterator.copy()
|
|
177
|
+
if best_energy > energies[i]:
|
|
178
|
+
states[i], energies[i] = best_iterator.copy(), best_energy
|
|
169
179
|
|
|
170
180
|
best_index = np.argmax(energies)
|
|
171
181
|
best_energy = energies[best_index]
|
|
@@ -97,7 +97,7 @@ def run_double_bit_flips(best_theta, is_spin_glass, G_func, nodes, thread_count)
|
|
|
97
97
|
|
|
98
98
|
@njit(parallel=True)
|
|
99
99
|
def pick_gray_seeds(best_theta, thread_count, gray_seed_multiple, G_func, nodes, n, is_spin_glass):
|
|
100
|
-
blocks = (n +
|
|
100
|
+
blocks = (n + 63) // 64
|
|
101
101
|
block_size = thread_count * gray_seed_multiple
|
|
102
102
|
seed_count = block_size * blocks
|
|
103
103
|
|
|
@@ -106,15 +106,15 @@ def pick_gray_seeds(best_theta, thread_count, gray_seed_multiple, G_func, nodes,
|
|
|
106
106
|
|
|
107
107
|
if is_spin_glass:
|
|
108
108
|
for s in prange(seed_count):
|
|
109
|
-
offset = s // block_size
|
|
110
109
|
i = s % block_size
|
|
110
|
+
offset = (s // block_size) * 64
|
|
111
111
|
seed = gray_mutation(i, best_theta, offset)
|
|
112
112
|
energies[s] = compute_energy_streaming(seed, G_func, nodes, n)
|
|
113
113
|
seeds[s] = seed
|
|
114
114
|
else:
|
|
115
115
|
for s in prange(seed_count):
|
|
116
|
-
offset = s // block_size
|
|
117
116
|
i = s % block_size
|
|
117
|
+
offset = (s // block_size) * 64
|
|
118
118
|
seed = gray_mutation(i, best_theta, offset)
|
|
119
119
|
energies[s] = compute_cut_streaming(seed, G_func, nodes, n)
|
|
120
120
|
seeds[s] = seed
|
|
@@ -135,29 +135,39 @@ def pick_gray_seeds(best_theta, thread_count, gray_seed_multiple, G_func, nodes,
|
|
|
135
135
|
def run_gray_optimization(best_theta, iterators, gray_iterations, thread_count, is_spin_glass, G_func, nodes):
|
|
136
136
|
n = len(best_theta)
|
|
137
137
|
thread_iterations = (gray_iterations + thread_count - 1) // thread_count
|
|
138
|
-
blocks = (n +
|
|
138
|
+
blocks = (n + 63) // 64
|
|
139
139
|
|
|
140
140
|
states = np.empty((thread_count, n), dtype=np.bool_)
|
|
141
141
|
energies = np.full(thread_count, np.finfo(dtype).min, dtype=dtype)
|
|
142
142
|
|
|
143
143
|
if is_spin_glass:
|
|
144
144
|
for i in prange(thread_count):
|
|
145
|
-
iterator = iterators[i]
|
|
145
|
+
iterator = iterators[i].copy()
|
|
146
|
+
best_energy, best_iterator = -float("inf"), iterator.copy()
|
|
146
147
|
for curr_idx in range(thread_iterations):
|
|
147
148
|
for block in range(blocks):
|
|
148
|
-
gray_code_next(iterator, curr_idx, block *
|
|
149
|
+
gray_code_next(iterator, curr_idx, block * 64)
|
|
149
150
|
energy = compute_energy_streaming(iterator, G_func, nodes, n)
|
|
150
|
-
if energy >
|
|
151
|
-
|
|
151
|
+
if energy > best_energy:
|
|
152
|
+
best_iterator, best_energy = iterator.copy(), energy
|
|
153
|
+
else:
|
|
154
|
+
iterator = best_iterator.copy()
|
|
155
|
+
if best_energy > energies[i]:
|
|
156
|
+
states[i], energies[i] = best_iterator.copy(), best_energy
|
|
152
157
|
else:
|
|
153
158
|
for i in prange(thread_count):
|
|
154
|
-
iterator = iterators[i]
|
|
159
|
+
iterator = iterators[i].copy()
|
|
160
|
+
best_energy, best_iterator = -float("inf"), iterator.copy()
|
|
155
161
|
for curr_idx in range(thread_iterations):
|
|
156
162
|
for block in range(blocks):
|
|
157
|
-
gray_code_next(iterator, curr_idx, block *
|
|
163
|
+
gray_code_next(iterator, curr_idx, block * 64)
|
|
158
164
|
energy = compute_cut_streaming(iterator, G_func, nodes, n)
|
|
159
|
-
if energy >
|
|
160
|
-
|
|
165
|
+
if energy > best_energy:
|
|
166
|
+
best_iterator, best_energy = iterator.copy(), energy
|
|
167
|
+
else:
|
|
168
|
+
iterator = best_iterator.copy()
|
|
169
|
+
if best_energy > energies[i]:
|
|
170
|
+
states[i], energies[i] = best_iterator.copy(), best_energy
|
|
161
171
|
|
|
162
172
|
best_index = np.argmax(energies)
|
|
163
173
|
best_energy = energies[best_index]
|
|
@@ -7,7 +7,7 @@ with open(README_PATH) as readme_file:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name='pyqrackising',
|
|
10
|
-
version='9.2.
|
|
10
|
+
version='9.2.2',
|
|
11
11
|
author='Dan Strano',
|
|
12
12
|
author_email='stranoj@gmail.com',
|
|
13
13
|
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
|