dwave-preprocessing 0.6.9__tar.gz → 0.6.11__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 (155) hide show
  1. {dwave-preprocessing-0.6.9/dwave_preprocessing.egg-info → dwave_preprocessing-0.6.11}/PKG-INFO +10 -8
  2. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/__init__.py +1 -1
  3. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/composites/spin_reversal_transform.py +54 -17
  4. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/cyfix_variables.cpp +16 -16
  5. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/presolve/cypresolve.cpp +7 -7
  6. dwave_preprocessing-0.6.11/dwave/preprocessing/presolve/cypresolve.pyi +50 -0
  7. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11/dwave_preprocessing.egg-info}/PKG-INFO +10 -8
  8. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave_preprocessing.egg-info/SOURCES.txt +10 -1
  9. dwave_preprocessing-0.6.11/dwave_preprocessing.egg-info/requires.txt +2 -0
  10. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/pyproject.toml +1 -1
  11. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/setup.cfg +2 -2
  12. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/setup.py +2 -2
  13. dwave_preprocessing-0.6.11/tests/test_clip.py +104 -0
  14. dwave_preprocessing-0.6.11/tests/test_composites_common.py +68 -0
  15. dwave_preprocessing-0.6.11/tests/test_connected_components.py +83 -0
  16. dwave_preprocessing-0.6.11/tests/test_fix_variables.py +100 -0
  17. dwave_preprocessing-0.6.11/tests/test_presolve.py +632 -0
  18. dwave_preprocessing-0.6.11/tests/test_roof_duality.py +56 -0
  19. dwave_preprocessing-0.6.11/tests/test_scale.py +119 -0
  20. dwave_preprocessing-0.6.11/tests/test_spin_reversal_transform.py +273 -0
  21. dwave-preprocessing-0.6.9/dwave_preprocessing.egg-info/requires.txt +0 -2
  22. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/LICENSE +0 -0
  23. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/MANIFEST.in +0 -0
  24. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/README.rst +0 -0
  25. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/composites/__init__.py +0 -0
  26. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/composites/clip.py +0 -0
  27. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/composites/connected_components.py +0 -0
  28. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/composites/fix_variables.py +0 -0
  29. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/composites/scale.py +0 -0
  30. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/cyfix_variables.pyx +0 -0
  31. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/include/dwave/exceptions.hpp +0 -0
  32. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/include/dwave/flags.hpp +0 -0
  33. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/include/dwave/presolve.hpp +0 -0
  34. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/include/dwave-preprocessing/fix_variables.hpp +0 -0
  35. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/include/dwave-preprocessing/helper_data_structures.hpp +0 -0
  36. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/include/dwave-preprocessing/helper_graph_algorithms.hpp +0 -0
  37. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/include/dwave-preprocessing/implication_network.hpp +0 -0
  38. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/include/dwave-preprocessing/mapping_policy.hpp +0 -0
  39. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/include/dwave-preprocessing/posiform_info.hpp +0 -0
  40. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/include/dwave-preprocessing/push_relabel.hpp +0 -0
  41. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/libcpp.pxd +0 -0
  42. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/lower_bounds.py +0 -0
  43. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/presolve/__init__.pxd +0 -0
  44. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/presolve/__init__.py +0 -0
  45. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/presolve/cypresolve.pxd +0 -0
  46. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/presolve/cypresolve.pyx +0 -0
  47. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/presolve/exceptions.py +0 -0
  48. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/presolve/pypresolve.py +0 -0
  49. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/src/exceptions.cpp +0 -0
  50. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/src/presolve.cpp +0 -0
  51. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave/preprocessing/src/presolveimpl.hpp +0 -0
  52. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave_preprocessing.egg-info/dependency_links.txt +0 -0
  53. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave_preprocessing.egg-info/not-zip-safe +0 -0
  54. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/dwave_preprocessing.egg-info/top_level.txt +0 -0
  55. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/LICENSE +0 -0
  56. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/async.h +0 -0
  57. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/async_logger-inl.h +0 -0
  58. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/async_logger.h +0 -0
  59. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/cfg/argv.h +0 -0
  60. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/cfg/env.h +0 -0
  61. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/cfg/helpers-inl.h +0 -0
  62. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/cfg/helpers.h +0 -0
  63. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/common-inl.h +0 -0
  64. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/common.h +0 -0
  65. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/backtracer-inl.h +0 -0
  66. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/backtracer.h +0 -0
  67. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/circular_q.h +0 -0
  68. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/console_globals.h +0 -0
  69. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/file_helper-inl.h +0 -0
  70. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/file_helper.h +0 -0
  71. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/fmt_helper.h +0 -0
  72. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/log_msg-inl.h +0 -0
  73. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/log_msg.h +0 -0
  74. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/log_msg_buffer-inl.h +0 -0
  75. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/log_msg_buffer.h +0 -0
  76. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/mpmc_blocking_q.h +0 -0
  77. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/null_mutex.h +0 -0
  78. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/os-inl.h +0 -0
  79. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/os.h +0 -0
  80. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/periodic_worker-inl.h +0 -0
  81. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/periodic_worker.h +0 -0
  82. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/registry-inl.h +0 -0
  83. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/registry.h +0 -0
  84. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/synchronous_factory.h +0 -0
  85. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/tcp_client-windows.h +0 -0
  86. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/tcp_client.h +0 -0
  87. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/thread_pool-inl.h +0 -0
  88. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/thread_pool.h +0 -0
  89. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/udp_client-windows.h +0 -0
  90. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/udp_client.h +0 -0
  91. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/details/windows_include.h +0 -0
  92. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bin_to_hex.h +0 -0
  93. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/args.h +0 -0
  94. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/chrono.h +0 -0
  95. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/color.h +0 -0
  96. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/compile.h +0 -0
  97. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/core.h +0 -0
  98. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/fmt.license.rst +0 -0
  99. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/format-inl.h +0 -0
  100. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/format.h +0 -0
  101. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/locale.h +0 -0
  102. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/os.h +0 -0
  103. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/ostream.h +0 -0
  104. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/printf.h +0 -0
  105. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/ranges.h +0 -0
  106. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/bundled/xchar.h +0 -0
  107. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/chrono.h +0 -0
  108. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/compile.h +0 -0
  109. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/fmt.h +0 -0
  110. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/ostr.h +0 -0
  111. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/ranges.h +0 -0
  112. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fmt/xchar.h +0 -0
  113. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/formatter.h +0 -0
  114. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/fwd.h +0 -0
  115. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/logger-inl.h +0 -0
  116. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/logger.h +0 -0
  117. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/pattern_formatter-inl.h +0 -0
  118. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/pattern_formatter.h +0 -0
  119. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/android_sink.h +0 -0
  120. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h +0 -0
  121. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/ansicolor_sink.h +0 -0
  122. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/base_sink-inl.h +0 -0
  123. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/base_sink.h +0 -0
  124. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/basic_file_sink-inl.h +0 -0
  125. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/basic_file_sink.h +0 -0
  126. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/daily_file_sink.h +0 -0
  127. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/dist_sink.h +0 -0
  128. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/dup_filter_sink.h +0 -0
  129. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/hourly_file_sink.h +0 -0
  130. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/mongo_sink.h +0 -0
  131. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/msvc_sink.h +0 -0
  132. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/null_sink.h +0 -0
  133. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/ostream_sink.h +0 -0
  134. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/qt_sinks.h +0 -0
  135. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/ringbuffer_sink.h +0 -0
  136. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/rotating_file_sink-inl.h +0 -0
  137. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/rotating_file_sink.h +0 -0
  138. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/sink-inl.h +0 -0
  139. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/sink.h +0 -0
  140. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/stdout_color_sinks-inl.h +0 -0
  141. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/stdout_color_sinks.h +0 -0
  142. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/stdout_sinks-inl.h +0 -0
  143. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/stdout_sinks.h +0 -0
  144. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/syslog_sink.h +0 -0
  145. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/systemd_sink.h +0 -0
  146. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/tcp_sink.h +0 -0
  147. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/udp_sink.h +0 -0
  148. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/win_eventlog_sink.h +0 -0
  149. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/wincolor_sink-inl.h +0 -0
  150. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/sinks/wincolor_sink.h +0 -0
  151. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/spdlog-inl.h +0 -0
  152. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/spdlog.h +0 -0
  153. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/stopwatch.h +0 -0
  154. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/tweakme.h +0 -0
  155. {dwave-preprocessing-0.6.9 → dwave_preprocessing-0.6.11}/extern/spdlog/include/spdlog/version.h +0 -0
