PyQrackIsing 2.0.1__tar.gz → 2.0.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-2.0.1/pyqrackising.egg-info → pyqrackising-2.0.3}/PKG-INFO +1 -1
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyproject.toml +1 -1
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/tsp_symmetric.py +6 -19
- {pyqrackising-2.0.1 → pyqrackising-2.0.3/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/setup.py +1 -1
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/CMakeLists.txt +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/LICENSE.md +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/MANIFEST.in +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/README.md +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/__init__.py +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/_pyqrack_ising.cpp +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-2.0.1 → pyqrackising-2.0.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 = "2.0.
|
|
14
|
+
version = "2.0.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"}
|
|
@@ -4,12 +4,6 @@ from numba import njit, prange
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
# By Gemini (Google Search AI)
|
|
9
|
-
def int_to_bitstring(integer, length):
|
|
10
|
-
return (bin(integer)[2:].zfill(length))[::-1]
|
|
11
|
-
|
|
12
|
-
|
|
13
7
|
# two_opt() and targeted_three_opt() written by Elara (OpenAI ChatGPT instance)
|
|
14
8
|
@njit
|
|
15
9
|
def path_length(path, G_m):
|
|
@@ -30,9 +24,7 @@ def one_way_two_opt(path, G):
|
|
|
30
24
|
while improved:
|
|
31
25
|
improved = False
|
|
32
26
|
for i in range(1, path_len - 1):
|
|
33
|
-
for j in range(i+
|
|
34
|
-
if j - i == 1: # adjacent edges, skip
|
|
35
|
-
continue
|
|
27
|
+
for j in range(i + 2, path_len):
|
|
36
28
|
new_path = best_path[:]
|
|
37
29
|
new_path[i:j] = best_path[j-1:i-1:-1]
|
|
38
30
|
new_dist = path_length(new_path, G)
|
|
@@ -52,10 +44,8 @@ def anchored_two_opt(path, G):
|
|
|
52
44
|
|
|
53
45
|
while improved:
|
|
54
46
|
improved = False
|
|
55
|
-
for i in range(
|
|
56
|
-
for j in range(i+
|
|
57
|
-
if j - i == 1: # adjacent edges, skip
|
|
58
|
-
continue
|
|
47
|
+
for i in range(2, path_len - 1):
|
|
48
|
+
for j in range(i + 2, path_len):
|
|
59
49
|
new_path = best_path[:]
|
|
60
50
|
new_path[i:j] = best_path[j-1:i-1:-1]
|
|
61
51
|
new_dist = path_length(new_path, G)
|
|
@@ -71,13 +61,12 @@ def two_opt(path, G):
|
|
|
71
61
|
improved = True
|
|
72
62
|
best_path = path
|
|
73
63
|
best_dist = path_length(best_path, G)
|
|
64
|
+
path_len = len(path)
|
|
74
65
|
|
|
75
66
|
while improved:
|
|
76
67
|
improved = False
|
|
77
|
-
for i in range(1,
|
|
78
|
-
for j in range(i+
|
|
79
|
-
if j - i == 1: # adjacent edges, skip
|
|
80
|
-
continue
|
|
68
|
+
for i in range(1, path_len - 2):
|
|
69
|
+
for j in range(i + 2, path_len - 1):
|
|
81
70
|
new_path = best_path[:]
|
|
82
71
|
new_path[i:j] = best_path[j-1:i-1:-1] # reverse segment
|
|
83
72
|
new_dist = path_length(new_path, G)
|
|
@@ -362,9 +351,7 @@ def tsp_symmetric(G, start_node=None, end_node=None, quality=1, shots=None, corr
|
|
|
362
351
|
elif not end_node is None:
|
|
363
352
|
best_path, best_weight = two_opt(best_path, G_m)
|
|
364
353
|
elif not start_node is None:
|
|
365
|
-
best_path.reverse()
|
|
366
354
|
best_path, best_weight = anchored_two_opt(best_path, G_m)
|
|
367
|
-
best_path.reverse()
|
|
368
355
|
else:
|
|
369
356
|
best_path, best_weight = one_way_two_opt(best_path, G_m)
|
|
370
357
|
|
|
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
|
|
|
51
51
|
|
|
52
52
|
setup(
|
|
53
53
|
name='pyqrackising',
|
|
54
|
-
version='2.0.
|
|
54
|
+
version='2.0.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
|