luna-quantum 1.1.0__cp312-cp312-win_amd64.whl

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 (276) hide show
  1. luna_quantum/__init__.py +139 -0
  2. luna_quantum/__init__.pyi +98 -0
  3. luna_quantum/_core.cp312-win_amd64.pyd +0 -0
  4. luna_quantum/_core.pyi +4286 -0
  5. luna_quantum/_utility.py +148 -0
  6. luna_quantum/_utility.pyi +20 -0
  7. luna_quantum/algorithms/__init__.py +1 -0
  8. luna_quantum/aqm_overwrites/__init__.py +3 -0
  9. luna_quantum/aqm_overwrites/model.py +184 -0
  10. luna_quantum/backends/__init__.py +1 -0
  11. luna_quantum/client/__init__.py +0 -0
  12. luna_quantum/client/controllers/__init__.py +4 -0
  13. luna_quantum/client/controllers/luna_http_client.py +37 -0
  14. luna_quantum/client/controllers/luna_platform_client.py +256 -0
  15. luna_quantum/client/controllers/luna_q.py +67 -0
  16. luna_quantum/client/controllers/luna_solve.py +129 -0
  17. luna_quantum/client/error/__init__.py +0 -0
  18. luna_quantum/client/error/luna_api_key_invalid_error.py +10 -0
  19. luna_quantum/client/error/luna_api_key_missing_error.py +10 -0
  20. luna_quantum/client/error/luna_error.py +2 -0
  21. luna_quantum/client/error/luna_server_error.py +20 -0
  22. luna_quantum/client/error/timeout_error.py +12 -0
  23. luna_quantum/client/error/transformation_error.py +18 -0
  24. luna_quantum/client/error/utils/__init__.py +0 -0
  25. luna_quantum/client/error/utils/http_error_utils.py +112 -0
  26. luna_quantum/client/interfaces/__init__.py +4 -0
  27. luna_quantum/client/interfaces/clients/__init__.py +25 -0
  28. luna_quantum/client/interfaces/clients/circuit_rest_client_i.py +68 -0
  29. luna_quantum/client/interfaces/clients/info_rest_client_i.py +53 -0
  30. luna_quantum/client/interfaces/clients/model_rest_client_i.py +139 -0
  31. luna_quantum/client/interfaces/clients/qpu_token_rest_client_i.py +364 -0
  32. luna_quantum/client/interfaces/clients/rest_client_i.py +21 -0
  33. luna_quantum/client/interfaces/clients/solve_job_rest_client_i.py +201 -0
  34. luna_quantum/client/interfaces/clients/users_rest_client_i.py +29 -0
  35. luna_quantum/client/interfaces/services/__init__.py +0 -0
  36. luna_quantum/client/interfaces/services/luna_q_i.py +34 -0
  37. luna_quantum/client/interfaces/services/luna_solve_i.py +72 -0
  38. luna_quantum/client/interfaces/services/service_i.py +56 -0
  39. luna_quantum/client/rest_client/__init__.py +15 -0
  40. luna_quantum/client/rest_client/circuit_rest_client.py +107 -0
  41. luna_quantum/client/rest_client/info_rest_client.py +74 -0
  42. luna_quantum/client/rest_client/model_rest_client.py +216 -0
  43. luna_quantum/client/rest_client/qpu_token_rest_client.py +508 -0
  44. luna_quantum/client/rest_client/solve_job_rest_client.py +286 -0
  45. luna_quantum/client/rest_client/users_rest_client.py +35 -0
  46. luna_quantum/client/schemas/__init__.py +26 -0
  47. luna_quantum/client/schemas/circuit.py +48 -0
  48. luna_quantum/client/schemas/create/__init__.py +15 -0
  49. luna_quantum/client/schemas/create/circuit.py +30 -0
  50. luna_quantum/client/schemas/create/optimization.py +39 -0
  51. luna_quantum/client/schemas/create/qpu_token.py +22 -0
  52. luna_quantum/client/schemas/create/qpu_token_time_quota.py +35 -0
  53. luna_quantum/client/schemas/create/qpu_token_time_quota_update.py +24 -0
  54. luna_quantum/client/schemas/create/qubo.py +19 -0
  55. luna_quantum/client/schemas/create/solve_job_create.py +43 -0
  56. luna_quantum/client/schemas/enums/__init__.py +0 -0
  57. luna_quantum/client/schemas/enums/call_style.py +13 -0
  58. luna_quantum/client/schemas/enums/circuit.py +42 -0
  59. luna_quantum/client/schemas/enums/model_format.py +11 -0
  60. luna_quantum/client/schemas/enums/problem.py +50 -0
  61. luna_quantum/client/schemas/enums/qpu_token_type.py +20 -0
  62. luna_quantum/client/schemas/enums/sense.py +8 -0
  63. luna_quantum/client/schemas/enums/status.py +40 -0
  64. luna_quantum/client/schemas/enums/timeframe.py +11 -0
  65. luna_quantum/client/schemas/error_message.py +14 -0
  66. luna_quantum/client/schemas/model_metadata.py +35 -0
  67. luna_quantum/client/schemas/qpu_token/__init__.py +0 -0
  68. luna_quantum/client/schemas/qpu_token/qpu_token.py +154 -0
  69. luna_quantum/client/schemas/qpu_token/qpu_token_source.py +19 -0
  70. luna_quantum/client/schemas/qpu_token/qpu_token_time_quota.py +30 -0
  71. luna_quantum/client/schemas/qpu_token/token_provider.py +132 -0
  72. luna_quantum/client/schemas/representation.py +19 -0
  73. luna_quantum/client/schemas/solution.py +106 -0
  74. luna_quantum/client/schemas/solve_job.py +50 -0
  75. luna_quantum/client/schemas/solver_info.py +11 -0
  76. luna_quantum/client/schemas/user.py +11 -0
  77. luna_quantum/client/schemas/wrappers/__init__.py +5 -0
  78. luna_quantum/client/schemas/wrappers/datetime_wrapper.py +32 -0
  79. luna_quantum/client/utils/__init__.py +0 -0
  80. luna_quantum/client/utils/qpu_token_utils.py +147 -0
  81. luna_quantum/config.py +11 -0
  82. luna_quantum/decorators.py +248 -0
  83. luna_quantum/errors.py +34 -0
  84. luna_quantum/errors.pyi +287 -0
  85. luna_quantum/exceptions/__init__.py +0 -0
  86. luna_quantum/exceptions/base_luna_quantum_error.py +2 -0
  87. luna_quantum/exceptions/luna_quantum_call_type_error.py +9 -0
  88. luna_quantum/exceptions/patch_class_field_exists_error.py +10 -0
  89. luna_quantum/factories/__init__.py +4 -0
  90. luna_quantum/factories/luna_solve_client_factory.py +100 -0
  91. luna_quantum/factories/usecase_factory.py +489 -0
  92. luna_quantum/py.typed +0 -0
  93. luna_quantum/solve/__init__.py +13 -0
  94. luna_quantum/solve/default_token.py +304 -0
  95. luna_quantum/solve/domain/__init__.py +0 -0
  96. luna_quantum/solve/domain/abstract/__init__.py +4 -0
  97. luna_quantum/solve/domain/abstract/luna_algorithm.py +205 -0
  98. luna_quantum/solve/domain/abstract/qpu_token_backend.py +34 -0
  99. luna_quantum/solve/domain/model_metadata.py +56 -0
  100. luna_quantum/solve/domain/solve_job.py +230 -0
  101. luna_quantum/solve/errors/__init__.py +0 -0
  102. luna_quantum/solve/errors/incompatible_backend_error.py +15 -0
  103. luna_quantum/solve/errors/model_metadata_missing_error.py +11 -0
  104. luna_quantum/solve/errors/solve_base_error.py +5 -0
  105. luna_quantum/solve/errors/token_missing_error.py +11 -0
  106. luna_quantum/solve/interfaces/__init__.py +0 -0
  107. luna_quantum/solve/interfaces/algorithm_i.py +49 -0
  108. luna_quantum/solve/interfaces/backend_i.py +28 -0
  109. luna_quantum/solve/interfaces/usecases/__init__.py +59 -0
  110. luna_quantum/solve/interfaces/usecases/model_delete_usecase_i.py +27 -0
  111. luna_quantum/solve/interfaces/usecases/model_fetch_metadata_usecase_i.py +33 -0
  112. luna_quantum/solve/interfaces/usecases/model_get_solutions_usecase_i.py +33 -0
  113. luna_quantum/solve/interfaces/usecases/model_get_solve_jobs_usecase_i.py +33 -0
  114. luna_quantum/solve/interfaces/usecases/model_load_by_id_usecase_i.py +32 -0
  115. luna_quantum/solve/interfaces/usecases/model_load_by_metadata_usecase_i.py +37 -0
  116. luna_quantum/solve/interfaces/usecases/model_load_metadata_by_hash_usecase_i.py +38 -0
  117. luna_quantum/solve/interfaces/usecases/model_save_usecase_i.py +36 -0
  118. luna_quantum/solve/interfaces/usecases/solve_job_cancel_usecase_i.py +33 -0
  119. luna_quantum/solve/interfaces/usecases/solve_job_create_usecase_i.py +44 -0
  120. luna_quantum/solve/interfaces/usecases/solve_job_delete_usecase_i.py +32 -0
  121. luna_quantum/solve/interfaces/usecases/solve_job_fetch_updates_usecase_i.py +38 -0
  122. luna_quantum/solve/interfaces/usecases/solve_job_get_by_id_usecase_i.py +27 -0
  123. luna_quantum/solve/interfaces/usecases/solve_job_get_result_usecase_i.py +63 -0
  124. luna_quantum/solve/parameters/__init__.py +0 -0
  125. luna_quantum/solve/parameters/algorithms/__init__.py +51 -0
  126. luna_quantum/solve/parameters/algorithms/base_params/__init__.py +24 -0
  127. luna_quantum/solve/parameters/algorithms/base_params/decomposer.py +57 -0
  128. luna_quantum/solve/parameters/algorithms/base_params/qaoa_circuit_params.py +95 -0
  129. luna_quantum/solve/parameters/algorithms/base_params/quantum_annealing_params.py +79 -0
  130. luna_quantum/solve/parameters/algorithms/base_params/scipy_optimizer.py +122 -0
  131. luna_quantum/solve/parameters/algorithms/base_params/simulated_annealing_params.py +106 -0
  132. luna_quantum/solve/parameters/algorithms/base_params/tabu_kerberos_params.py +39 -0
  133. luna_quantum/solve/parameters/algorithms/base_params/tabu_search_params.py +129 -0
  134. luna_quantum/solve/parameters/algorithms/flexible_parameter_algorithm.py +59 -0
  135. luna_quantum/solve/parameters/algorithms/genetic_algorithms/__init__.py +4 -0
  136. luna_quantum/solve/parameters/algorithms/genetic_algorithms/qaga.py +131 -0
  137. luna_quantum/solve/parameters/algorithms/genetic_algorithms/saga.py +139 -0
  138. luna_quantum/solve/parameters/algorithms/lq_fda/__init__.py +3 -0
  139. luna_quantum/solve/parameters/algorithms/lq_fda/fujits_da_base.py +85 -0
  140. luna_quantum/solve/parameters/algorithms/lq_fda/fujitsu_da_v3c.py +155 -0
  141. luna_quantum/solve/parameters/algorithms/optimization_solvers/__init__.py +3 -0
  142. luna_quantum/solve/parameters/algorithms/optimization_solvers/scip.py +51 -0
  143. luna_quantum/solve/parameters/algorithms/quantum_annealing/__init__.py +19 -0
  144. luna_quantum/solve/parameters/algorithms/quantum_annealing/kerberos.py +149 -0
  145. luna_quantum/solve/parameters/algorithms/quantum_annealing/leap_hybrid_bqm.py +75 -0
  146. luna_quantum/solve/parameters/algorithms/quantum_annealing/leap_hybrid_cqm.py +75 -0
  147. luna_quantum/solve/parameters/algorithms/quantum_annealing/parallel_tempering_qpu.py +139 -0
  148. luna_quantum/solve/parameters/algorithms/quantum_annealing/population_annealing_qpu.py +109 -0
  149. luna_quantum/solve/parameters/algorithms/quantum_annealing/qbsolv_like_qpu.py +111 -0
  150. luna_quantum/solve/parameters/algorithms/quantum_annealing/quantum_annealing.py +121 -0
  151. luna_quantum/solve/parameters/algorithms/quantum_annealing/repeated_reverse_quantum_annealing.py +174 -0
  152. luna_quantum/solve/parameters/algorithms/quantum_gate/__init__.py +6 -0
  153. luna_quantum/solve/parameters/algorithms/quantum_gate/flex_qaoa/__init__.py +10 -0
  154. luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/__init__.py +29 -0
  155. luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/config.py +58 -0
  156. luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/flexqaoa.py +188 -0
  157. luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/optimizers.py +53 -0
  158. luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/pipeline.py +164 -0
  159. luna_quantum/solve/parameters/algorithms/quantum_gate/qaoa.py +112 -0
  160. luna_quantum/solve/parameters/algorithms/quantum_gate/qaoa_fo.py +69 -0
  161. luna_quantum/solve/parameters/algorithms/quantum_gate/vqe.py +108 -0
  162. luna_quantum/solve/parameters/algorithms/search_algorithms/__init__.py +5 -0
  163. luna_quantum/solve/parameters/algorithms/search_algorithms/dialectic_search.py +136 -0
  164. luna_quantum/solve/parameters/algorithms/search_algorithms/qbsolv_like_tabu_search.py +117 -0
  165. luna_quantum/solve/parameters/algorithms/search_algorithms/tabu_search.py +126 -0
  166. luna_quantum/solve/parameters/algorithms/simulated_annealing/__init__.py +13 -0
  167. luna_quantum/solve/parameters/algorithms/simulated_annealing/parallel_tempering.py +131 -0
  168. luna_quantum/solve/parameters/algorithms/simulated_annealing/population_annealing.py +95 -0
  169. luna_quantum/solve/parameters/algorithms/simulated_annealing/qbsolv_like_simulated_annealing.py +141 -0
  170. luna_quantum/solve/parameters/algorithms/simulated_annealing/repeated_reverse_simulated_annealing.py +172 -0
  171. luna_quantum/solve/parameters/algorithms/simulated_annealing/simulated_annealing.py +126 -0
  172. luna_quantum/solve/parameters/backends/__init__.py +27 -0
  173. luna_quantum/solve/parameters/backends/aqarios.py +17 -0
  174. luna_quantum/solve/parameters/backends/aqarios_gpu.py +17 -0
  175. luna_quantum/solve/parameters/backends/aws/__init__.py +11 -0
  176. luna_quantum/solve/parameters/backends/aws/aws.py +36 -0
  177. luna_quantum/solve/parameters/backends/aws/aws_backend_base.py +74 -0
  178. luna_quantum/solve/parameters/backends/aws/ionq.py +43 -0
  179. luna_quantum/solve/parameters/backends/aws/iqm.py +31 -0
  180. luna_quantum/solve/parameters/backends/aws/rigetti.py +31 -0
  181. luna_quantum/solve/parameters/backends/cudaq/__init__.py +5 -0
  182. luna_quantum/solve/parameters/backends/cudaq/cudaq_base.py +16 -0
  183. luna_quantum/solve/parameters/backends/cudaq/cudaq_cpu.py +30 -0
  184. luna_quantum/solve/parameters/backends/cudaq/cudaq_gpu.py +32 -0
  185. luna_quantum/solve/parameters/backends/dwave.py +17 -0
  186. luna_quantum/solve/parameters/backends/dwave_qpu.py +166 -0
  187. luna_quantum/solve/parameters/backends/fda.py +17 -0
  188. luna_quantum/solve/parameters/backends/ibm.py +138 -0
  189. luna_quantum/solve/parameters/backends/qctrl.py +103 -0
  190. luna_quantum/solve/parameters/backends/zib.py +17 -0
  191. luna_quantum/solve/parameters/constants.py +11 -0
  192. luna_quantum/solve/parameters/errors.py +30 -0
  193. luna_quantum/solve/parameters/mixins/__init__.py +0 -0
  194. luna_quantum/solve/parameters/mixins/fujitsu_common_params_mixin.py +239 -0
  195. luna_quantum/solve/parameters/mixins/fujitsu_v2_mixin.py +70 -0
  196. luna_quantum/solve/parameters/mixins/qbsolv_like_mixin.py +60 -0
  197. luna_quantum/solve/use_cases/__init__.py +119 -0
  198. luna_quantum/solve/use_cases/arbitrage_edge_based.py +50 -0
  199. luna_quantum/solve/use_cases/arbitrage_node_based.py +55 -0
  200. luna_quantum/solve/use_cases/base.py +7 -0
  201. luna_quantum/solve/use_cases/binary_integer_linear_programming.py +54 -0
  202. luna_quantum/solve/use_cases/binary_paint_shop_problem.py +37 -0
  203. luna_quantum/solve/use_cases/credit_scoring_feature_selection.py +40 -0
  204. luna_quantum/solve/use_cases/dynamic_portfolio_optimization.py +64 -0
  205. luna_quantum/solve/use_cases/exact_cover.py +51 -0
  206. luna_quantum/solve/use_cases/flight_gate_assignment.py +79 -0
  207. luna_quantum/solve/use_cases/graph_coloring.py +42 -0
  208. luna_quantum/solve/use_cases/graph_isomorphism.py +52 -0
  209. luna_quantum/solve/use_cases/graph_partitioning.py +46 -0
  210. luna_quantum/solve/use_cases/hamiltonian_cycle.py +49 -0
  211. luna_quantum/solve/use_cases/induced_subgraph_isomorphism.py +50 -0
  212. luna_quantum/solve/use_cases/job_shop_scheduling.py +44 -0
  213. luna_quantum/solve/use_cases/k_medoids_clustering.py +49 -0
  214. luna_quantum/solve/use_cases/knapsack_integer_weights.py +56 -0
  215. luna_quantum/solve/use_cases/linear_regression.py +60 -0
  216. luna_quantum/solve/use_cases/lmwcs.py +84 -0
  217. luna_quantum/solve/use_cases/longest_path.py +50 -0
  218. luna_quantum/solve/use_cases/market_graph_clustering.py +61 -0
  219. luna_quantum/solve/use_cases/max2sat.py +54 -0
  220. luna_quantum/solve/use_cases/max3sat.py +55 -0
  221. luna_quantum/solve/use_cases/max_clique.py +60 -0
  222. luna_quantum/solve/use_cases/max_cut.py +48 -0
  223. luna_quantum/solve/use_cases/max_independent_set.py +37 -0
  224. luna_quantum/solve/use_cases/minimal_maximal_matching.py +54 -0
  225. luna_quantum/solve/use_cases/minimal_spanning_tree.py +90 -0
  226. luna_quantum/solve/use_cases/minimum_vertex_cover.py +45 -0
  227. luna_quantum/solve/use_cases/number_partitioning.py +32 -0
  228. luna_quantum/solve/use_cases/portfolio_optimization.py +46 -0
  229. luna_quantum/solve/use_cases/portfolio_optimization_ib_tv.py +63 -0
  230. luna_quantum/solve/use_cases/quadratic_assignment.py +49 -0
  231. luna_quantum/solve/use_cases/quadratic_knapsack.py +48 -0
  232. luna_quantum/solve/use_cases/satellite_scheduling.py +73 -0
  233. luna_quantum/solve/use_cases/sensor_placement.py +58 -0
  234. luna_quantum/solve/use_cases/set_cover.py +56 -0
  235. luna_quantum/solve/use_cases/set_packing.py +54 -0
  236. luna_quantum/solve/use_cases/set_partitioning.py +52 -0
  237. luna_quantum/solve/use_cases/subgraph_isomorphism.py +55 -0
  238. luna_quantum/solve/use_cases/subset_sum.py +37 -0
  239. luna_quantum/solve/use_cases/support_vector_machine.py +64 -0
  240. luna_quantum/solve/use_cases/traffic_flow.py +35 -0
  241. luna_quantum/solve/use_cases/travelling_salesman_problem.py +53 -0
  242. luna_quantum/solve/use_cases/type_aliases.py +9 -0
  243. luna_quantum/solve/use_cases/weighted_max_cut.py +37 -0
  244. luna_quantum/solve/usecases/__init__.py +45 -0
  245. luna_quantum/solve/usecases/model_delete_usecase.py +49 -0
  246. luna_quantum/solve/usecases/model_fetch_metadata_usecase.py +50 -0
  247. luna_quantum/solve/usecases/model_get_solution_usecase.py +59 -0
  248. luna_quantum/solve/usecases/model_get_solve_jobs_usecase.py +62 -0
  249. luna_quantum/solve/usecases/model_load_by_id_usecase.py +47 -0
  250. luna_quantum/solve/usecases/model_load_by_metadata_usecase.py +52 -0
  251. luna_quantum/solve/usecases/model_load_metadata_by_hash_usecase.py +51 -0
  252. luna_quantum/solve/usecases/model_save_usecase.py +63 -0
  253. luna_quantum/solve/usecases/solve_job_cancel_usecase.py +51 -0
  254. luna_quantum/solve/usecases/solve_job_create_usecase.py +112 -0
  255. luna_quantum/solve/usecases/solve_job_delete_usecase.py +38 -0
  256. luna_quantum/solve/usecases/solve_job_fetch_updates_usecase.py +49 -0
  257. luna_quantum/solve/usecases/solve_job_get_by_id_usecase.py +44 -0
  258. luna_quantum/solve/usecases/solve_job_get_result_usecase.py +105 -0
  259. luna_quantum/transformations.py +18 -0
  260. luna_quantum/transformations.pyi +371 -0
  261. luna_quantum/translator.py +23 -0
  262. luna_quantum/translator.pyi +869 -0
  263. luna_quantum/util/__init__.py +0 -0
  264. luna_quantum/util/active_waiting.py +79 -0
  265. luna_quantum/util/class_patcher.py +164 -0
  266. luna_quantum/util/debug_info.py +52 -0
  267. luna_quantum/util/log_utils.py +187 -0
  268. luna_quantum/util/pretty_base.py +67 -0
  269. luna_quantum/util/pydantic_utils.py +38 -0
  270. luna_quantum/utils.py +3 -0
  271. luna_quantum/utils.pyi +67 -0
  272. luna_quantum-1.1.0.dist-info/METADATA +36 -0
  273. luna_quantum-1.1.0.dist-info/RECORD +276 -0
  274. luna_quantum-1.1.0.dist-info/WHEEL +4 -0
  275. luna_quantum-1.1.0.dist-info/licenses/LICENSE +176 -0
  276. luna_quantum-1.1.0.dist-info/licenses/NOTICE +13 -0