@@ -1,13 +1,12 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: dwave-preprocessing
3
- Version: 0.6.9
3
+ Version: 0.6.11
4
4
  Summary: An API for preprocessing tools
5
5
  Home-page: https://github.com/dwavesystems/dwave-preprocessing
6
+ Download-URL: https://github.com/dwavesystems/dwave-preprocessing/releases
6
7
  Author: D-Wave Systems Inc.
7
8
  Author-email: tools@dwavesys.com
8
9
  License: Apache 2.0
9
- Download-URL: https://github.com/dwavesystems/dwave-preprocessing/releases
10
- Platform: UNKNOWN
11
10
  Classifier: License :: OSI Approved :: Apache Software License
12
11
  Classifier: Operating System :: Microsoft :: Windows
13
12
  Classifier: Operating System :: POSIX
@@ -15,14 +14,19 @@ Classifier: Operating System :: Unix
15
14
  Classifier: Operating System :: MacOS
16
15
  Classifier: Programming Language :: Python :: Implementation :: CPython
17
16
  Classifier: Programming Language :: Python :: 3 :: Only
18
- Classifier: Programming Language :: Python :: 3.9
19
17
  Classifier: Programming Language :: Python :: 3.10
20
18
  Classifier: Programming Language :: Python :: 3.11
21
19
  Classifier: Programming Language :: Python :: 3.12
22
20
  Classifier: Programming Language :: Python :: 3.13
23
- Requires-Python: >=3.9
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Requires-Python: >=3.10
24
23
  Description-Content-Type: text/x-rst
25
24
  License-File: LICENSE
25
+ Requires-Dist: numpy<3.0.0,>=1.21.6
26
+ Requires-Dist: dimod<0.13.0,>=0.12.21
27
+ Dynamic: download-url
28
+ Dynamic: license-file
29
+ Dynamic: requires-dist
26
30
 
27
31
  .. image:: https://circleci.com/gh/dwavesystems/dwave-preprocessing.svg?style=svg
28
32
  :target: https://circleci.com/gh/dwavesystems/dwave-preprocessing
@@ -102,5 +106,3 @@ create a new release note file by running
102
106
  You can then edit the file created under ``releasenotes/notes/``.
103
107
  Remove any sections not relevant to your changes.
