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.
Files changed (22) hide show
  1. {pyqrackising-2.0.1/pyqrackising.egg-info → pyqrackising-2.0.3}/PKG-INFO +1 -1
  2. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyproject.toml +1 -1
  3. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/tsp_symmetric.py +6 -19
  4. {pyqrackising-2.0.1 → pyqrackising-2.0.3/pyqrackising.egg-info}/PKG-INFO +1 -1
  5. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/setup.py +1 -1
  6. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/CMakeLists.txt +0 -0
  7. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/LICENSE.md +0 -0
  8. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/MANIFEST.in +0 -0
  9. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/README.md +0 -0
  10. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/__init__.py +0 -0
  11. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/_pyqrack_ising.cpp +0 -0
  12. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/generate_tfim_samples.py +0 -0
  13. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/kernels.cl +0 -0
  14. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/maxcut_tfim.py +0 -0
  15. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/spin_glass_solver.py +0 -0
  16. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/tfim_magnetization.py +0 -0
  17. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising/tfim_square_magnetization.py +0 -0
  18. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising.egg-info/SOURCES.txt +0 -0
  19. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising.egg-info/dependency_links.txt +0 -0
  20. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising.egg-info/not-zip-safe +0 -0
  21. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/pyqrackising.egg-info/top_level.txt +0 -0
  22. {pyqrackising-2.0.1 → pyqrackising-2.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: Near-ideal closed-form solutions for transverse field Ising model (TFIM)
5
5
  Home-page: https://github.com/vm6502q/PyQrackIsing
6
6
  Author: Dan Strano
@@ -11,7 +11,7 @@ build-backend = "setuptools.build_meta"
11
11
 
12
12
  [project]
13
13
  name = "pyqrackising"
14
- version = "2.0.1"
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+1, path_len + 1):
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(1, path_len - 1):
56
- for j in range(i+1, path_len):
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, len(path) - 2):
78
- for j in range(i+1, len(path) - 1):
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: Near-ideal closed-form solutions for 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='2.0.1',
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