@@ -0,0 +1,75 @@
1
+ from luna_quantum.solve.domain.abstract import LunaAlgorithm
2
+ from luna_quantum.solve.parameters.backends import DWaveQpu
3
+
4
+
5
+ class LeapHybridCqm(LunaAlgorithm[DWaveQpu]):
6
+ """
7
+ Parameters for D-Wave's Leap Hybrid Constrained Quadratic Model (CQM) solver.
8
+
9
+ The Leap Hybrid CQM solver extends hybrid quantum-classical optimization to handle
10
+ constrained problems, allowing both linear and quadratic constraints alongside
11
+ the quadratic objective function. This enables solving many practical optimization
12
+ problems in their natural formulation without manual penalty conversion.
13
+
14
+ The solver is suitable for mixed binary, integer, and continuous problems with
15
+ thousands of variables and constraints.
16
+
17
+ Attributes
18
+ ----------
19
+ time_limit: float | int | None
20
+ Maximum running time in seconds. Longer limits generally yield better solutions
21
+ but increase resource usage. Default is None, which uses the service's default
22
+ time limit (typically problem-size dependent).
23
+ spin_variables: list[str] | None
24
+ Variables to represent as spins (-1/+1) rather than binary (0/1) values.
25
+ Useful for problems naturally formulated in spin space. Default is None,
26
+ which uses binary representation for all discrete variables.
27
+ """
28
+
29
+ time_limit: float | int | None = None
30
+ spin_variables: list[str] | None = None
31
+
32
+ @property
33
+ def algorithm_name(self) -> str:
34
+ """
35
+ Returns the name of the algorithm.
36
+
37
+ This abstract property method is intended to be overridden by subclasses.
38
+ It should provide the name of the algorithm being implemented.
39
+
40
+ Returns
41
+ -------
42
+ str
43
+ The name of the algorithm.
44
+ """
45
+ return "LCQM"
46
+
47
+ @classmethod
48
+ def get_default_backend(cls) -> DWaveQpu:
49
+ """
50
+ Return the default backend implementation.
51
+
52
+ This property must be implemented by subclasses to provide
53
+ the default backend instance to use when no specific backend
54
+ is specified.
55
+
56
+ Returns
57
+ -------
58
+ IBackend
59
+ An instance of a class implementing the IBackend interface that serves
60
+ as the default backend.
61
+ """
62
+ return DWaveQpu()
63
+
64
+ @classmethod
65
+ def get_compatible_backends(cls) -> tuple[type[DWaveQpu], ...]:
66
+ """
67
+ Check at runtime if the used backend is compatible with the solver.
68
+
69
+ Returns
70
+ -------
71
+ tuple[type[IBackend], ...]
72
+ True if the backend is compatible with the solver, False otherwise.
73
+
74
+ """
75
+ return (DWaveQpu,)
@@ -0,0 +1,139 @@
1
+ from pydantic import Field
2
+
3
+ from luna_quantum.solve.domain.abstract import LunaAlgorithm
4
+ from luna_quantum.solve.parameters.algorithms.base_params import (
5
+ Decomposer,
6
+ QuantumAnnealingParams,
7
+ )
8
+ from luna_quantum.solve.parameters.backends import DWaveQpu
9
+ from luna_quantum.solve.parameters.constants import DEFAULT_ATOL, DEFAULT_RTOL
10
+
11
+
12
+ class ParallelTemperingQpu(
13
+ LunaAlgorithm[DWaveQpu],
14
+ ):
15
+ """
16
+ Parameters for the Parallel Tempering QPU solver.
17
+
18
+ Parallel Tempering uses multiple model procedures per temperature.
19
+ During the cooling process, an exchange of replicas can take place between the
20
+ parallel procedures, thus enabling higher energy mountains to be overcome.
21
+
22
+ Attributes
23
+ ----------
24
+ n_replicas: int
25
+ Number of system replicas to simulate at different temperatures. More replicas
26
+ provide better temperature coverage but increase computational cost.
27
+ Default is 2, which is minimal but can still provide benefits over
28
+ single-temperature methods.
29
+ random_swaps_factor: int
30
+ Factor controlling how frequently random swap attempts occur between replicas.
31
+ Higher values increase mixing between replicas but add overhead.
32
+ Default is 1, balancing mixing with efficiency.
33
+ max_iter: int | None
34
+ Maximum number of iterations. Controls how many rounds of replica exchange
35
+ are performed. Higher values allow more thorough exploration.
36
+ Default is 100.
37
+ max_time: int
38
+ Maximum time in seconds that the algorithm is allowed to run.
39
+ Default is 5.
40
+ convergence: int
41
+ Number of consecutive iterations with no improvement required to consider
42
+ the algorithm converged. Default is 3.
43
+ target: float | None
44
+ Target energy value. If reached, the algorithm will terminate.
45
+ Default is None, meaning no target is set.
46
+ rtol: float
47
+ Relative tolerance for convergence checking. Default is DEFAULT_RTOL.
48
+ atol: float
49
+ Absolute tolerance for convergence checking. Default is DEFAULT_ATOL.
50
+ num_reads: int
51
+ Number of annealing cycles to perform on the D-Wave QPU. Default is 100.
52
+ num_retries: int
53
+ Number of attempts to retry embedding the problem onto the quantum hardware.
54
+ Default is 0.
55
+ fixed_temp_sampler_num_sweeps: int
56
+ Number of Monte Carlo sweeps to perform, where one sweep attempts to update all
57
+ variables once. More sweeps produce better equilibrated samples but increase
58
+ computation time. Default is 10,000, which is suitable for thorough exploration
59
+ of moderate-sized problems.
60
+ fixed_temp_sampler_num_reads: int | None
61
+ Number of independent sampling runs to perform. Each run produces one sample
62
+ from the equilibrium distribution. Multiple reads provide better statistical
63
+ coverage of the solution space. Default is None, which typically defaults to 1
64
+ or matches the number of initial states provided.
65
+ quantum_annealing_params: QuantumAnnealingParams
66
+ Configuration for the quantum annealing process on D-Wave hardware.
67
+ Contains settings for anneal schedule, flux biases, and other QPU-specific
68
+ parameters. See QuantumAnnealingParams documentation for details.
69
+ decomposer: Decomposer
70
+ Decomposer: Breaks down problems into subproblems of manageable size
71
+ Default is a Decomposer instance with default settings.
72
+ """
73
+
74
+ n_replicas: int = 2
75
+ random_swaps_factor: int = 1
76
+ max_iter: int | None = 100
77
+ max_time: int = 5
78
+ convergence: int = 3
79
+ target: float | None = None
80
+ rtol: float = DEFAULT_RTOL
81
+ atol: float = DEFAULT_ATOL
82
+
83
+ num_reads: int = 100
84
+ num_retries: int = 0
85
+
86
+ fixed_temp_sampler_num_sweeps: int = 10_000
87
+ fixed_temp_sampler_num_reads: int | None = None
88
+
89
+ quantum_annealing_params: QuantumAnnealingParams = Field(
90
+ default_factory=QuantumAnnealingParams
91
+ )
92
+
93
+ decomposer: Decomposer = Field(default_factory=Decomposer)
94
+
95
+ # does not support random_swaps_factor variable of parallel tempering parameters
96
+ @property
97
+ def algorithm_name(self) -> str:
98
+ """
99
+ Returns the name of the algorithm.
100
+
101
+ This abstract property method is intended to be overridden by subclasses.
102
+ It should provide the name of the algorithm being implemented.
103
+
104
+ Returns
105
+ -------
106
+ str
107
+ The name of the algorithm.
108
+ """
109
+ return "PTQ"
110
+
111
+ @classmethod
112
+ def get_default_backend(cls) -> DWaveQpu:
113
+ """
114
+ Return the default backend implementation.
115
+
116
+ This property must be implemented by subclasses to provide
117
+ the default backend instance to use when no specific backend
118
+ is specified.
119
+
120
+ Returns
121
+ -------
122
+ IBackend
123
+ An instance of a class implementing the IBackend interface that serves
124
+ as the default backend.
125
+ """
126
+ return DWaveQpu()
127
+
128
+ @classmethod
129
+ def get_compatible_backends(cls) -> tuple[type[DWaveQpu], ...]:
130
+ """
131
+ Check at runtime if the used backend is compatible with the solver.
132
+
133
+ Returns
134
+ -------
135
+ tuple[type[IBackend], ...]
136
+ True if the backend is compatible with the solver, False otherwise.
137
+
138
+ """
139
+ return (DWaveQpu,)
@@ -0,0 +1,109 @@
1
+ from pydantic import Field
2
+
3
+ from luna_quantum.solve.domain.abstract import LunaAlgorithm
4
+ from luna_quantum.solve.parameters.algorithms.base_params import (
5
+ Decomposer,
6
+ QuantumAnnealingParams,
7
+ )
8
+ from luna_quantum.solve.parameters.backends import DWaveQpu
9
+
10
+
11
+ class PopulationAnnealingQpu(LunaAlgorithm[DWaveQpu]):
12
+ """
13
+ Parameters for the Population Annealing QPU algorithm.
14
+
15
+ Population Annealing uses a sequential Monte Carlo method to minimize the energy of
16
+ a population. The population consists of walkers that can explore their
17
+ neighborhood during the cooling process. Afterwards, walkers are removed and
18
+ duplicated using bias to lower energy. Eventually, a population collapse occurs
19
+ where all walkers are in the lowest energy state.
20
+
21
+ Attributes
22
+ ----------
23
+ num_reads: int
24
+ Number of annealing cycles to perform on the D-Wave QPU. Default is 100.
25
+ num_retries: int
26
+ Number of attempts to retry embedding the problem onto the quantum hardware.
27
+ Default is 0.
28
+ max_iter: int
29
+ Maximum number of iterations. Controls how many rounds of annealing and
30
+ population adjustments are performed. Default is 20.
31
+ max_time: int
32
+ Maximum time in seconds that the algorithm is allowed to run. Serves as
33
+ a stopping criterion alongside max_iter. Default is 2.
34
+ fixed_temp_sampler_num_sweeps: int
35
+ Number of Monte Carlo sweeps to perform, where one sweep attempts to update all
36
+ variables once. More sweeps produce better equilibrated samples but increase
37
+ computation time. Default is 10,000, which is suitable for thorough exploration
38
+ of moderate-sized problems.
39
+ fixed_temp_sampler_num_reads: int | None
40
+ Number of independent sampling runs to perform. Each run produces one sample
41
+ from the equilibrium distribution. Multiple reads provide better statistical
42
+ coverage of the solution space. Default is None, which typically defaults to 1
43
+ or matches the number of initial states provided.
44
+ decomposer: Decomposer
45
+ Decomposer: Breaks down problems into subproblems of manageable size
46
+ Default is a Decomposer instance with default settings.
47
+ quantum_annealing_params: QuantumAnnealingParams
48
+ Parameters that control the quantum annealing process, including annealing
49
+ schedule, temperature settings, and other quantum-specific parameters. These
50
+ settings determine how the system transitions from quantum superposition to
51
+ classical states during the optimization process.
52
+ """
53
+
54
+ num_reads: int = 100
55
+ num_retries: int = 0
56
+ max_iter: int = 20
57
+ max_time: int = 2
58
+ fixed_temp_sampler_num_sweeps: int = 10_000
59
+ fixed_temp_sampler_num_reads: int | None = None
60
+ decomposer: Decomposer = Field(default_factory=Decomposer)
61
+
62
+ quantum_annealing_params: QuantumAnnealingParams = Field(
63
+ default_factory=QuantumAnnealingParams
64
+ )
65
+
66
+ @property
67
+ def algorithm_name(self) -> str:
68
+ """
69
+ Returns the name of the algorithm.
70
+
71
+ This abstract property method is intended to be overridden by subclasses.
72
+ It should provide the name of the algorithm being implemented.
73
+
74
+ Returns
75
+ -------
76
+ str
77
+ The name of the algorithm.
78
+ """
79
+ return "PAQ"
80
+
81
+ @classmethod
82
+ def get_default_backend(cls) -> DWaveQpu:
83
+ """
84
+ Return the default backend implementation.
85
+
86
+ This property must be implemented by subclasses to provide
87
+ the default backend instance to use when no specific backend
88
+ is specified.
89
+
90
+ Returns
91
+ -------
92
+ IBackend
93
+ An instance of a class implementing the IBackend interface that serves
94
+ as the default backend.
95
+ """
96
+ return DWaveQpu()
97
+
98
+ @classmethod
99
+ def get_compatible_backends(cls) -> tuple[type[DWaveQpu], ...]:
100
+ """
101
+ Check at runtime if the used backend is compatible with the solver.
102
+
103
+ Returns
104
+ -------
105
+ tuple[type[IBackend], ...]
106
+ True if the backend is compatible with the solver, False otherwise.
107
+
108
+ """
109
+ return (DWaveQpu,)
@@ -0,0 +1,111 @@
1
+ from pydantic import Field
2
+
3
+ from luna_quantum.solve.domain.abstract import LunaAlgorithm
4
+ from luna_quantum.solve.parameters.algorithms.base_params import (
5
+ Decomposer,
6
+ QuantumAnnealingParams,
7
+ )
8
+ from luna_quantum.solve.parameters.backends import DWaveQpu
9
+ from luna_quantum.solve.parameters.mixins.qbsolv_like_mixin import QBSolvLikeMixin
10
+
11
+
12
+ class QBSolvLikeQpu(QBSolvLikeMixin, LunaAlgorithm[DWaveQpu]):
13
+ """
14
+ QBSolv-like algorithm for QPU.
15
+
16
+ QBSolv QPU splits the problem into parts and solves them using the Tabu Search
17
+ algorithm. For this purpose, the DWaveSampler is used.
18
+
19
+ Attributes
20
+ ----------
21
+ decomposer_size: int
22
+ Size for the decomposer. Determines the maximum subproblem size to be sent to
23
+ the quantum processor, with larger values potentially improving solution quality
24
+ at the cost of increased processing time.
25
+ rolling: bool
26
+ Whether to use rolling for the solver. When enabled, this allows for smoother
27
+ transitions between subproblems during the decomposition process.
28
+ rolling_history: float
29
+ Rolling history parameter for the solver. Controls how much previous iteration
30
+ information is considered when solving subsequent subproblems.
31
+ max_iter: int | None
32
+ Maximum number of iterations. Limits the total number of decomposition and
33
+ solving cycles performed by the algorithm.
34
+ max_time: int
35
+ Time in seconds after which the algorithm will stop. Provides a time-based
36
+ stopping criterion regardless of convergence status.
37
+ convergence: int
38
+ Number of iterations with unchanged output to terminate algorithm. Higher values
39
+ ensure more stable solutions but may increase computation time.
40
+ target: float | None
41
+ Energy level that the algorithm tries to reach. If this target energy is
42
+ achieved, the algorithm will terminate early.
43
+ rtol: float
44
+ Relative tolerance for convergence. Used when comparing energy values between
45
+ iterations to determine if convergence has been reached.
46
+ atol: float
47
+ Absolute tolerance for convergence. Used alongside rtol when comparing energy
48
+ values to determine convergence.
49
+ num_reads: int
50
+ Number of reads for the solver.
51
+ num_retries: int
52
+ Number of retries for the solver.
53
+ quantum_annealing_params: QuantumAnnealingParams
54
+ Quantum annealing parameters.
55
+ decomposer: Decomposer
56
+ Decomposer: Breaks down problems into subproblems of manageable size
57
+ Default is a Decomposer instance with default settings.
58
+ """
59
+
60
+ num_reads: int = 100
61
+ num_retries: int = 0
62
+
63
+ quantum_annealing_params: QuantumAnnealingParams = Field(
64
+ default_factory=QuantumAnnealingParams
65
+ )
66
+ decomposer: Decomposer = Field(default_factory=Decomposer)
67
+
68
+ @property
69
+ def algorithm_name(self) -> str:
70
+ """
71
+ Returns the name of the algorithm.
72
+
73
+ This abstract property method is intended to be overridden by subclasses.
74
+ It should provide the name of the algorithm being implemented.
75
+
76
+ Returns
77
+ -------
78
+ str
79
+ The name of the algorithm.
80
+ """
81
+ return "QLQ"
82
+
83
+ @classmethod
84
+ def get_default_backend(cls) -> DWaveQpu:
85
+ """
86
+ Return the default backend implementation.
87
+
88
+ This property must be implemented by subclasses to provide
89
+ the default backend instance to use when no specific backend
90
+ is specified.
91
+
92
+ Returns
93
+ -------
94
+ IBackend
95
+ An instance of a class implementing the IBackend interface that serves
96
+ as the default backend.
97
+ """
98
+ return DWaveQpu()
99
+
100
+ @classmethod
101
+ def get_compatible_backends(cls) -> tuple[type[DWaveQpu], ...]:
102
+ """
103
+ Check at runtime if the used backend is compatible with the solver.
104
+
105
+ Returns
106
+ -------
107
+ tuple[type[IBackend], ...]
108
+ True if the backend is compatible with the solver, False otherwise.
109
+
110
+ """
111
+ return (DWaveQpu,)
@@ -0,0 +1,121 @@
1
+ from luna_quantum.solve.domain.abstract import LunaAlgorithm
2
+ from luna_quantum.solve.parameters.algorithms.base_params import (
3
+ QuantumAnnealingParams,
4
+ )
5
+ from luna_quantum.solve.parameters.backends import DWaveQpu
6
+
7
+
8
+ class QuantumAnnealing(QuantumAnnealingParams, LunaAlgorithm[DWaveQpu]):
9
+ """
10
+ Quantum Annealing algorithm for physical quantum processors (QPUs).
11
+
12
+ Quantum Annealing is a metaheuristic that leverages quantum effects to find the
13
+ ground state of a system, corresponding to the optimal solution of an optimization
14
+ problem.
15
+
16
+ The process starts in a quantum superposition of all possible states, and gradually
17
+ evolves the system according to a time-dependent Hamiltonian, exploiting quantum
18
+ tunneling to potentially escape local minima more effectively than classical
19
+ methods.
20
+
21
+ This implementation is specifically for D-Wave quantum annealers or similar
22
+ hardware.
23
+
24
+ This class inherits all parameters from QuantumAnnealingParams, providing
25
+ a complete set of controls for the quantum annealing process on hardware devices.
26
+
27
+ Attributes
28
+ ----------
29
+ anneal_offsets: list[float] | None
30
+ Per-qubit time offsets for the annealing path in normalized annealing time
31
+ units. List of floats with length equal to the number of qubits. Default is
32
+ None.
33
+ anneal_schedule: list[tuple[float, float]] | None
34
+ Custom schedule for the annealing process as a list of (time, s) pairs.
35
+ Time is in normalized units [0, 1] and s is the annealing parameter [0, 1].
36
+ Default is None.
37
+ annealing_time: float | None
38
+ Duration of the annealing process in microseconds. Must be within the range
39
+ supported by the QPU hardware. Default is None.
40
+ auto_scale: bool | None
41
+ Whether to automatically normalize the problem energy range to use the full
42
+ range of h and J values supported by the hardware. Default is None.
43
+ fast_anneal: bool
44
+ Use accelerated annealing protocol for shorter annealing times. Default is
45
+ False.
46
+ flux_biases: list[float] | None
47
+ Custom flux bias offsets for each qubit in units of Φ₀ (flux quantum).
48
+ List length must equal the number of qubits. Default is None.
49
+ flux_drift_compensation: bool
50
+ Whether to compensate for drift in qubit flux over time using real-time
51
+ calibration data. Default is True.
52
+ h_gain_schedule: list[tuple[float, float]] | None
53
+ Schedule for h-gain during annealing as a list of (time, gain) pairs.
54
+ Time is in normalized units [0, 1]. Default is None.
55
+ initial_state: list[int] | None
56
+ Starting state for the annealing process. List of {-1, +1} values with
57
+ length equal to the number of qubits. Default is None.
58
+ max_answers: int | None
59
+ Maximum number of unique answer states to return. Must be ≤ num_reads.
60
+ Default is None.
61
+ num_reads: int
62
+ Number of annealing cycles to perform. Must be positive integer.
63
+ Default is 1.
64
+ programming_thermalization: float | None
65
+ Wait time after programming the QPU in microseconds to allow the system
66
+ to thermalize. Default is None.
67
+ readout_thermalization: float | None
68
+ Wait time after each anneal before reading results in microseconds.
69
+ Default is None.
70
+ reduce_intersample_correlation: bool
71
+ Whether to add delay between samples to reduce correlation between
72
+ consecutive measurements. Default is False.
73
+ reinitialize_state: bool | None
74
+ Whether to reset to a new initial state between reads to reduce correlation.
75
+ Default is None.
76
+ """
77
+
78
+ @property
79
+ def algorithm_name(self) -> str:
80
+ """
81
+ Returns the name of the algorithm.
82
+
83
+ This abstract property method is intended to be overridden by subclasses.
84
+ It should provide the name of the algorithm being implemented.
85
+
86
+ Returns
87
+ -------
88
+ str
89
+ The name of the algorithm.
90
+ """
91
+ return "QA"
92
+
93
+ @classmethod
94
+ def get_default_backend(cls) -> DWaveQpu:
95
+ """
96
+ Return the default backend implementation.
97
+
98
+ This property must be implemented by subclasses to provide
99
+ the default backend instance to use when no specific backend
100
+ is specified.
101
+
102
+ Returns
103
+ -------
104
+ IBackend
105
+ An instance of a class implementing the IBackend interface that serves
106
+ as the default backend.
107
+ """
108
+ return DWaveQpu()
109
+
110
+ @classmethod
111
+ def get_compatible_backends(cls) -> tuple[type[DWaveQpu], ...]:
112
+ """
113
+ Check at runtime if the used backend is compatible with the solver.
114
+
115
+ Returns
116
+ -------
117
+ tuple[type[IBackend], ...]
118
+ True if the backend is compatible with the solver, False otherwise.
119
+
120
+ """
121
+ return (DWaveQpu,)