104
108
  Commit the file along with your changes.
105
-
106
-
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = '0.6.9'
15
+ __version__ = '0.6.11'
16
16
 
17
17
  from dwave.preprocessing import *
18
18
  import dwave.preprocessing.composites
@@ -137,7 +137,8 @@ class SpinReversalTransformComposite(ComposedSampler):
137
137
 
138
138
  @dimod.decorators.nonblocking_sample_method
139
139
  def sample(self, bqm: dimod.BinaryQuadraticModel, *,
140
- num_spin_reversal_transforms: int = 1,
140
+ srts: typing.Optional[np.ndarray] = None,
141
+ num_spin_reversal_transforms: typing.Optional[int] = None,
141
142
  **kwargs,
142
143
  ):
143
144
  """Sample from the binary quadratic model.
@@ -145,55 +146,91 @@ class SpinReversalTransformComposite(ComposedSampler):
145
146
  Args:
146
147
  bqm: Binary quadratic model to be sampled from.
147
148
 
149
+ srts: A boolean NumPy array with shape
150
+ ``(num_spin_reversal_transforms, bqm.num_variables)``.
151
+ True indicates a flip and False indicates no flip; applied to
152
+ in the order given by ``bqm.variables``.
153
+ If this is not specified as an input values are generated uniformly
154
+ at random from the class pseudo-random number generator.
155
+
148
156
  num_spin_reversal_transforms:
149
157
  Number of spin reversal transform runs.
150
158
  A value of ``0`` will not transform the problem.
151
159
  If you specify a nonzero value, each spin reversal transform
152
160
  will result in an independent run of the child sampler.
161
+ If ``srts`` is set then ``num_spin_reversal_transforms``
162
+ is inferred by the shape, otherwise the default is 1.
153
163
 
154
164
  Returns:
155
165
  A sample set. Note that for a sampler that returns ``num_reads`` samples,
156
166
  the sample set will contain ``num_reads*num_spin_reversal_transforms`` samples.
157
167
 
168
+ Raises:
169
+ ValueError: If ``srts`` is inconsistent with
170
+ ``num_spin_reversal_transforms`` or the binary quadratic model.
171
+
158
172
  Examples:
159
- This example runs 100 spin reversals applied to one variable of a QUBO problem.
173
+ This example runs 10 spin reversals applied to an unfrustrated chain
174
+ of length 6.
175
+
176
+ Using the lowest energy (ground) state returned, you can define a
177
+ special SRT that transforms all programmed couplers to be ferromagnetic
178
+ (ground state to all 1).
160
179
 
161
180
  >>> from dimod import ExactSolver
181
+ >>> import numpy as np
162
182
  >>> from dwave.preprocessing.composites import SpinReversalTransformComposite
163
183
  >>> base_sampler = ExactSolver()
164
184
  >>> composed_sampler = SpinReversalTransformComposite(base_sampler)
165
185
  ...
166
- >>> Q = {('a', 'a'): -1, ('b', 'b'): -1, ('a', 'b'): 2}
167
- >>> response = composed_sampler.sample_qubo(Q,
168
- ... num_spin_reversal_transforms=100)
169
- >>> len(response)
170
- 400
186
+ >>> num_var = 6
187
+ >>> num_spin_reversal_transforms = 10
188
+ >>> J = {(i, i+1): np.random.choice([-1,1]) for i in range(num_var-1)}
189
+ >>> h = {i: 0 for i in range(num_var)}
190
+ >>> response = composed_sampler.sample_ising(h, J,
191
+ ... num_spin_reversal_transforms=num_spin_reversal_transforms)
192
+ >>> len(response) == 2**num_var * num_spin_reversal_transforms
193
+ True
194
+ >>> srts = np.array([[response.first.sample[i] != 1 for i in range(num_var)]])
195
+ >>> response = composed_sampler.sample_ising(h, J,
196
+ ... srts=srts, num_reads=1)
197
+ >>> sum(response.record.num_occurrences) == 2**num_var
198
+ True
171
199
  """
172
200
  sampler = self._child
173
201
 
202
+ if srts is not None:
203
+ nsrt, num_bqm_var = srts.shape
204
+ if num_bqm_var != bqm.num_variables:
205
+ raise ValueError('srt shape is inconsistent with the bqm')
206
+ if num_spin_reversal_transforms is not None:
207
+ if num_spin_reversal_transforms != nsrt:
208
+ raise ValueError('srt shape is inconsistent with num_spin_reversal_transforms')
209
+ else:
210
+ num_spin_reversal_transforms = nsrt
211
+ elif num_spin_reversal_transforms is None:
212
+ num_spin_reversal_transforms = 1
213
+
174
214
  # No SRTs, so just pass the problem through
175
- if not num_spin_reversal_transforms or not bqm.num_variables:
215
+ if num_spin_reversal_transforms == 0 or not bqm.num_variables:
176
216
  sampleset = sampler.sample(bqm, **kwargs)
177
217
  # yield twice because we're using the @nonblocking_sample_method
178
218
  yield sampleset # this one signals done()-ness
179
219
  yield sampleset # this is the one actually used by the user
180
220
  return
181
221
 
222
+ if srts is None:
223
+ srts = self.rng.random((num_spin_reversal_transforms, bqm.num_variables)) > .5
224
+
182
225
  # we'll be modifying the BQM, so make a copy
183
226
  bqm = bqm.copy()
184
227
 
