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,11 @@
1
+ from enum import Enum
2
+
3
+
4
+ class ModelFormat(str, Enum):
5
+ """Enumeration of all supported formats."""
6
+
7
+ AQ_MODEL = "AQ_MODEL"
8
+ LP = "LP"
9
+ QUBO = "QUBO_MATRIX"
10
+ CQM = "CQM"
11
+ BQM = "BQM"
@@ -0,0 +1,50 @@
1
+ from enum import Enum
2
+
3
+
4
+ class UseCaseEnum(str, Enum):
5
+ """Use case enum."""
6
+
7
+ AEB = "AEB"
8
+ ANB = "ANB"
9
+ BIP = "BIP"
10
+ BPSP = "BPSP"
11
+ CSFS = "CSFS"
12
+ DPO = "DPO"
13
+ EC = "EC"
14
+ FGO = "FGO"
15
+ GC = "GC"
16
+ GI = "GI"
17
+ GP = "GP"
18
+ HC = "HC"
19
+ ISGI = "ISGI"
20
+ JSS = "JSS"
21
+ KMC = "KMC"
22
+ KIW = "KIW"
23
+ LR = "LR"
24
+ LMWCS = "LMWCS"
25
+ LP = "LP"
26
+ MGC = "MGC"
27
+ M2SAT = "M2SAT"
28
+ M3SAT = "M3SAT"
29
+ MCQ = "MCQ"
30
+ MC = "MC"
31
+ MIS = "MIS"
32
+ MMM = "MMM"
33
+ MST = "MST"
34
+ MVC = "MVC"
35
+ NP = "NP"
36
+ PO = "PO"
37
+ POIBTV = "POIBTV"
38
+ QA = "QA"
39
+ QK = "QK"
40
+ SSC = "SSC"
41
+ SPL = "SPL"
42
+ SC = "SC"
43
+ SP = "SP"
44
+ SPP = "SPP"
45
+ SGI = "SGI"
46
+ SSP = "SSP"
47
+ SVM = "SVM"
48
+ TFO = "TFO"
49
+ TSP = "TSP"
50
+ WMC = "WMC"
@@ -0,0 +1,20 @@
1
+ from enum import Enum
2
+
3
+
4
+ class QpuTokenTypeEnum(str, Enum):
5
+ """
6
+ Enumeration of possible types for QPU tokens.
7
+
8
+ This enum defines the scope or ownership category of QPU tokens.
9
+
10
+ Attributes
11
+ ----------
12
+ GROUP : str
13
+ Indicates that the QPU token is shared among a group of users.
14
+
15
+ PERSONAL : str
16
+ Indicates that the QPU token belongs to an individual user.
17
+ """
18
+
19
+ GROUP = "group"
20
+ PERSONAL = "personal"
@@ -0,0 +1,8 @@
1
+ from enum import Enum
2
+
3
+
4
+ class SenseEnum(str, Enum):
5
+ """Optimization Sense."""
6
+
7
+ MAX = "max"
8
+ MIN = "min"
@@ -0,0 +1,40 @@
1
+ from enum import Enum
2
+
3
+
4
+ class StatusEnum(str, Enum):
5
+ """
6
+ Enumeration of possible status states for a solve job.
7
+
8
+ This enum defines the standard lifecycle states of a solve job.
9
+
10
+ Enum Values
11
+ -----------
12
+ REQUESTED
13
+ The job has been requested but not yet initialized by the system.
14
+ This is the initial state when a job is submitted.
15
+
16
+ CREATED
17
+ The job has been created and initialized in the system, but execution
18
+ has not yet begun.
19
+
20
+ IN_PROGRESS
21
+ The job is currently being executed. Processing has started but
22
+ is not yet complete.
23
+
24
+ DONE
25
+ The job has completed successfully with a valid result.
26
+
27
+ FAILED
28
+ The solve job has terminated abnormally or
29
+ encountered an error during execution.
30
+
31
+ CANCELED
32
+ The job was explicitly canceled by a user before completion.
33
+ """
34
+
35
+ REQUESTED = "REQUESTED"
36
+ CREATED = "CREATED"
37
+ IN_PROGRESS = "IN_PROGRESS"
38
+ DONE = "DONE"
39
+ FAILED = "FAILED"
40
+ CANCELED = "CANCELED"
@@ -0,0 +1,11 @@
1
+ from enum import Enum
2
+
3
+
4
+ class TimeframeEnum(str, Enum):
5
+ """Enum class for query filter timeframes."""
6
+
7
+ today = "today"
8
+ this_week = "last_week"
9
+ this_month = "last_month"
10
+ this_year = "last_year"
11
+ all_time = "all_time"
@@ -0,0 +1,14 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class ErrorMessage(BaseModel):
5
+ """
6
+ Error message model.
7
+
8
+ If an error occurs, this model is used to return error messages
9
+ to the client. It contains the internal code and the message that describes
10
+ the error.
11
+ """
12
+
13
+ internal_code: str
14
+ message: str
@@ -0,0 +1,35 @@
1
+ from pydantic import BaseModel
2
+
3
+ from luna_quantum.client.schemas.wrappers import PydanticDatetimeWrapper
4
+
5
+
6
+ class ModelMetadataSchema(BaseModel):
7
+ """
8
+ Model metadata schema.
9
+
10
+ Attributes
11
+ ----------
12
+ id: str
13
+ Unique identifier for the model.
14
+
15
+ created_date: PydanticDatetimeWrapper
16
+ The timestamp when the model was initially created.
17
+
18
+ created_by: str
19
+ Identifier of the user that created the model.
20
+
21
+ modified_date: PydanticDatetimeWrapper | None
22
+ The timestamp when the model was last modified.
23
+ None if the model has never been modified after creation.
24
+
25
+ modified_by: str | None
26
+ Identifierof the user that last modified the model.
27
+ None if the model has never been modified after creation.
28
+ """
29
+
30
+ id: str
31
+ created_date: PydanticDatetimeWrapper
32
+ created_by: str
33
+
34
+ modified_date: PydanticDatetimeWrapper | None = None
35
+ modified_by: str | None = None
File without changes
@@ -0,0 +1,154 @@
1
+ from __future__ import annotations
2
+
3
+ from enum import Enum
4
+
5
+ from pydantic import BaseModel, ConfigDict, Field
6
+
7
+ from luna_quantum.client.schemas.enums.qpu_token_type import (
8
+ QpuTokenTypeEnum,
9
+ )
10
+
11
+
12
+ class QpuTokenSource(str, Enum):
13
+ """
14
+ Enumeration of possible sources for QPU tokens.
15
+
16
+ This enum defines the different strategies for providing or retrieving
17
+ QPU tokens.
18
+ """
19
+
20
+ # token currently passed in from the API call
21
+ INLINE = "inline"
22
+ # stored token in user account
23
+ PERSONAL = "personal"
24
+ # stored token in group account
25
+ GROUP = "group"
26
+
27
+
28
+ class QpuToken(BaseModel):
29
+ """
30
+ Schema for QPU token.
31
+
32
+ Attributes
33
+ ----------
34
+ source: QpuTokenSource
35
+ Specifies the source location of the QPU token, determining how the
36
+ token is retrieved.
37
+ name: str | None
38
+ The identifier name of the stored QPU token. Required when
39
+ source is QpuTokenSource.PERSONAL or QpuTokenSource.GROUP.
40
+ token: str | None
41
+ The actual QPU token value to be used for authentication.
42
+ Required when source is QpuTokenSource.INLINE.
43
+ """
44
+
45
+ source: QpuTokenSource
46
+ # A unique name for a stored token
47
+ name: str | None = None
48
+ # This could be a QPU token, an API key or any token key for a QPU provider.
49
+ # If the token is not passed from this API call, one stored in the user's
50
+ # account will be used.
51
+ token: str | None = None
52
+
53
+
54
+ class PersonalQpuToken(QpuToken):
55
+ """
56
+ Schema for stored personal qpu token.
57
+
58
+ Attributes
59
+ ----------
60
+ name: str
61
+ Name of qpu token.
62
+ source: QpuTokenSource
63
+ Source of the qpu token.
64
+ In this case should be always set to QpuTokenSource.PERSONAL
65
+ """
66
+
67
+ name: str
68
+ source: QpuTokenSource = Field(
69
+ init=False, default=QpuTokenSource.PERSONAL, frozen=True
70
+ )
71
+
72
+
73
+ class GroupQpuToken(QpuToken):
74
+ """
75
+ Schema for stored group qpu token.
76
+
77
+ Attributes
78
+ ----------
79
+ name: str
80
+ Name of qpu token.
81
+ source: QpuTokenSource
82
+ Source of the qpu token.
83
+ In this case should be always set to QpuTokenSource.GROUP
84
+ """
85
+
86
+ name: str
87
+ source: QpuTokenSource = Field(
88
+ init=False, default=QpuTokenSource.GROUP, frozen=True
89
+ )
90
+
91
+
92
+ class TokenProvider(BaseModel):
93
+ """
94
+ Schema for QPU tokens.
95
+
96
+ Attributes
97
+ ----------
98
+ dwave: QpuToken | None
99
+ Authentication token for D-Wave quantum computing services.
100
+ None if no D-Wave token is provided.
101
+
102
+ ibm: QpuToken | None
103
+ Authentication token for IBM Quantum services.
104
+ None if no IBM token is provided.
105
+
106
+ fujitsu: QpuToken | None
107
+ Authentication token for Fujitsu quantum computing services.
108
+ None if no Fujitsu token is provided.
109
+
110
+ qctrl: QpuToken | None
111
+ Authentication token for Q-CTRL quantum computing services.
112
+ None if no Q-CTRL token is provided.
113
+
114
+ aws_access_key: QpuToken
115
+ The AWS access key ID token used to identify the AWS account.
116
+
117
+ aws_secret_access_key: _RestQpuToken
118
+ The AWS secret access key token used to verify the identity.
119
+
120
+ aws_session_token: _RestQpuToken
121
+ The AWS session token.
122
+ """
123
+
124
+ dwave: QpuToken | None = None
125
+ ibm: QpuToken | None = None
126
+ fujitsu: QpuToken | None = None
127
+ qctrl: QpuToken | None = None
128
+ aws_access_key: QpuToken | None = None
129
+ aws_secret_access_key: QpuToken | None = None
130
+ aws_session_token: QpuToken | None = None
131
+
132
+ model_config = ConfigDict(extra="forbid")
133
+
134
+
135
+ class QpuTokenOut(BaseModel):
136
+ """
137
+ pydantic model for qpu token out.
138
+
139
+ it contains the data received from the api call.
140
+
141
+ Attributes
142
+ ----------
143
+ name: optional[str]
144
+ name of the qpu token.
145
+ provider: str
146
+ name of provider.
147
+
148
+ """
149
+
150
+ name: str
151
+ provider: str
152
+ token_type: QpuTokenTypeEnum
153
+
154
+ model_config = ConfigDict(extra="forbid", from_attributes=True)
@@ -0,0 +1,19 @@
1
+ from enum import Enum
2
+
3
+
4
+ class _RESTQpuTokenSource(str, Enum):
5
+ """_RESTQpuTokenSource.
6
+
7
+ This schema allow us not to change entire backend,
8
+ but just sync SDK and everything else in terms of qpu token source.
9
+ Currently, the difference is that
10
+ SDK has group qpu token source
11
+ and backend has organization qpu token source which are mapped to each other.
12
+ """
13
+
14
+ # token currently passed in from the API call (not stored by us)
15
+ INLINE = "inline"
16
+ # stored token in user account
17
+ PERSONAL = "personal"
18
+ # stored token in group account
19
+ ORGANIZATION = "organization"
@@ -0,0 +1,30 @@
1
+ from pydantic import BaseModel
2
+
3
+ from luna_quantum.client.schemas.wrappers.datetime_wrapper import (
4
+ PydanticDatetimeWrapper,
5
+ )
6
+
7
+
8
+ class QpuTokenTimeQuotaOut(BaseModel):
9
+ """
10
+ Pydantic model for QPU token time quota OUT.
11
+
12
+ It contains the data received from the API call.
13
+
14
+ Attributes
15
+ ----------
16
+ quota: int
17
+ The total amount of quota available on a qpu token.
18
+ start: datetime
19
+ Effective start date of the time quota policy.
20
+ end: datetime
21
+ Effective end date of the time quota policy.
22
+ quota_used: int
23
+ How much quota has already been used from
24
+ the totally available amount of quota.
25
+ """
26
+
27
+ quota: int
28
+ start: PydanticDatetimeWrapper
29
+ end: PydanticDatetimeWrapper
30
+ quota_used: int
@@ -0,0 +1,132 @@
1
+ from __future__ import annotations
2
+
3
+ from pydantic import BaseModel, ConfigDict
4
+
5
+ from luna_quantum.client.schemas.qpu_token.qpu_token import (
6
+ QpuToken,
7
+ QpuTokenSource,
8
+ TokenProvider,
9
+ )
10
+ from luna_quantum.client.schemas.qpu_token.qpu_token_source import _RESTQpuTokenSource
11
+
12
+
13
+ class _RestQpuToken(BaseModel):
14
+ source: _RESTQpuTokenSource
15
+ # A unique name for a stored token
16
+ name: str | None = None
17
+ # This could be a QPU token, an API key or any token key for a QPU provider.
18
+ # If the token is not passed from this API call, one stored in the user's
19
+ # account will be used.
20
+ token: str | None = None
21
+
22
+ @classmethod
23
+ def from_qpu_token(cls, qpu_token: QpuToken | None) -> _RestQpuToken | None:
24
+ if qpu_token is None:
25
+ return None
26
+ # Organizational tokens were renamed to group in #1851
27
+ # For smoother transition we only change naming in the SDK,
28
+ # and therefore we need a mapping between Group and Organization here.
29
+ # However, in backend for now QPU tokens still has source organization
30
+ # TODO: Remove it when backend I/O schema is changed # noqa: FIX002, TD002
31
+ if qpu_token.source == QpuTokenSource.GROUP:
32
+ return cls(
33
+ source=_RESTQpuTokenSource.ORGANIZATION,
34
+ name=qpu_token.name,
35
+ token=qpu_token.token,
36
+ )
37
+ return cls.model_validate(qpu_token, from_attributes=True)
38
+
39
+
40
+ class AWSQpuTokens(BaseModel):
41
+ """
42
+ Container for AWS authentication tokens.
43
+
44
+ Attributes
45
+ ----------
46
+ aws_access_key: _RestQpuToken
47
+ The AWS access key ID token used to identify the AWS account.
48
+
49
+ aws_secret_access_key: _RestQpuToken
50
+ The AWS secret access key token used to verify the identity.
51
+
52
+ aws_session_token: _RestQpuToken
53
+ The AWS secret access key token used to verify the identity.
54
+ """
55
+
56
+ aws_access_key: _RestQpuToken
57
+ aws_secret_access_key: _RestQpuToken
58
+ aws_session_token: _RestQpuToken
59
+
60
+
61
+ class RestAPITokenProvider(BaseModel):
62
+ """
63
+ Internal schema for QPU tokens.
64
+
65
+ Attributes
66
+ ----------
67
+ dwave: _RestQpuToken | None
68
+ Authentication token for D-Wave quantum computing services.
69
+ None if no D-Wave token is provided.
70
+
71
+ ibm: _RestQpuToken | None
72
+ Authentication token for IBM Quantum services.
73
+ None if no IBM token is provided.
74
+
75
+ fujitsu: _RestQpuToken | None
76
+ Authentication token for Fujitsu quantum computing services.
77
+ None if no Fujitsu token is provided.
78
+
79
+ qctrl: _RestQpuToken | None
80
+ Authentication token for Q-CTRL quantum computing services.
81
+ None if no Q-CTRL token is provided.
82
+
83
+ aws: AWSQpuTokens | None
84
+ Authentication tokens for AWS quantum computing services.
85
+ Uses a specialized structure for AWS authentication.
86
+ None if no AWS tokens are provided.
87
+ """
88
+
89
+ dwave: _RestQpuToken | None = None
90
+ ibm: _RestQpuToken | None = None
91
+ fujitsu: _RestQpuToken | None = None
92
+ qctrl: _RestQpuToken | None = None
93
+ aws: AWSQpuTokens | None = None
94
+
95
+ model_config = ConfigDict(extra="forbid")
96
+
97
+ @classmethod
98
+ def from_sdk_token_provider(
99
+ cls, token_provider: TokenProvider
100
+ ) -> RestAPITokenProvider:
101
+ """
102
+ Create RestAPITokenProvider from TokenProvider.
103
+
104
+ Parameters
105
+ ----------
106
+ token_provider: TokenProvider
107
+ TokenProvider datastructure containing QPU tokens.
108
+ """
109
+ aws: AWSQpuTokens | None = None
110
+ if (
111
+ token_provider.aws_access_key is not None
112
+ or token_provider.aws_secret_access_key is not None
113
+ or token_provider.aws_session_token is not None
114
+ ):
115
+ aws = AWSQpuTokens(
116
+ aws_access_key=_RestQpuToken.from_qpu_token( # type: ignore[arg-type]
117
+ token_provider.aws_access_key
118
+ ),
119
+ aws_secret_access_key=_RestQpuToken.from_qpu_token( # type: ignore[arg-type]
120
+ token_provider.aws_secret_access_key
121
+ ),
122
+ aws_session_token=_RestQpuToken.from_qpu_token( # type: ignore[arg-type]
123
+ token_provider.aws_session_token
124
+ ),
125
+ )
126
+ return cls(
127
+ dwave=_RestQpuToken.from_qpu_token(token_provider.dwave),
128
+ ibm=_RestQpuToken.from_qpu_token(token_provider.ibm),
129
+ fujitsu=_RestQpuToken.from_qpu_token(token_provider.fujitsu),
130
+ qctrl=_RestQpuToken.from_qpu_token(token_provider.qctrl),
131
+ aws=aws,
132
+ )
@@ -0,0 +1,19 @@
1
+ from typing import Any
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class Representation(BaseModel):
7
+ """
8
+ Pydantic model for representation of a solution sample.
9
+
10
+ Attributes
11
+ ----------
12
+ description: str
13
+ Description of the representation
14
+ solution: Any
15
+ matrix of the solution representation
16
+ """
17
+
18
+ description: str
19
+ solution: Any
@@ -0,0 +1,106 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from pydantic import BaseModel
6
+
7
+ from luna_quantum.util.pretty_base import PrettyBase
8
+
9
+ Numeric = float | int
10
+ Sample = dict[str, Numeric]
11
+
12
+
13
+ class Runtime(BaseModel):
14
+ """
15
+ Pydantic model for runtime of a solution.
16
+
17
+ Attributes
18
+ ----------
19
+ total: float
20
+ Total time of solution processing
21
+ qpu: Optional[float]
22
+ Total time of the quantum computing processes
23
+ """
24
+
25
+ total: float
26
+ qpu: float | None
27
+ # ...
28
+
29
+
30
+ class ConstraintResult(BaseModel):
31
+ """
32
+ Represents the evaluation result of a constraint in an optimization.
33
+
34
+ Attributes
35
+ ----------
36
+ satisfied: bool
37
+ Indicates whether the constraint is satisfied by the solution.
38
+ extra: dict[str, Any] | None
39
+ Additional information related to the constraint evaluation.
40
+ """
41
+
42
+ satisfied: bool
43
+ extra: dict[str, Any] | None
44
+
45
+
46
+ class Result(PrettyBase):
47
+ """
48
+ A single result of a solution.
49
+
50
+ Attributes
51
+ ----------
52
+ sample: List[List[bool]]
53
+ Binary solutions vectors
54
+ energies: List[float]
55
+ Energy corresponding to binary solution vector
56
+ solver: str
57
+ Solver's name
58
+ params: Dict
59
+ Solver params
60
+ runtime: Runtime
61
+ Solution runtime information
62
+ metadata: Optional[Dict]
63
+ Solution's metadata
64
+ """
65
+
66
+ sample: Sample
67
+ obj_value: float
68
+ feasible: bool
69
+ constraints: dict[str, ConstraintResult]
70
+
71
+
72
+ class UseCaseResult(BaseModel):
73
+ """
74
+ Represents the result of an optimization use case solution.
75
+
76
+ This class stores the outcome of solving an optimization problem,
77
+ containing both the solution representation and its objective value.
78
+
79
+ Attributes
80
+ ----------
81
+ representation: Any
82
+ The representation of the solution, which could be in various forms
83
+ depending on the optimization problem.
84
+ obj_value: float
85
+ The objective function value achieved by this solution.
86
+ """
87
+
88
+ representation: Any
89
+ obj_value: float | None
90
+
91
+
92
+ class UseCaseRepresentation(PrettyBase):
93
+ """
94
+ Representation of an optimization problem use case.
95
+
96
+ Attributes
97
+ ----------
98
+ results: list[UseCaseResult]
99
+ A collection of results obtained from solving this
100
+ optimization use case.
101
+ description: str
102
+ A human-readable description of the optimization use case.
103
+ """
104
+
105
+ results: list[UseCaseResult]
106
+ description: str