PyQrackIsing 5.4.5__tar.gz → 5.4.6__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.
Files changed (28) hide show
  1. {pyqrackising-5.4.5/pyqrackising.egg-info → pyqrackising-5.4.6}/PKG-INFO +1 -1
  2. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyproject.toml +1 -1
  3. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/maxcut_tfim.py +18 -9
  4. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/maxcut_tfim_sparse.py +28 -19
  5. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/maxcut_tfim_streaming.py +18 -6
  6. {pyqrackising-5.4.5 → pyqrackising-5.4.6/pyqrackising.egg-info}/PKG-INFO +1 -1
  7. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/setup.py +1 -1
  8. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/CMakeLists.txt +0 -0
  9. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/LICENSE.md +0 -0
  10. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/MANIFEST.in +0 -0
  11. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/README.md +0 -0
  12. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/__init__.py +0 -0
  13. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/_pyqrack_ising.cpp +0 -0
  14. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/generate_tfim_samples.py +0 -0
  15. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/kernels.cl +0 -0
  16. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/maxcut_tfim_util.py +0 -0
  17. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/spin_glass_solver.py +0 -0
  18. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/spin_glass_solver_sparse.py +0 -0
  19. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/spin_glass_solver_streaming.py +0 -0
  20. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/spin_glass_solver_util.py +0 -0
  21. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/tfim_magnetization.py +0 -0
  22. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/tfim_square_magnetization.py +0 -0
  23. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising/tsp.py +0 -0
  24. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising.egg-info/SOURCES.txt +0 -0
  25. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising.egg-info/dependency_links.txt +0 -0
  26. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising.egg-info/not-zip-safe +0 -0
  27. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/pyqrackising.egg-info/top_level.txt +0 -0
  28. {pyqrackising-5.4.5 → pyqrackising-5.4.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 5.4.5
3
+ Version: 5.4.6
4
4
  Summary: Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)
5
5
  Home-page: https://github.com/vm6502q/PyQrackIsing
6
6
  Author: Dan Strano
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
12
12
 
13
13
  [project]
14
14
  name = "pyqrackising"
15
- version = "5.4.5"
15
+ version = "5.4.6"
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"}
@@ -13,6 +13,18 @@ except ImportError:
13
13
  IS_OPENCL_AVAILABLE = False
14
14
 
15
15
 
16
+ @njit
17
+ def update_repulsion_choice(G_m, max_weight, weights, n, used, node):
18
+ # Select node
19
+ used[node] = True
20
+
21
+ # Repulsion: penalize neighbors
22
+ for nbr in range(n):
23
+ if used[nbr]:
24
+ continue
25
+ weights[nbr] *= max(2e-7, 1 - G_m[node, nbr] / max_weight)
26
+
27
+
16
28
  # Written by Elara (OpenAI custom GPT) and improved by Dan Strano
17
29
  @njit
18
30
  def local_repulsion_choice(G_m, max_weight, weights, n, m):
@@ -27,7 +39,10 @@ def local_repulsion_choice(G_m, max_weight, weights, n, m):
27
39
  weights = weights.copy()
28
40
  used = np.zeros(n, dtype=np.bool_) # False = available, True = used
29
41
 
30
- for _ in range(m):
42
+ # Update answer and weights
43
+ update_repulsion_choice(G_m, max_weight, weights, n, used, np.random.randint(0, n - 1))
44
+
45
+ for _ in range(1, m):
31
46
  # Count available
32
47
  total_w = 0.0
33
48
  for i in range(n):
@@ -52,14 +67,8 @@ def local_repulsion_choice(G_m, max_weight, weights, n, m):
52
67
  while used[node]:
53
68
  node += 1
54
69
 
55
- # Select node
56
- used[node] = True
57
-
58
- # Repulsion: penalize neighbors
59
- for nbr in range(n):
60
- if used[nbr]:
61
- continue
62
- weights[nbr] *= max(2e-7, 1 - G_m[node, nbr] / max_weight)
70
+ # Update answer and weights
71
+ update_repulsion_choice(G_m, max_weight, weights, n, used, node)
63
72
 
64
73
  return used
65
74
 
@@ -33,6 +33,28 @@ def binary_search(l, t):
33
33
  return len(l)
34
34
 
35
35
 
36
+ @njit
37
+ def update_repulsion_choice(G_cols, G_data, G_rows, max_weight, weights, n, used, node):
38
+ # Select node
39
+ used[node] = True
40
+
41
+ # Repulsion: penalize neighbors
42
+ for j in range(G_rows[node], G_rows[node + 1]):
43
+ nbr = G_cols[j]
44
+ if used[nbr]:
45
+ continue
46
+ weights[nbr] *= max(2e-7, 1 - G_data[j] / max_weight)
47
+
48
+ for nbr in range(node):
49
+ if used[nbr]:
50
+ continue
51
+ start = G_rows[nbr]
52
+ end = G_rows[nbr + 1]
53
+ j = binary_search(G_cols[start:end], node) + start
54
+ if j < end:
55
+ weights[nbr] *= max(2e-7, 1 - G_data[j] / max_weight)
56
+
57
+
36
58
  # Written by Elara (OpenAI custom GPT) and improved by Dan Strano