185
- # We maintain the Leap behavior that num_spin_reversal_transforms == 1
186
- # corresponds to a single problem with randomly flipped variables.
187
-
188
- # Get the SRT matrix
189
- SRT = self.rng.random((num_spin_reversal_transforms, bqm.num_variables)) > .5
190
-
191
228
  # Submit the problems
192
229
  samplesets: typing.List[dimod.SampleSet] = []
193
230
  flipped = np.zeros(bqm.num_variables, dtype=bool) # what variables are currently flipped
194
231
  for i in range(num_spin_reversal_transforms):
195
232
  # determine what needs to be flipped
196
- transform = flipped != SRT[i, :]
233
+ transform = flipped != srts[i, :]
197
234
 
198
235
  # apply the transform
199
236
  for v, flip in zip(bqm.variables, transform):
@@ -213,10 +250,10 @@ class SpinReversalTransformComposite(ComposedSampler):
213
250
  # Undo the SRTs according to vartype
214
251
  if bqm.vartype is Vartype.BINARY:
215
252
  for i, sampleset in enumerate(samplesets):
216
- sampleset.record.sample[:, SRT[i, :]] = 1 - sampleset.record.sample[:, SRT[i, :]]
253
+ sampleset.record.sample[:, srts[i, :]] = 1 - sampleset.record.sample[:, srts[i, :]]
217
254
  elif bqm.vartype is Vartype.SPIN:
218
255
  for i, sampleset in enumerate(samplesets):
219
- sampleset.record.sample[:, SRT[i, :]] *= -1
256
+ sampleset.record.sample[:, srts[i, :]] *= -1
220
257
  else:
221
258
  raise RuntimeError("unexpected vartype")
222
259
  if num_spin_reversal_transforms == 1:
@@ -1532,13 +1532,13 @@ static const char *__pyx_filename;
1532
1532
  static const char *__pyx_f[] = {
1533
1533
  "dwave/preprocessing/cyfix_variables.pyx",
1534
1534
  "<stringsource>",
1535
- "env/lib/python3.9/site-packages/dimod/cyvariables.pxd",
1536
- "env/lib/python3.9/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi",
1537
- "env/lib/python3.9/site-packages/dimod/cyqmbase/cyqmbase_float32.pxd",
1538
- "env/lib/python3.9/site-packages/dimod/binary/cybqm/cybqm_template.pxd.pxi",
1539
- "env/lib/python3.9/site-packages/dimod/binary/cybqm/cybqm_float32.pxd",
1540
- "env/lib/python3.9/site-packages/dimod/cyqmbase/cyqmbase_float64.pxd",
1541
- "env/lib/python3.9/site-packages/dimod/binary/cybqm/cybqm_float64.pxd",
1535
+ "env/lib/python3.12/site-packages/dimod/cyvariables.pxd",
1536
+ "env/lib/python3.12/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi",
1537
+ "env/lib/python3.12/site-packages/dimod/cyqmbase/cyqmbase_float32.pxd",
1538
+ "env/lib/python3.12/site-packages/dimod/binary/cybqm/cybqm_template.pxd.pxi",
1539
+ "env/lib/python3.12/site-packages/dimod/binary/cybqm/cybqm_float32.pxd",
1540
+ "env/lib/python3.12/site-packages/dimod/cyqmbase/cyqmbase_float64.pxd",
1541
+ "env/lib/python3.12/site-packages/dimod/binary/cybqm/cybqm_float64.pxd",
1542
1542
  };
1543
1543
  /* #### Code section: utility_code_proto_before_types ### */
1544
1544
  /* ForceInitThreads.proto */
@@ -1797,7 +1797,7 @@ struct __pyx_opt_args_5dimod_11cyvariables_11cyVariables_index {
1797
1797
  };
1798
1798
  struct __pyx_opt_args_5dimod_6binary_5cybqm_13cybqm_float32_14cyBQM_template__index;
1799
1799
 
