PyQrackIsing 2.0.2__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.2/pyqrackising.egg-info → pyqrackising-2.0.3}/PKG-INFO +1 -1
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyproject.toml +1 -1
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising/tsp_symmetric.py +5 -12
- {pyqrackising-2.0.2 → pyqrackising-2.0.3/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/setup.py +1 -1
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/CMakeLists.txt +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/LICENSE.md +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/MANIFEST.in +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/README.md +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising/__init__.py +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising/_pyqrack_ising.cpp +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-2.0.2 → pyqrackising-2.0.3}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-2.0.2 → 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,7 +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 + 2, path_len
|
|
27
|
+
for j in range(i + 2, path_len):
|
|
34
28
|
new_path = best_path[:]
|
|
35
29
|
new_path[i:j] = best_path[j-1:i-1:-1]
|
|
36
30
|
new_dist = path_length(new_path, G)
|
|
@@ -50,7 +44,7 @@ def anchored_two_opt(path, G):
|
|
|
50
44
|
|
|
51
45
|
while improved:
|
|
52
46
|
improved = False
|
|
53
|
-
for i in range(
|
|
47
|
+
for i in range(2, path_len - 1):
|
|
54
48
|
for j in range(i + 2, path_len):
|
|
55
49
|
new_path = best_path[:]
|
|
56
50
|
new_path[i:j] = best_path[j-1:i-1:-1]
|
|
@@ -67,11 +61,12 @@ def two_opt(path, G):
|
|
|
67
61
|
improved = True
|
|
68
62
|
best_path = path
|
|
69
63
|
best_dist = path_length(best_path, G)
|
|
64
|
+
path_len = len(path)
|
|
70
65
|
|
|
71
66
|
while improved:
|
|
72
67
|
improved = False
|
|
73
|
-
for i in range(1,
|
|
74
|
-
for j in range(i + 2,
|
|
68
|
+
for i in range(1, path_len - 2):
|
|
69
|
+
for j in range(i + 2, path_len - 1):
|
|
75
70
|
new_path = best_path[:]
|
|
76
71
|
new_path[i:j] = best_path[j-1:i-1:-1] # reverse segment
|
|
77
72
|
new_dist = path_length(new_path, G)
|
|
@@ -356,9 +351,7 @@ def tsp_symmetric(G, start_node=None, end_node=None, quality=1, shots=None, corr
|
|
|
356
351
|
elif not end_node is None:
|
|
357
352
|
best_path, best_weight = two_opt(best_path, G_m)
|
|
358
353
|
elif not start_node is None:
|
|
359
|
-
best_path.reverse()
|
|
360
354
|
best_path, best_weight = anchored_two_opt(best_path, G_m)
|
|
361
|
-
best_path.reverse()
|
|
362
355
|
else:
|
|
363
356
|
best_path, best_weight = one_way_two_opt(best_path, G_m)
|
|
364
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
|