37
59
  @njit
38
60
  def local_repulsion_choice(G_cols, G_data, G_rows, max_weight, weights, n, m):
@@ -47,7 +69,10 @@ def local_repulsion_choice(G_cols, G_data, G_rows, max_weight, weights, n, m):
47
69
  weights = weights.copy()
48
70
  used = np.zeros(n, dtype=np.bool_) # False = available, True = used
49
71
 
50
- for _ in range(m):
72
+ # Update answer and weights
73
+ update_repulsion_choice(G_cols, G_data, G_rows, max_weight, weights, n, used, np.random.randint(0, n - 1))
74
+
75
+ for _ in range(1, m):
51
76
  # Count available
52
77
  total_w = 0.0
53
78
  for i in range(n):
@@ -72,24 +97,8 @@ def local_repulsion_choice(G_cols, G_data, G_rows, max_weight, weights, n, m):
72
97
  while used[node]:
73
98
  node += 1
74
99
 
75
- # Select node
76
- used[node] = True
77
-
78
- # Repulsion: penalize neighbors
79
- for j in range(G_rows[node], G_rows[node + 1]):
80
- nbr = G_cols[j]
81
- if used[nbr]:
82
- continue
83
- weights[nbr] *= max(2e-7, 1 - G_data[j] / max_weight)
84
-
85
- for nbr in range(node):
86
- if used[nbr]:
87
- continue
88
- start = G_rows[nbr]
89
- end = G_rows[nbr + 1]
90
- j = binary_search(G_cols[start:end], node) + start
91
- if j < end:
92
- weights[nbr] *= max(2e-7, 1 - G_data[j] / max_weight)
100
+ # Update answer and weights
101
+ update_repulsion_choice(G_cols, G_data, G_rows, max_weight, weights, n, used, node)
93
102
 
94
103
  return used
95
104
 
@@ -13,6 +13,18 @@ except ImportError:
13
13
  IS_OPENCL_AVAILABLE = False
14
14
 
15
15
 
16
+ @njit
17
+ def update_repulsion_choice(G_func, G_func_args_tuple, nodes, max_weight, weights, n, used, node):
18
+ # Select node
19
+ used[node] = True
20
+
21
+ # Repulsion: penalize neighbors
22
+ for nbr in range(n):
23
+ if used[nbr]:
24
+ continue
25
+ weights[nbr] *= max(2e-7, 1 - G_func((nodes[node], nodes[nbr]), G_func_args_tuple) / max_weight)
26
+
27
+
16
28
  # Written by Elara (OpenAI custom GPT) and improved by Dan Strano
17
29
  @njit
18
30
  def local_repulsion_choice(G_func, G_func_args_tuple, nodes, max_weight, weights, n, m):
@@ -27,7 +39,10 @@ def local_repulsion_choice(G_func, G_func_args_tuple, nodes, max_weight, weights
27
39
  weights = weights.copy()
28
40
  used = np.zeros(n, dtype=np.bool_) # False = available, True = used
29
41
 
30
- for _ in range(m):
42
+ # Update answer and weights
43
+ update_repulsion_choice(G_func, G_func_args_tuple, nodes, max_weight, weights, n, used, np.random.randint(0, n - 1))
44
+
45
+ for _ in range(1, m):
31
46
  # Count available
32
47
  total_w = 0.0
33
48
  for i in range(n):
@@ -55,11 +70,8 @@ def local_repulsion_choice(G_func, G_func_args_tuple, nodes, max_weight, weights
55
70
  # Select node
56
71
  used[node] = True
57
72
 
58
- # Repulsion: penalize neighbors
59
- for nbr in range(n):
60
- if used[nbr]:
61
- continue
62
- weights[nbr] *= max(2e-7, 1 - G_func((nodes[node], nodes[nbr]), G_func_args_tuple) / max_weight)
73
+ # Update answer and weights
74
+ update_repulsion_choice(G_func, G_func_args_tuple, nodes, max_weight, weights, n, used, node)
63
75
 
64
76
  return used
65
77
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 5.4.5
3
+ Version: 5.4.6
4
4
  Summary: Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)
5
5
  Home-page: https://github.com/vm6502q/PyQrackIsing
6
6
  Author: Dan Strano
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
51
51
 
52
52
  setup(
53
53
  name='pyqrackising',
54
- version='5.4.5',
54
+ version='5.4.6',
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