1800
- /* "env/lib/python3.9/site-packages/dimod/binary/cybqm/cybqm_template.pxd.pxi":28
1800
+ /* "env/lib/python3.12/site-packages/dimod/binary/cybqm/cybqm_template.pxd.pxi":28
1801
1801
  * # likes to use
1802
1802
  *
1803
1803
  * cdef Py_ssize_t _index(self, object, bint permissive=*) except -1 # <<<<<<<<<<<<<<
@@ -1830,7 +1830,7 @@ struct __pyx_obj_5dimod_11cyvariables_cyVariables {
1830
1830
  };
1831
1831
 
1832
1832
 
1833
- /* "env/lib/python3.9/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi":22
1833
+ /* "env/lib/python3.12/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi":22
1834
1834
  *
1835
1835
  *
1836
1836
  * cdef class cyQMBase_template: # <<<<<<<<<<<<<<
@@ -1858,7 +1858,7 @@ struct __pyx_obj_5dimod_8cyqmbase_16cyqmbase_float32_cyQMBase_float32 {
1858
1858
  };
1859
1859
 
1860
1860
 
1861
- /* "env/lib/python3.9/site-packages/dimod/binary/cybqm/cybqm_template.pxd.pxi":21
1861
+ /* "env/lib/python3.12/site-packages/dimod/binary/cybqm/cybqm_template.pxd.pxi":21
1862
1862
  *
1863
1863
  *
1864
1864
  * cdef class cyBQM_template(cyQMBase): # <<<<<<<<<<<<<<
@@ -1882,7 +1882,7 @@ struct __pyx_obj_5dimod_6binary_5cybqm_13cybqm_float32_cyBQM_float32 {
1882
1882
  };
1883
1883
 
1884
1884
 
1885
- /* "env/lib/python3.9/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi":22
1885
+ /* "env/lib/python3.12/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi":22
1886
1886
  *
1887
1887
  *
1888
1888
  * cdef class cyQMBase_template: # <<<<<<<<<<<<<<
@@ -1910,7 +1910,7 @@ struct __pyx_obj_5dimod_8cyqmbase_16cyqmbase_float64_cyQMBase_float64 {
1910
1910
  };
1911
1911
 
1912
1912
 
1913
- /* "env/lib/python3.9/site-packages/dimod/binary/cybqm/cybqm_template.pxd.pxi":21
1913
+ /* "env/lib/python3.12/site-packages/dimod/binary/cybqm/cybqm_template.pxd.pxi":21
1914
1914
  *
1915
1915
  *
1916
1916
  * cdef class cyBQM_template(cyQMBase): # <<<<<<<<<<<<<<
@@ -2064,7 +2064,7 @@ struct __pyx_vtabstruct_5dimod_11cyvariables_cyVariables {
2064
2064
  static struct __pyx_vtabstruct_5dimod_11cyvariables_cyVariables *__pyx_vtabptr_5dimod_11cyvariables_cyVariables;
2065
2065
 
2066
2066
 
2067
- /* "env/lib/python3.9/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi":22
2067
+ /* "env/lib/python3.12/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi":22
2068
2068
  *
2069
2069
  *
2070
2070
  * cdef class cyQMBase_template: # <<<<<<<<<<<<<<
@@ -2093,7 +2093,7 @@ struct __pyx_vtabstruct_5dimod_8cyqmbase_16cyqmbase_float32_cyQMBase_float32 {
2093
2093
  static struct __pyx_vtabstruct_5dimod_8cyqmbase_16cyqmbase_float32_cyQMBase_float32 *__pyx_vtabptr_5dimod_8cyqmbase_16cyqmbase_float32_cyQMBase_float32;
2094
2094
 
2095
2095
 
2096
- /* "env/lib/python3.9/site-packages/dimod/binary/cybqm/cybqm_template.pxd.pxi":21
2096
+ /* "env/lib/python3.12/site-packages/dimod/binary/cybqm/cybqm_template.pxd.pxi":21
2097
2097
  *
2098
2098
  *
2099
2099
  * cdef class cyBQM_template(cyQMBase): # <<<<<<<<<<<<<<
@@ -2136,7 +2136,7 @@ struct __pyx_vtabstruct_5dimod_6binary_5cybqm_13cybqm_float32_cyBQM_float32 {
2136
2136
  static struct __pyx_vtabstruct_5dimod_6binary_5cybqm_13cybqm_float32_cyBQM_float32 *__pyx_vtabptr_5dimod_6binary_5cybqm_13cybqm_float32_cyBQM_float32;
2137
2137
 
2138
2138
 
2139
- /* "env/lib/python3.9/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi":22
2139
+ /* "env/lib/python3.12/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi":22
2140
2140
  *
2141
2141
  *
2142
2142
  * cdef class cyQMBase_template: # <<<<<<<<<<<<<<
@@ -2165,7 +2165,7 @@ struct __pyx_vtabstruct_5dimod_8cyqmbase_16cyqmbase_float64_cyQMBase_float64 {
2165
2165
  static struct __pyx_vtabstruct_5dimod_8cyqmbase_16cyqmbase_float64_cyQMBase_float64 *__pyx_vtabptr_5dimod_8cyqmbase_16cyqmbase_float64_cyQMBase_float64;
2166
2166
 
2167
2167
 
2168
- /* "env/lib/python3.9/site-packages/dimod/binary/cybqm/cybqm_template.pxd.pxi":21
2168
+ /* "env/lib/python3.12/site-packages/dimod/binary/cybqm/cybqm_template.pxd.pxi":21
2169
2169
  *
2170
2170
  *
2171
2171
  * cdef class cyBQM_template(cyQMBase): # <<<<<<<<<<<<<<
@@ -1543,11 +1543,11 @@ static const char *__pyx_filename;
1543
1543
  static const char *__pyx_f[] = {
1544
1544
  "dwave/preprocessing/presolve/cypresolve.pyx",
1545
1545
  "<stringsource>",
1546
- "env/lib/python3.9/site-packages/dimod/cyvariables.pxd",
1547
- "env/lib/python3.9/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi",
1548
- "env/lib/python3.9/site-packages/dimod/cyqmbase/cyqmbase_float64.pxd",
1549
- "env/lib/python3.9/site-packages/dimod/constrained/cyexpression.pxd",
1550
- "env/lib/python3.9/site-packages/dimod/constrained/cyconstrained.pxd",
1546
+ "env/lib/python3.12/site-packages/dimod/cyvariables.pxd",
1547
+ "env/lib/python3.12/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi",
1548
+ "env/lib/python3.12/site-packages/dimod/cyqmbase/cyqmbase_float64.pxd",
1549
+ "env/lib/python3.12/site-packages/dimod/constrained/cyexpression.pxd",
1550
+ "env/lib/python3.12/site-packages/dimod/constrained/cyconstrained.pxd",
1551
1551
  };
1552
1552
  /* #### Code section: utility_code_proto_before_types ### */
1553
1553
  /* ForceInitThreads.proto */
@@ -1813,7 +1813,7 @@ struct __pyx_obj_5dimod_11cyvariables_cyVariables {
1813
1813
  };
1814
1814
 
1815
1815
 
1816
- /* "env/lib/python3.9/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi":22
1816
+ /* "env/lib/python3.12/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi":22
1817
1817
  *
1818
1818
  *
1819
1819
  * cdef class cyQMBase_template: # <<<<<<<<<<<<<<
@@ -2021,7 +2021,7 @@ struct __pyx_vtabstruct_5dimod_11cyvariables_cyVariables {
2021
2021
  static struct __pyx_vtabstruct_5dimod_11cyvariables_cyVariables *__pyx_vtabptr_5dimod_11cyvariables_cyVariables;
2022
2022
 
2023
2023
 
2024
- /* "env/lib/python3.9/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi":22
2024
+ /* "env/lib/python3.12/site-packages/dimod/cyqmbase/cyqmbase_template.pxd.pxi":22
2025
2025
  *
2026
2026
  *
2027
2027
  * cdef class cyQMBase_template: # <<<<<<<<<<<<<<
@@ -0,0 +1,50 @@
1
+ # Copyright 2022 D-Wave Systems Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import enum
16
+
17
+ import dimod
18
+ import numpy as np
19
+
20
+
21
+ class Feasibility(enum.Enum):
22
+ Infeasible = 0
23
+ Feasible = 1
24
+ Unknown = 2
25
+
26
+
27
+ class TechniqueFlags(enum.IntFlag):
28
+ None_ = 0
29
+ RemoveRedundantConstraints = 1 << 0
30
+ RemoveSmallBiases = 1 << 1
31
+ DomainPropagation = 1 << 2
32
+ All = 0xffffffffffffffff
33
+ Default = All
34
+
35
+
36
+ class cyPresolver:
37
+ variables: dimod.variables.Variables
38
+
39
+ def __init__(self, cqm: dimod.ConstrainedQuadraticModel, move: bool = ...): ...
40
+ def add_techniques(self, techniques: TechniqueFlags) -> TechniqueFlags: ...
41
+ def apply(self) -> bool: ...
42
+ def clear_model(self) -> None: ...
43
+ def copy_model(self) -> dimod.ConstrainedQuadraticModel: ...
44
+ def detach_model(self) -> dimod.ConstrainedQuadraticModel: ...
45
+ def feasibility(self) -> Feasibility: ...
46
+ def normalize(self) -> bool: ...
47
+ def presolve(self, *, time_limit_s: float = float("inf")) -> bool: ...
48
+ def restore_samples(self, samples_like: dimod.typing.SamplesLike) -> np.ndarray: ...
49
+ def set_techniques(self, techniques: TechniqueFlags) -> TechniqueFlags: ...
50
+ def techniques(self) -> TechniqueFlags: ...
@@ -1,13 +1,12 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: dwave-preprocessing
3
- Version: 0.6.9
3
+ Version: 0.6.11
4
4
  Summary: An API for preprocessing tools
5
5
  Home-page: https://github.com/dwavesystems/dwave-preprocessing
6
+ Download-URL: https://github.com/dwavesystems/dwave-preprocessing/releases
6
7
  Author: D-Wave Systems Inc.
7
8
  Author-email: tools@dwavesys.com
8
9
  License: Apache 2.0
9
- Download-URL: https://github.com/dwavesystems/dwave-preprocessing/releases
10
- Platform: UNKNOWN
11
10
  Classifier: License :: OSI Approved :: Apache Software License
12
11
  Classifier: Operating System :: Microsoft :: Windows
13
12
  Classifier: Operating System :: POSIX
@@ -15,14 +14,19 @@ Classifier: Operating System :: Unix
15
14
  Classifier: Operating System :: MacOS
16
15
  Classifier: Programming Language :: Python :: Implementation :: CPython
17
16
  Classifier: Programming Language :: Python :: 3 :: Only
18
- Classifier: Programming Language :: Python :: 3.9
19
17
  Classifier: Programming Language :: Python :: 3.10
20
18
  Classifier: Programming Language :: Python :: 3.11
21
19
  Classifier: Programming Language :: Python :: 3.12
22
20
  Classifier: Programming Language :: Python :: 3.13
23
- Requires-Python: >=3.9
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Requires-Python: >=3.10
24
23
  Description-Content-Type: text/x-rst
25
24
  License-File: LICENSE
25
+ Requires-Dist: numpy<3.0.0,>=1.21.6
26
+ Requires-Dist: dimod<0.13.0,>=0.12.21
27
+ Dynamic: download-url
28
+ Dynamic: license-file
29
+ Dynamic: requires-dist
26
30
 
27
31
  .. image:: https://circleci.com/gh/dwavesystems/dwave-preprocessing.svg?style=svg
28
32
  :target: https://circleci.com/gh/dwavesystems/dwave-preprocessing
@@ -102,5 +106,3 @@ create a new release note file by running
102
106
  You can then edit the file created under ``releasenotes/notes/``.
103
107
  Remove any sections not relevant to your changes.
104
108
  Commit the file along with your changes.
105
-
106
-
@@ -29,6 +29,7 @@ dwave/preprocessing/presolve/__init__.pxd
29
29
  dwave/preprocessing/presolve/__init__.py
30
30
  dwave/preprocessing/presolve/cypresolve.cpp
31
31
  dwave/preprocessing/presolve/cypresolve.pxd
32
+ dwave/preprocessing/presolve/cypresolve.pyi
32
33
  dwave/preprocessing/presolve/cypresolve.pyx
33
34
  dwave/preprocessing/presolve/exceptions.py
34
35
  dwave/preprocessing/presolve/pypresolve.py
@@ -141,4 +142,12 @@ extern/spdlog/include/spdlog/sinks/tcp_sink.h
141
142
  extern/spdlog/include/spdlog/sinks/udp_sink.h
142
143
  extern/spdlog/include/spdlog/sinks/win_eventlog_sink.h
143
144
  extern/spdlog/include/spdlog/sinks/wincolor_sink-inl.h
144
- extern/spdlog/include/spdlog/sinks/wincolor_sink.h
145
+ extern/spdlog/include/spdlog/sinks/wincolor_sink.h
146
+ tests/test_clip.py
147
+ tests/test_composites_common.py
148
+ tests/test_connected_components.py
149
+ tests/test_fix_variables.py
150
+ tests/test_presolve.py
151
+ tests/test_roof_duality.py
152
+ tests/test_scale.py
153
+ tests/test_spin_reversal_transform.py
@@ -0,0 +1,2 @@
1
+ numpy<3.0.0,>=1.21.6
2
+ dimod<0.13.0,>=0.12.21
@@ -3,7 +3,7 @@ requires = [
3
3
  "setuptools>=46.4.0",
4
4
  "wheel>=0.30.0",
5
5
  "Cython~=3.0",
6
- "dimod==0.12.20",
6
+ "dimod==0.12.21",
7
7
  ]
8
8
  build-backend = "setuptools.build_meta"
9
9
 
@@ -7,11 +7,11 @@ classifiers =
7
7
  Operating System :: MacOS
8
8
  Programming Language :: Python :: Implementation :: CPython
9
9
  Programming Language :: Python :: 3 :: Only
10
- Programming Language :: Python :: 3.9
11
10
  Programming Language :: Python :: 3.10
12
11
  Programming Language :: Python :: 3.11
13
12
  Programming Language :: Python :: 3.12
14
13
  Programming Language :: Python :: 3.13
14
+ Programming Language :: Python :: 3.14
15
15
  license = Apache 2.0
16
16
  long_description = file: README.rst
17
17
  long_description_content_type = text/x-rst
@@ -25,7 +25,7 @@ description = An API for preprocessing tools
25
25
  [options]
26
26
  include_package_data = True
27
27
  packages = find_namespace:
28
- python_requires = >=3.9
28
+ python_requires = >=3.10
29
29
  zip_safe = False
30
30
 
31
31
  [options.packages.find]
@@ -65,7 +65,7 @@ setup(
65
65
  'extern/spdlog/include/',
66
66
  ],
67
67
  install_requires=[
68
- 'numpy>=1.17.3,<3.0.0', # this is the oldest supported NumPy on Python 3.8
69
- 'dimod>=0.12.20,<0.13.0'
68
+ 'numpy>=1.21.6,<3.0.0', # this is the oldest supported NumPy on Python 3.10
69
+ 'dimod>=0.12.21,<0.13.0'
70
70
  ],
71
71
  )
@@ -0,0 +1,104 @@
1
+ # Copyright 2021 D-Wave Systems Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import unittest
16
+
17
+ import dimod
18
+ import dimod.testing as dtest
19
+ from dimod import BinaryQuadraticModel, ExactSolver, NullSampler
20
+
21
+ from dwave.preprocessing.composites import ClipComposite
22
+
23
+ @dtest.load_sampler_bqm_tests(ClipComposite(ExactSolver()))
24
+ @dtest.load_sampler_bqm_tests(ClipComposite(NullSampler()))
25
+ class TestClipCompositeClass(unittest.TestCase):
26
+ def test_instantiation_smoketest(self):
27
+ sampler = ClipComposite(NullSampler())
28
+ dtest.assert_sampler_api(sampler)
29
+
30
+ def test_no_bounds(self):
31
+ bqm = BinaryQuadraticModel({0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
32
+ {(0, 1): -2.0, (0, 2): -5.0, (0, 3): -2.0,
33
+ (0, 4): -2.0, (1, 2): -2.0, (1, 3): -2.0, (1, 4): 4.0,
34
+ (2, 3): -3.0, (2, 4): -5.0, (3, 4): -4.0}, 0, dimod.SPIN)
35
+ sampler = ClipComposite(ExactSolver())
36
+ solver = ExactSolver()
37
+ response = sampler.sample(bqm)
38
+ response_exact = solver.sample(bqm)
39
+ self.assertEqual(response.first.sample, response_exact.first.sample)
40
+ self.assertAlmostEqual(response.first.energy, response_exact.first.energy)
41
+
42
+ def test_lb_only(self):
43
+ bqm = BinaryQuadraticModel({0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
44
+ {(0, 1): -2.0, (0, 2): -5.0, (0, 3): -2.0,
45
+ (0, 4): -2.0, (1, 2): -2.0, (1, 3): -2.0, (1, 4): 4.0,
46
+ (2, 3): -3.0, (2, 4): -5.0, (3, 4): -4.0}, 0, dimod.SPIN)
47
+ sampler = ClipComposite(ExactSolver())
48
+ solver = ExactSolver()
49
+ response = sampler.sample(bqm, lower_bound=-1)
50
+ response_exact = solver.sample(bqm)
51
+ self.assertEqual(response.first.sample, response_exact.first.sample)
52
+ self.assertAlmostEqual(response.first.energy, response_exact.first.energy)
53
+
54
+ def test_ub_only(self):
55
+ bqm = BinaryQuadraticModel({0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
56
+ {(0, 1): -2.0, (0, 2): -5.0, (0, 3): -2.0,
57
+ (0, 4): -2.0, (1, 2): -2.0, (1, 3): -2.0, (1, 4): 4.0,
58
+ (2, 3): -3.0, (2, 4): -5.0, (3, 4): -4.0}, 0, dimod.SPIN)
59
+ sampler = ClipComposite(ExactSolver())
60
+ solver = ExactSolver()
61
+ response = sampler.sample(bqm, upper_bound=1)
62
+ response_exact = solver.sample(bqm)
63
+ self.assertEqual(response.first.sample, response_exact.first.sample)
64
+ self.assertAlmostEqual(response.first.energy, response_exact.first.energy)
65
+
66
+ def test_lb_and_ub(self):
67
+ bqm = BinaryQuadraticModel({0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0},
68
+ {(0, 1): -2.0, (0, 2): -5.0, (0, 3): -2.0,
69
+ (0, 4): -2.0, (1, 2): -2.0, (1, 3): -2.0, (1, 4): 4.0,
70
+ (2, 3): -3.0, (2, 4): -5.0, (3, 4): -4.0}, 0, dimod.SPIN)
71
+ sampler = ClipComposite(ExactSolver())
72
+ solver = ExactSolver()
73
+ response = sampler.sample(bqm, lower_bound=-1, upper_bound=1)
74
+ response_exact = solver.sample(bqm)
75
+ self.assertEqual(response.first.sample, response_exact.first.sample)
76
+ self.assertAlmostEqual(response.first.energy, response_exact.first.energy)
77
+
78
+ def test_with_labels(self):
79
+ bqm = BinaryQuadraticModel({'a': 0.0, 'b': 0.0, 'c': 0.0, 'd': 0.0, 'e': 0.0},
80
+ {('a', 'b'): -2.0, ('a', 'c'): -5.0, ('a', 'd'): -2.0,
81
+ ('a', 'e'): -2.0, ('b', 'c'): -2.0, ('b', 'd'): -2.0, ('b', 'e'): 4.0,
82
+ ('c', 'd'): -3.0, ('c', 'e'): -5.0, ('d', 'e'): -4.0}, 0, dimod.SPIN)
83
+ sampler = ClipComposite(ExactSolver())
84
+ solver = ExactSolver()
85
+ response = sampler.sample(bqm, lower_bound=-1, upper_bound=1)
86
+ response_exact = solver.sample(bqm)
87
+ self.assertEqual(response.first.sample, response_exact.first.sample)
88
+ self.assertAlmostEqual(response.first.energy, response_exact.first.energy)
89
+
90
+ def test_empty_bqm(self):
91
+ bqm = BinaryQuadraticModel({}, {}, 0.0, dimod.SPIN)
92
+ sampler = ClipComposite(ExactSolver())
93
+ sampler.sample(bqm, lower_bound=-1, upper_bound=1)
94
+
95
+ def test_info_propagation(self):
96
+ bqm = BinaryQuadraticModel.from_ising({}, {})
97
+
98
+ class MySampler:
99
+ @staticmethod
100
+ def sample(bqm):
101
+ return dimod.SampleSet.from_samples_bqm([], bqm, info=dict(a=1))
102
+
103
+ sampleset = ClipComposite(MySampler).sample(bqm)
104
+ self.assertEqual(sampleset.info, {'a': 1})
@@ -0,0 +1,68 @@
1
+ # Copyright 2025 D-Wave
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import unittest
16
+ from unittest import mock
17
+
18
+ import dimod
19
+ from parameterized import parameterized_class
20
+
21
+ from dwave.preprocessing.composites import (
22
+ ClipComposite,
23
+ ConnectedComponentsComposite,
24
+ FixVariablesComposite,
25
+ ScaleComposite,
26
+ SpinReversalTransformComposite,
27
+ )
28
+
29
+
30
+ @parameterized_class([
31
+ dict(composite_cls=ClipComposite),
32
+ dict(composite_cls=ConnectedComponentsComposite),
33
+ dict(composite_cls=FixVariablesComposite),
34
+ dict(composite_cls=ScaleComposite),
35
+ dict(composite_cls=SpinReversalTransformComposite),
36
+ ])
37
+ class TestScoped(unittest.TestCase):
38
+ """Test all composites defined in dwave-preprocessing are properly scoped,
39
+ i.e. they propagate `close()` to samplers and they implement the context
40
+ manager protocol.
41
+ """
42
+
43
+ def get_composite(self) -> tuple[dimod.Sampler, dimod.Composite]:
44
+ params = getattr(self, 'params', None)
45
+ if params is None:
46
+ params = {}
47
+
48
+ sampler = getattr(self, 'sampler_cls', dimod.ExactSolver)()
49
+ sampler.close = mock.MagicMock()
50
+
51
+ composite = self.composite_cls(sampler, **params)
52
+
53
+ return sampler, composite
54
+
55
+ def test_close_propagation(self):
56
+ sampler, composite = self.get_composite()
57
+
58
+ composite.close()
59
+
60
+ sampler.close.assert_called_once()
61
+
62
+ def test_context_manager(self):
63
+ sampler, composite = self.get_composite()
64
+
65
+ with composite:
66
+ ...
67
+
68
+ sampler.close.assert_called_once()