luna-quantum 1.0.8rc2__cp314-cp314-manylinux_2_34_x86_64.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.
Potentially problematic release.
This version of luna-quantum might be problematic. Click here for more details.
- luna_quantum/__init__.py +121 -0
- luna_quantum/__init__.pyi +85 -0
- luna_quantum/_core.cpython-314-x86_64-linux-gnu.so +0 -0
- luna_quantum/_core.pyi +4185 -0
- luna_quantum/algorithms/__init__.py +1 -0
- luna_quantum/aqm_overwrites/__init__.py +3 -0
- luna_quantum/aqm_overwrites/model.py +184 -0
- luna_quantum/backends/__init__.py +1 -0
- luna_quantum/client/__init__.py +0 -0
- luna_quantum/client/controllers/__init__.py +4 -0
- luna_quantum/client/controllers/luna_http_client.py +37 -0
- luna_quantum/client/controllers/luna_platform_client.py +256 -0
- luna_quantum/client/controllers/luna_q.py +67 -0
- luna_quantum/client/controllers/luna_solve.py +129 -0
- luna_quantum/client/error/__init__.py +0 -0
- luna_quantum/client/error/luna_api_key_invalid_error.py +10 -0
- luna_quantum/client/error/luna_api_key_missing_error.py +10 -0
- luna_quantum/client/error/luna_error.py +2 -0
- luna_quantum/client/error/luna_server_error.py +20 -0
- luna_quantum/client/error/timeout_error.py +12 -0
- luna_quantum/client/error/transformation_error.py +18 -0
- luna_quantum/client/error/utils/__init__.py +0 -0
- luna_quantum/client/error/utils/http_error_utils.py +112 -0
- luna_quantum/client/interfaces/__init__.py +4 -0
- luna_quantum/client/interfaces/clients/__init__.py +25 -0
- luna_quantum/client/interfaces/clients/circuit_rest_client_i.py +68 -0
- luna_quantum/client/interfaces/clients/info_rest_client_i.py +53 -0
- luna_quantum/client/interfaces/clients/model_rest_client_i.py +139 -0
- luna_quantum/client/interfaces/clients/qpu_token_rest_client_i.py +364 -0
- luna_quantum/client/interfaces/clients/rest_client_i.py +21 -0
- luna_quantum/client/interfaces/clients/solve_job_rest_client_i.py +201 -0
- luna_quantum/client/interfaces/clients/users_rest_client_i.py +29 -0
- luna_quantum/client/interfaces/services/__init__.py +0 -0
- luna_quantum/client/interfaces/services/luna_q_i.py +34 -0
- luna_quantum/client/interfaces/services/luna_solve_i.py +72 -0
- luna_quantum/client/interfaces/services/service_i.py +56 -0
- luna_quantum/client/rest_client/__init__.py +15 -0
- luna_quantum/client/rest_client/circuit_rest_client.py +107 -0
- luna_quantum/client/rest_client/info_rest_client.py +74 -0
- luna_quantum/client/rest_client/model_rest_client.py +216 -0
- luna_quantum/client/rest_client/qpu_token_rest_client.py +508 -0
- luna_quantum/client/rest_client/solve_job_rest_client.py +286 -0
- luna_quantum/client/rest_client/users_rest_client.py +35 -0
- luna_quantum/client/schemas/__init__.py +26 -0
- luna_quantum/client/schemas/circuit.py +48 -0
- luna_quantum/client/schemas/create/__init__.py +15 -0
- luna_quantum/client/schemas/create/circuit.py +30 -0
- luna_quantum/client/schemas/create/optimization.py +39 -0
- luna_quantum/client/schemas/create/qpu_token.py +22 -0
- luna_quantum/client/schemas/create/qpu_token_time_quota.py +35 -0
- luna_quantum/client/schemas/create/qpu_token_time_quota_update.py +24 -0
- luna_quantum/client/schemas/create/qubo.py +19 -0
- luna_quantum/client/schemas/create/solve_job_create.py +43 -0
- luna_quantum/client/schemas/enums/__init__.py +0 -0
- luna_quantum/client/schemas/enums/call_style.py +13 -0
- luna_quantum/client/schemas/enums/circuit.py +42 -0
- luna_quantum/client/schemas/enums/model_format.py +11 -0
- luna_quantum/client/schemas/enums/problem.py +50 -0
- luna_quantum/client/schemas/enums/qpu_token_type.py +20 -0
- luna_quantum/client/schemas/enums/sense.py +8 -0
- luna_quantum/client/schemas/enums/status.py +40 -0
- luna_quantum/client/schemas/enums/timeframe.py +11 -0
- luna_quantum/client/schemas/error_message.py +14 -0
- luna_quantum/client/schemas/model_metadata.py +35 -0
- luna_quantum/client/schemas/qpu_token/__init__.py +0 -0
- luna_quantum/client/schemas/qpu_token/qpu_token.py +154 -0
- luna_quantum/client/schemas/qpu_token/qpu_token_source.py +19 -0
- luna_quantum/client/schemas/qpu_token/qpu_token_time_quota.py +30 -0
- luna_quantum/client/schemas/qpu_token/token_provider.py +132 -0
- luna_quantum/client/schemas/representation.py +19 -0
- luna_quantum/client/schemas/solution.py +106 -0
- luna_quantum/client/schemas/solve_job.py +50 -0
- luna_quantum/client/schemas/solver_info.py +11 -0
- luna_quantum/client/schemas/user.py +11 -0
- luna_quantum/client/schemas/wrappers/__init__.py +5 -0
- luna_quantum/client/schemas/wrappers/datetime_wrapper.py +32 -0
- luna_quantum/client/utils/__init__.py +0 -0
- luna_quantum/client/utils/qpu_token_utils.py +147 -0
- luna_quantum/config.py +11 -0
- luna_quantum/decorators.py +248 -0
- luna_quantum/errors.py +34 -0
- luna_quantum/errors.pyi +287 -0
- luna_quantum/exceptions/__init__.py +0 -0
- luna_quantum/exceptions/base_luna_quantum_error.py +2 -0
- luna_quantum/exceptions/patch_class_field_exists_error.py +10 -0
- luna_quantum/factories/__init__.py +4 -0
- luna_quantum/factories/luna_solve_client_factory.py +100 -0
- luna_quantum/factories/usecase_factory.py +457 -0
- luna_quantum/py.typed +0 -0
- luna_quantum/solve/__init__.py +13 -0
- luna_quantum/solve/default_token.py +304 -0
- luna_quantum/solve/domain/__init__.py +0 -0
- luna_quantum/solve/domain/abstract/__init__.py +4 -0
- luna_quantum/solve/domain/abstract/luna_algorithm.py +205 -0
- luna_quantum/solve/domain/abstract/qpu_token_backend.py +34 -0
- luna_quantum/solve/domain/model_metadata.py +56 -0
- luna_quantum/solve/domain/solve_job.py +196 -0
- luna_quantum/solve/errors/__init__.py +0 -0
- luna_quantum/solve/errors/incompatible_backend_error.py +15 -0
- luna_quantum/solve/errors/model_metadata_missing_error.py +11 -0
- luna_quantum/solve/errors/solve_base_error.py +5 -0
- luna_quantum/solve/errors/token_missing_error.py +11 -0
- luna_quantum/solve/interfaces/__init__.py +0 -0
- luna_quantum/solve/interfaces/algorithm_i.py +49 -0
- luna_quantum/solve/interfaces/backend_i.py +28 -0
- luna_quantum/solve/interfaces/usecases/__init__.py +55 -0
- luna_quantum/solve/interfaces/usecases/model_delete_usecase_i.py +27 -0
- luna_quantum/solve/interfaces/usecases/model_fetch_metadata_usecase_i.py +33 -0
- luna_quantum/solve/interfaces/usecases/model_get_solutions_usecase_i.py +33 -0
- luna_quantum/solve/interfaces/usecases/model_get_solve_jobs_usecase_i.py +33 -0
- luna_quantum/solve/interfaces/usecases/model_load_by_id_usecase_i.py +32 -0
- luna_quantum/solve/interfaces/usecases/model_load_by_metadata_usecase_i.py +37 -0
- luna_quantum/solve/interfaces/usecases/model_load_metadata_by_hash_usecase_i.py +38 -0
- luna_quantum/solve/interfaces/usecases/model_save_usecase_i.py +36 -0
- luna_quantum/solve/interfaces/usecases/solve_job_cancel_usecase_i.py +33 -0
- luna_quantum/solve/interfaces/usecases/solve_job_create_usecase_i.py +44 -0
- luna_quantum/solve/interfaces/usecases/solve_job_delete_usecase_i.py +32 -0
- luna_quantum/solve/interfaces/usecases/solve_job_fetch_updates_usecase_i.py +38 -0
- luna_quantum/solve/interfaces/usecases/solve_job_get_result_usecase_i.py +63 -0
- luna_quantum/solve/parameters/__init__.py +0 -0
- luna_quantum/solve/parameters/algorithms/__init__.py +51 -0
- luna_quantum/solve/parameters/algorithms/base_params/__init__.py +24 -0
- luna_quantum/solve/parameters/algorithms/base_params/decomposer.py +57 -0
- luna_quantum/solve/parameters/algorithms/base_params/qaoa_circuit_params.py +95 -0
- luna_quantum/solve/parameters/algorithms/base_params/quantum_annealing_params.py +79 -0
- luna_quantum/solve/parameters/algorithms/base_params/scipy_optimizer.py +122 -0
- luna_quantum/solve/parameters/algorithms/base_params/simulated_annealing_params.py +106 -0
- luna_quantum/solve/parameters/algorithms/base_params/tabu_kerberos_params.py +39 -0
- luna_quantum/solve/parameters/algorithms/base_params/tabu_search_params.py +129 -0
- luna_quantum/solve/parameters/algorithms/flexible_parameter_algorithm.py +59 -0
- luna_quantum/solve/parameters/algorithms/genetic_algorithms/__init__.py +4 -0
- luna_quantum/solve/parameters/algorithms/genetic_algorithms/qaga.py +131 -0
- luna_quantum/solve/parameters/algorithms/genetic_algorithms/saga.py +139 -0
- luna_quantum/solve/parameters/algorithms/lq_fda/__init__.py +3 -0
- luna_quantum/solve/parameters/algorithms/lq_fda/fujits_da_base.py +85 -0
- luna_quantum/solve/parameters/algorithms/lq_fda/fujitsu_da_v3c.py +155 -0
- luna_quantum/solve/parameters/algorithms/optimization_solvers/__init__.py +3 -0
- luna_quantum/solve/parameters/algorithms/optimization_solvers/scip.py +51 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/__init__.py +19 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/kerberos.py +149 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/leap_hybrid_bqm.py +75 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/leap_hybrid_cqm.py +75 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/parallel_tempering_qpu.py +139 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/population_annealing_qpu.py +109 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/qbsolv_like_qpu.py +111 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/quantum_annealing.py +121 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/repeated_reverse_quantum_annealing.py +174 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/__init__.py +6 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flex_qaoa/__init__.py +26 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flex_qaoa/config.py +80 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flex_qaoa/flex_qaoa.py +226 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flex_qaoa/optimizers.py +99 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flex_qaoa/pipeline.py +87 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/qaoa.py +102 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/qaoa_fo.py +69 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/vqe.py +108 -0
- luna_quantum/solve/parameters/algorithms/search_algorithms/__init__.py +5 -0
- luna_quantum/solve/parameters/algorithms/search_algorithms/dialectic_search.py +136 -0
- luna_quantum/solve/parameters/algorithms/search_algorithms/qbsolv_like_tabu_search.py +117 -0
- luna_quantum/solve/parameters/algorithms/search_algorithms/tabu_search.py +126 -0
- luna_quantum/solve/parameters/algorithms/simulated_annealing/__init__.py +13 -0
- luna_quantum/solve/parameters/algorithms/simulated_annealing/parallel_tempering.py +131 -0
- luna_quantum/solve/parameters/algorithms/simulated_annealing/population_annealing.py +95 -0
- luna_quantum/solve/parameters/algorithms/simulated_annealing/qbsolv_like_simulated_annealing.py +141 -0
- luna_quantum/solve/parameters/algorithms/simulated_annealing/repeated_reverse_simulated_annealing.py +172 -0
- luna_quantum/solve/parameters/algorithms/simulated_annealing/simulated_annealing.py +126 -0
- luna_quantum/solve/parameters/backends/__init__.py +22 -0
- luna_quantum/solve/parameters/backends/aqarios.py +17 -0
- luna_quantum/solve/parameters/backends/aws/__init__.py +11 -0
- luna_quantum/solve/parameters/backends/aws/aws.py +36 -0
- luna_quantum/solve/parameters/backends/aws/aws_backend_base.py +74 -0
- luna_quantum/solve/parameters/backends/aws/ionq.py +43 -0
- luna_quantum/solve/parameters/backends/aws/iqm.py +31 -0
- luna_quantum/solve/parameters/backends/aws/rigetti.py +31 -0
- luna_quantum/solve/parameters/backends/dwave.py +17 -0
- luna_quantum/solve/parameters/backends/dwave_qpu.py +166 -0
- luna_quantum/solve/parameters/backends/fda.py +17 -0
- luna_quantum/solve/parameters/backends/ibm.py +138 -0
- luna_quantum/solve/parameters/backends/qctrl.py +103 -0
- luna_quantum/solve/parameters/backends/zib.py +17 -0
- luna_quantum/solve/parameters/constants.py +11 -0
- luna_quantum/solve/parameters/mixins/__init__.py +0 -0
- luna_quantum/solve/parameters/mixins/fujitsu_common_params_mixin.py +239 -0
- luna_quantum/solve/parameters/mixins/fujitsu_v2_mixin.py +70 -0
- luna_quantum/solve/parameters/mixins/qbsolv_like_mixin.py +60 -0
- luna_quantum/solve/use_cases/__init__.py +119 -0
- luna_quantum/solve/use_cases/arbitrage_edge_based.py +50 -0
- luna_quantum/solve/use_cases/arbitrage_node_based.py +55 -0
- luna_quantum/solve/use_cases/base.py +7 -0
- luna_quantum/solve/use_cases/binary_integer_linear_programming.py +54 -0
- luna_quantum/solve/use_cases/binary_paint_shop_problem.py +37 -0
- luna_quantum/solve/use_cases/credit_scoring_feature_selection.py +40 -0
- luna_quantum/solve/use_cases/dynamic_portfolio_optimization.py +64 -0
- luna_quantum/solve/use_cases/exact_cover.py +51 -0
- luna_quantum/solve/use_cases/flight_gate_assignment.py +79 -0
- luna_quantum/solve/use_cases/graph_coloring.py +42 -0
- luna_quantum/solve/use_cases/graph_isomorphism.py +52 -0
- luna_quantum/solve/use_cases/graph_partitioning.py +46 -0
- luna_quantum/solve/use_cases/hamiltonian_cycle.py +49 -0
- luna_quantum/solve/use_cases/induced_subgraph_isomorphism.py +50 -0
- luna_quantum/solve/use_cases/job_shop_scheduling.py +44 -0
- luna_quantum/solve/use_cases/k_medoids_clustering.py +49 -0
- luna_quantum/solve/use_cases/knapsack_integer_weights.py +56 -0
- luna_quantum/solve/use_cases/linear_regression.py +60 -0
- luna_quantum/solve/use_cases/lmwcs.py +84 -0
- luna_quantum/solve/use_cases/longest_path.py +50 -0
- luna_quantum/solve/use_cases/market_graph_clustering.py +61 -0
- luna_quantum/solve/use_cases/max2sat.py +54 -0
- luna_quantum/solve/use_cases/max3sat.py +55 -0
- luna_quantum/solve/use_cases/max_clique.py +60 -0
- luna_quantum/solve/use_cases/max_cut.py +48 -0
- luna_quantum/solve/use_cases/max_independent_set.py +37 -0
- luna_quantum/solve/use_cases/minimal_maximal_matching.py +54 -0
- luna_quantum/solve/use_cases/minimal_spanning_tree.py +90 -0
- luna_quantum/solve/use_cases/minimum_vertex_cover.py +45 -0
- luna_quantum/solve/use_cases/number_partitioning.py +32 -0
- luna_quantum/solve/use_cases/portfolio_optimization.py +46 -0
- luna_quantum/solve/use_cases/portfolio_optimization_ib_tv.py +63 -0
- luna_quantum/solve/use_cases/quadratic_assignment.py +49 -0
- luna_quantum/solve/use_cases/quadratic_knapsack.py +48 -0
- luna_quantum/solve/use_cases/satellite_scheduling.py +73 -0
- luna_quantum/solve/use_cases/sensor_placement.py +58 -0
- luna_quantum/solve/use_cases/set_cover.py +56 -0
- luna_quantum/solve/use_cases/set_packing.py +54 -0
- luna_quantum/solve/use_cases/set_partitioning.py +52 -0
- luna_quantum/solve/use_cases/subgraph_isomorphism.py +55 -0
- luna_quantum/solve/use_cases/subset_sum.py +37 -0
- luna_quantum/solve/use_cases/support_vector_machine.py +64 -0
- luna_quantum/solve/use_cases/traffic_flow.py +35 -0
- luna_quantum/solve/use_cases/travelling_salesman_problem.py +53 -0
- luna_quantum/solve/use_cases/type_aliases.py +9 -0
- luna_quantum/solve/use_cases/weighted_max_cut.py +37 -0
- luna_quantum/solve/usecases/__init__.py +45 -0
- luna_quantum/solve/usecases/model_delete_usecase.py +49 -0
- luna_quantum/solve/usecases/model_fetch_metadata_usecase.py +50 -0
- luna_quantum/solve/usecases/model_get_solution_usecase.py +59 -0
- luna_quantum/solve/usecases/model_get_solve_jobs_usecase.py +62 -0
- luna_quantum/solve/usecases/model_load_by_id_usecase.py +47 -0
- luna_quantum/solve/usecases/model_load_by_metadata_usecase.py +52 -0
- luna_quantum/solve/usecases/model_load_metadata_by_hash_usecase.py +51 -0
- luna_quantum/solve/usecases/model_save_usecase.py +63 -0
- luna_quantum/solve/usecases/solve_job_cancel_usecase.py +51 -0
- luna_quantum/solve/usecases/solve_job_create_usecase.py +112 -0
- luna_quantum/solve/usecases/solve_job_delete_usecase.py +38 -0
- luna_quantum/solve/usecases/solve_job_fetch_updates_usecase.py +49 -0
- luna_quantum/solve/usecases/solve_job_get_result_usecase.py +95 -0
- luna_quantum/transformations.py +18 -0
- luna_quantum/transformations.pyi +371 -0
- luna_quantum/translator.py +23 -0
- luna_quantum/translator.pyi +869 -0
- luna_quantum/util/__init__.py +0 -0
- luna_quantum/util/active_waiting.py +79 -0
- luna_quantum/util/class_patcher.py +164 -0
- luna_quantum/util/debug_info.py +52 -0
- luna_quantum/util/log_utils.py +187 -0
- luna_quantum/util/pretty_base.py +67 -0
- luna_quantum/util/pydantic_utils.py +38 -0
- luna_quantum/utils.py +3 -0
- luna_quantum/utils.pyi +67 -0
- luna_quantum-1.0.8rc2.dist-info/METADATA +36 -0
- luna_quantum-1.0.8rc2.dist-info/RECORD +264 -0
- luna_quantum-1.0.8rc2.dist-info/WHEEL +4 -0
- luna_quantum-1.0.8rc2.dist-info/licenses/LICENSE +176 -0
- luna_quantum-1.0.8rc2.dist-info/licenses/NOTICE +13 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
from pydantic import Field
|
|
2
|
+
|
|
3
|
+
from luna_quantum.client.schemas.qpu_token.qpu_token import (
|
|
4
|
+
QpuToken,
|
|
5
|
+
QpuTokenSource,
|
|
6
|
+
TokenProvider,
|
|
7
|
+
)
|
|
8
|
+
from luna_quantum.solve.domain.abstract.qpu_token_backend import QpuTokenBackend
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AWSBackendBase(QpuTokenBackend):
|
|
12
|
+
"""AWS Backend Mixin.
|
|
13
|
+
|
|
14
|
+
Attributes
|
|
15
|
+
----------
|
|
16
|
+
aws_access_key: str | QpuToken | None
|
|
17
|
+
The AWS access key
|
|
18
|
+
aws_secret_access_key: str | QpuToken | None
|
|
19
|
+
The AWS secret access key
|
|
20
|
+
aws_session_token: str | QpuToken | None
|
|
21
|
+
The AWS session token
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
aws_access_key: str | QpuToken | None = Field(
|
|
25
|
+
repr=False, exclude=True, default=None
|
|
26
|
+
)
|
|
27
|
+
aws_secret_access_key: str | QpuToken | None = Field(
|
|
28
|
+
repr=False, exclude=True, default=None
|
|
29
|
+
)
|
|
30
|
+
aws_session_token: str | QpuToken | None = Field(
|
|
31
|
+
repr=False, exclude=True, default=None
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def provider(self) -> str:
|
|
36
|
+
"""
|
|
37
|
+
Retrieve the name of the provider.
|
|
38
|
+
|
|
39
|
+
Returns
|
|
40
|
+
-------
|
|
41
|
+
str
|
|
42
|
+
The name of the provider.
|
|
43
|
+
"""
|
|
44
|
+
return "aws"
|
|
45
|
+
|
|
46
|
+
def _get_token(self) -> TokenProvider | None:
|
|
47
|
+
if self.aws_access_key is None and self.aws_secret_access_key is None:
|
|
48
|
+
return None
|
|
49
|
+
|
|
50
|
+
token_provider = TokenProvider()
|
|
51
|
+
if isinstance(self.aws_access_key, QpuToken):
|
|
52
|
+
token_provider.aws_access_key = self.aws_access_key
|
|
53
|
+
elif isinstance(self.aws_access_key, str):
|
|
54
|
+
token_provider.aws_access_key = QpuToken(
|
|
55
|
+
source=QpuTokenSource.INLINE,
|
|
56
|
+
token=self.aws_access_key,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
if isinstance(self.aws_secret_access_key, QpuToken):
|
|
60
|
+
token_provider.aws_secret_access_key = self.aws_secret_access_key
|
|
61
|
+
elif isinstance(self.aws_secret_access_key, str):
|
|
62
|
+
token_provider.aws_secret_access_key = QpuToken(
|
|
63
|
+
source=QpuTokenSource.INLINE,
|
|
64
|
+
token=self.aws_secret_access_key,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
if isinstance(self.aws_session_token, QpuToken):
|
|
68
|
+
token_provider.aws_session_token = self.aws_session_token
|
|
69
|
+
elif isinstance(self.aws_session_token, str):
|
|
70
|
+
token_provider.aws_session_token = QpuToken(
|
|
71
|
+
source=QpuTokenSource.INLINE,
|
|
72
|
+
token=self.aws_session_token,
|
|
73
|
+
)
|
|
74
|
+
return token_provider
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from pydantic import computed_field
|
|
4
|
+
|
|
5
|
+
from .aws_backend_base import AWSBackendBase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class IonQ(AWSBackendBase):
|
|
9
|
+
"""
|
|
10
|
+
Configuration parameters for IonQ quantum backends, accessed via AWS.
|
|
11
|
+
|
|
12
|
+
Attributes
|
|
13
|
+
----------
|
|
14
|
+
device: Literal["Aria1", "Aria2", "Forte1", "ForteEnterprise1"], \
|
|
15
|
+
default="Aria1"
|
|
16
|
+
The specific IonQ quantum device to use for computations. Options are:
|
|
17
|
+
|
|
18
|
+
- "Aria1": IonQ's flagship trapped-ion quantum computer
|
|
19
|
+
- "Aria2": Next-generation IonQ system with improved connectivity
|
|
20
|
+
- "Forte1": IonQ's enterprise-grade quantum system
|
|
21
|
+
- "ForteEnterprise1": Enhanced enterprise version with dedicated access
|
|
22
|
+
|
|
23
|
+
Different devices have varying characteristics such as qubit count,
|
|
24
|
+
connectivity, and error rates.
|
|
25
|
+
aws_access_key: str | QpuToken | None
|
|
26
|
+
The AWS access key
|
|
27
|
+
aws_secret_access_key: str | QpuToken | None
|
|
28
|
+
The AWS secret access key
|
|
29
|
+
aws_session_token: str | QpuToken | None
|
|
30
|
+
The AWS session token
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
device: Literal[
|
|
34
|
+
"Aria1",
|
|
35
|
+
"Aria2",
|
|
36
|
+
"Forte1",
|
|
37
|
+
"ForteEnterprise1",
|
|
38
|
+
] = "Aria1"
|
|
39
|
+
|
|
40
|
+
@computed_field
|
|
41
|
+
def device_provider(self) -> str:
|
|
42
|
+
"""Return the device provider identifier."""
|
|
43
|
+
return "IonQ"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from pydantic import computed_field
|
|
4
|
+
|
|
5
|
+
from .aws_backend_base import AWSBackendBase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class IQM(AWSBackendBase):
|
|
9
|
+
"""
|
|
10
|
+
Configuration parameters for IQM quantum backends, accessed via AWS.
|
|
11
|
+
|
|
12
|
+
Attributes
|
|
13
|
+
----------
|
|
14
|
+
device: Literal["Garnet"], default="Garnet"
|
|
15
|
+
The specific IQM quantum device to use for computations. Currently only
|
|
16
|
+
"Garnet" is available - IQM's superconducting quantum processor with
|
|
17
|
+
native two-qubit gates and optimized for near-term algorithms.
|
|
18
|
+
aws_access_key: str | QpuToken | None
|
|
19
|
+
The AWS access key
|
|
20
|
+
aws_secret_access_key: str | QpuToken | None
|
|
21
|
+
The AWS secret access key
|
|
22
|
+
aws_session_token: str | QpuToken | None
|
|
23
|
+
The AWS session token
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
device: Literal["Garnet"] = "Garnet"
|
|
27
|
+
|
|
28
|
+
@computed_field
|
|
29
|
+
def device_provider(self) -> str:
|
|
30
|
+
"""Return the device provider identifier."""
|
|
31
|
+
return "IQM"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from pydantic import computed_field
|
|
4
|
+
|
|
5
|
+
from .aws_backend_base import AWSBackendBase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Rigetti(AWSBackendBase):
|
|
9
|
+
"""
|
|
10
|
+
Configuration parameters for Rigetti quantum backends, accessed via AWS.
|
|
11
|
+
|
|
12
|
+
Attributes
|
|
13
|
+
----------
|
|
14
|
+
device: Literal["Ankaa3"], default="Ankaa3"
|
|
15
|
+
The specific Rigetti quantum device to use for computations. Currently only
|
|
16
|
+
"Ankaa-3" is available - Rigetti's latest superconducting quantum processor
|
|
17
|
+
featuring improved coherence times and gate fidelities.
|
|
18
|
+
aws_access_key: str | QpuToken | None
|
|
19
|
+
The AWS access key
|
|
20
|
+
aws_secret_access_key: str | QpuToken | None
|
|
21
|
+
The AWS secret access key
|
|
22
|
+
aws_session_token: str | QpuToken | None
|
|
23
|
+
The AWS session token
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
device: Literal["Ankaa3"] = "Ankaa3"
|
|
27
|
+
|
|
28
|
+
@computed_field
|
|
29
|
+
def device_provider(self) -> str:
|
|
30
|
+
"""Return the device provider identifier."""
|
|
31
|
+
return "Rigetti"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from luna_quantum.solve.interfaces.backend_i import IBackend
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DWave(IBackend):
|
|
5
|
+
"""Configuration class for the DWave backend."""
|
|
6
|
+
|
|
7
|
+
@property
|
|
8
|
+
def provider(self) -> str:
|
|
9
|
+
"""
|
|
10
|
+
Retrieve the name of the provider.
|
|
11
|
+
|
|
12
|
+
Returns
|
|
13
|
+
-------
|
|
14
|
+
str
|
|
15
|
+
The name of the provider.
|
|
16
|
+
"""
|
|
17
|
+
return "dwave"
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Annotated
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field, StringConstraints
|
|
6
|
+
|
|
7
|
+
from luna_quantum.client.schemas import QpuToken, QpuTokenSource, TokenProvider
|
|
8
|
+
from luna_quantum.solve.domain.abstract.qpu_token_backend import QpuTokenBackend
|
|
9
|
+
from luna_quantum.solve.parameters.backends.dwave import DWave
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class DWaveQpu(DWave, QpuTokenBackend):
|
|
13
|
+
"""
|
|
14
|
+
Configuration for D-Wave quantum processing backends.
|
|
15
|
+
|
|
16
|
+
This class provides settings for problem decomposition and embedding when using
|
|
17
|
+
D-Wave quantum processors. It can be configured to use either manual embedding
|
|
18
|
+
parameters or automatic embedding based on problem characteristics.
|
|
19
|
+
|
|
20
|
+
Attributes
|
|
21
|
+
----------
|
|
22
|
+
embedding_parameters: Embedding | AutoEmbedding | None
|
|
23
|
+
Detailed configuration for manual embedding when not using auto-embedding.
|
|
24
|
+
If None and decomposer is also None, default embedding parameters will be used.
|
|
25
|
+
Ignored if decomposer is set to AutoEmbedding. Default is None.
|
|
26
|
+
qpu_backend: str
|
|
27
|
+
Specific D-Wave quantum processing unit (QPU) for your optimization
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
class Embedding(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
Configuration parameters for embedding problems onto D-Wave QPUs.
|
|
33
|
+
|
|
34
|
+
Embedding maps logical variables from a problem to physical qubits on the QPU,
|
|
35
|
+
with chains of qubits representing individual variables.
|
|
36
|
+
|
|
37
|
+
Attributes
|
|
38
|
+
----------
|
|
39
|
+
max_no_improvement: int, default=10
|
|
40
|
+
Maximum number of consecutive failed iterations to improve the current
|
|
41
|
+
solution before giving up. Each iteration attempts to find an embedding for
|
|
42
|
+
each variable such that it is adjacent to all its neighbors.
|
|
43
|
+
|
|
44
|
+
random_seed: Optional[int], default=None
|
|
45
|
+
Seed for the random number generator. If None, seed is set by
|
|
46
|
+
`os.urandom()`.
|
|
47
|
+
|
|
48
|
+
timeout: int, default=1000
|
|
49
|
+
Maximum time in seconds before the algorithm gives up.
|
|
50
|
+
|
|
51
|
+
max_beta: Optional[float], default=None
|
|
52
|
+
Controls qubit weight assignment using formula (beta^n) where n is the
|
|
53
|
+
number of chains containing that qubit. Must be greater than 1 if specified.
|
|
54
|
+
If None, `max_beta` is effectively infinite.
|
|
55
|
+
|
|
56
|
+
tries: int, default=10
|
|
57
|
+
Number of restart attempts before the algorithm stops. On D-Wave 2000Q, a
|
|
58
|
+
typical restart takes between 1 and 60 seconds.
|
|
59
|
+
|
|
60
|
+
inner_rounds: Optional[int], default=None
|
|
61
|
+
Maximum iterations between restart attempts. Restart attempts are typically
|
|
62
|
+
terminated due to `max_no_improvement`. If None, effectively infinite.
|
|
63
|
+
|
|
64
|
+
chainlength_patience: int, default=10
|
|
65
|
+
Maximum number of consecutive failed iterations to improve chain lengths
|
|
66
|
+
before moving on. Each iteration attempts to find more efficient embeddings.
|
|
67
|
+
|
|
68
|
+
max_fill: Optional[int], default=None
|
|
69
|
+
Restricts the number of chains that can simultaneously use the same qubit
|
|
70
|
+
during search. Values above 63 are treated as 63. If None, effectively
|
|
71
|
+
infinite.
|
|
72
|
+
|
|
73
|
+
threads: int, default=1
|
|
74
|
+
Maximum number of threads to use. Parallelization is only advantageous when
|
|
75
|
+
the expected variable degree significantly exceeds the thread count. Min: 1.
|
|
76
|
+
|
|
77
|
+
return_overlap: bool, default=False
|
|
78
|
+
Controls return value format:
|
|
79
|
+
|
|
80
|
+
- True: Returns (embedding, validity_flag) tuple
|
|
81
|
+
- False: Returns only the embedding
|
|
82
|
+
|
|
83
|
+
This function returns an embedding regardless of whether qubits are used by
|
|
84
|
+
multiple variables.
|
|
85
|
+
|
|
86
|
+
skip_initialization: bool, default=False
|
|
87
|
+
If True, skips the initialization pass. Only works with semi-valid
|
|
88
|
+
embeddings provided through `initial_chains` and `fixed_chains`.
|
|
89
|
+
A semi-valid embedding has chains where every adjacent variable pair (u,v)
|
|
90
|
+
has a coupler (p,q) in the hardware with p in chain(u) and q in chain(v).
|
|
91
|
+
|
|
92
|
+
initial_chains: Any, default=()
|
|
93
|
+
Initial chains inserted before `fixed_chains` and before initialization.
|
|
94
|
+
Can be used to restart algorithm from a previous state. Missing or empty
|
|
95
|
+
entries are ignored. Each value is a list of qubit labels.
|
|
96
|
+
|
|
97
|
+
fixed_chains: Any, default=()
|
|
98
|
+
Fixed chains that cannot change during the algorithm. Qubits in these chains
|
|
99
|
+
are not used by other chains. Missing or empty entries are ignored.
|
|
100
|
+
Each value is a list of qubit labels.
|
|
101
|
+
|
|
102
|
+
restrict_chains: Any, default=()
|
|
103
|
+
Restricts each chain[i] to be a subset of `restrict_chains[i]` throughout
|
|
104
|
+
the algorithm. Missing or empty entries are ignored. Each value is a list
|
|
105
|
+
of qubit labels.
|
|
106
|
+
|
|
107
|
+
suspend_chains: Any, default=()
|
|
108
|
+
A metafeature only implemented in the Python interface. For each suspended
|
|
109
|
+
variable i, `suspend_chains[i]` is an iterable of iterables (blobs).
|
|
110
|
+
For each blob in a suspension, at least one qubit from that blob must be
|
|
111
|
+
in the chain for variable i.
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
max_no_improvement: int = 10
|
|
115
|
+
random_seed: int | None = None
|
|
116
|
+
timeout: int = 1_000
|
|
117
|
+
max_beta: float | None = None
|
|
118
|
+
tries: int = 10
|
|
119
|
+
inner_rounds: int | None = None
|
|
120
|
+
chainlength_patience: int = 10
|
|
121
|
+
max_fill: int | None = None
|
|
122
|
+
threads: int = Field(default=1, ge=1)
|
|
123
|
+
return_overlap: bool = False
|
|
124
|
+
skip_initialization: bool = False
|
|
125
|
+
initial_chains: dict = Field(default_factory=dict) # type: ignore[type-arg]
|
|
126
|
+
fixed_chains: dict = Field(default_factory=dict) # type: ignore[type-arg]
|
|
127
|
+
restrict_chains: dict = Field(default_factory=dict) # type: ignore[type-arg]
|
|
128
|
+
suspend_chains: dict = Field(default_factory=dict) # type: ignore[type-arg]
|
|
129
|
+
|
|
130
|
+
class AutoEmbedding(BaseModel):
|
|
131
|
+
"""
|
|
132
|
+
Configuration for automatic embedding of problems onto D-Wave hardware.
|
|
133
|
+
|
|
134
|
+
This class provides a simpler interface to configure the embedding process
|
|
135
|
+
when the details of the underlying hardware are not known or when optimal
|
|
136
|
+
embedding parameters should be determined automatically.
|
|
137
|
+
|
|
138
|
+
Attributes
|
|
139
|
+
----------
|
|
140
|
+
embedding_parameters: EmbeddingParameters, default=EmbeddingParameters()
|
|
141
|
+
Detailed configuration parameters for the embedding algorithm.
|
|
142
|
+
See EmbeddingParameters documentation for details on specific settings.
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
embedding_parameters: DWaveQpu.Embedding = Field(
|
|
146
|
+
default_factory=lambda: DWaveQpu.Embedding()
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
embedding_parameters: Embedding | AutoEmbedding | None = None
|
|
150
|
+
qpu_backend: Annotated[
|
|
151
|
+
str, StringConstraints(strip_whitespace=True, min_length=1)
|
|
152
|
+
] = "default"
|
|
153
|
+
|
|
154
|
+
token: str | QpuToken | None = Field(repr=False, exclude=True, default=None)
|
|
155
|
+
|
|
156
|
+
def _get_token(self) -> TokenProvider | None:
|
|
157
|
+
if self.token is None:
|
|
158
|
+
return None
|
|
159
|
+
if isinstance(self.token, QpuToken):
|
|
160
|
+
return TokenProvider(dwave=self.token)
|
|
161
|
+
return TokenProvider(
|
|
162
|
+
dwave=QpuToken(
|
|
163
|
+
source=QpuTokenSource.INLINE,
|
|
164
|
+
token=self.token,
|
|
165
|
+
)
|
|
166
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from luna_quantum.solve.interfaces.backend_i import IBackend
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Fujitsu(IBackend):
|
|
5
|
+
"""Configuration class for the Fujitsu backend."""
|
|
6
|
+
|
|
7
|
+
@property
|
|
8
|
+
def provider(self) -> str:
|
|
9
|
+
"""
|
|
10
|
+
Retrieve the name of the provider.
|
|
11
|
+
|
|
12
|
+
Returns
|
|
13
|
+
-------
|
|
14
|
+
str
|
|
15
|
+
The name of the provider.
|
|
16
|
+
"""
|
|
17
|
+
return "fda"
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
from luna_quantum.solve.interfaces.backend_i import IBackend
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class IBM(IBackend):
|
|
9
|
+
"""IBM quantum backend configuration.
|
|
10
|
+
|
|
11
|
+
This class provides configuration options for IBM quantum backends, supporting
|
|
12
|
+
both local simulators and fake provider backends for quantum algorithm execution.
|
|
13
|
+
The configuration allows users to specify which type of backend to use without
|
|
14
|
+
requiring an IBM token for simulator-based execution.
|
|
15
|
+
|
|
16
|
+
The class supports two main backend types:
|
|
17
|
+
|
|
18
|
+
- Simulator backends: Execute quantum algorithms locally using simulators
|
|
19
|
+
- Fake provider backends: Use IBM's fake backends for testing and development
|
|
20
|
+
|
|
21
|
+
Attributes
|
|
22
|
+
----------
|
|
23
|
+
backend : SimulatorBackend | FakeProviderBackend
|
|
24
|
+
The backend configuration, defaults to AER simulator.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
class SimulatorBackend(BaseModel):
|
|
28
|
+
"""Qiskit Statevector Simulator.
|
|
29
|
+
|
|
30
|
+
Use a simulator as backend. The QAOA is executed completely on our server, and
|
|
31
|
+
no IBM token is required.
|
|
32
|
+
|
|
33
|
+
Attributes
|
|
34
|
+
----------
|
|
35
|
+
backend_name: Literal['aer', 'statevector']
|
|
36
|
+
Which simulator to use. Currently, `AerSimulator` from `qiskit_aer`
|
|
37
|
+
and the statevector simulator from `qiskit.primitives` are available.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
backend_type: Literal["simulator"] = "simulator"
|
|
41
|
+
backend_name: Literal["aer", "statevector"] = "aer"
|
|
42
|
+
|
|
43
|
+
class FakeProviderBackend(BaseModel):
|
|
44
|
+
"""Simulator with emulated QPU noise model.
|
|
45
|
+
|
|
46
|
+
The Qiskit fake provider runs a simulation with a noise model derived from
|
|
47
|
+
an actual QPU hardware implementation.
|
|
48
|
+
See [IBM documentation](
|
|
49
|
+
https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/fake-provider) for
|
|
50
|
+
available “fake” devices.
|
|
51
|
+
|
|
52
|
+
Use a V2 fake backend from `qiskit_ibm_runtime.fake_provider`. The QAOA is
|
|
53
|
+
executed entirely on our server, and no IBM token is required.
|
|
54
|
+
|
|
55
|
+
Attributes
|
|
56
|
+
----------
|
|
57
|
+
backend_name: str
|
|
58
|
+
Which backend to use
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
backend_type: Literal["fake_provider"] = "fake_provider"
|
|
62
|
+
backend_name: Literal[
|
|
63
|
+
"FakeAlgiers",
|
|
64
|
+
"FakeAlmadenV2",
|
|
65
|
+
"FakeArmonkV2",
|
|
66
|
+
"FakeAthensV2",
|
|
67
|
+
"FakeAuckland",
|
|
68
|
+
"FakeBelemV2",
|
|
69
|
+
"FakeBoeblingenV2",
|
|
70
|
+
"FakeBogotaV2",
|
|
71
|
+
"FakeBrisbane",
|
|
72
|
+
"FakeBrooklynV2",
|
|
73
|
+
"FakeBurlingtonV2",
|
|
74
|
+
"FakeCairoV2",
|
|
75
|
+
"FakeCambridgeV2",
|
|
76
|
+
"FakeCasablancaV2",
|
|
77
|
+
"FakeCusco",
|
|
78
|
+
"FakeEssexV2",
|
|
79
|
+
"FakeFez",
|
|
80
|
+
"FakeFractionalBackend",
|
|
81
|
+
"FakeGeneva",
|
|
82
|
+
"FakeGuadalupeV2",
|
|
83
|
+
"FakeHanoiV2",
|
|
84
|
+
"FakeJakartaV2",
|
|
85
|
+
"FakeJohannesburgV2",
|
|
86
|
+
"FakeKawasaki",
|
|
87
|
+
"FakeKolkataV2",
|
|
88
|
+
"FakeKyiv",
|
|
89
|
+
"FakeKyoto",
|
|
90
|
+
"FakeLagosV2",
|
|
91
|
+
"FakeLimaV2",
|
|
92
|
+
"FakeLondonV2",
|
|
93
|
+
"FakeManhattanV2",
|
|
94
|
+
"FakeManilaV2",
|
|
95
|
+
"FakeMarrakesh",
|
|
96
|
+
"FakeMelbourneV2",
|
|
97
|
+
"FakeMontrealV2",
|
|
98
|
+
"FakeMumbaiV2",
|
|
99
|
+
"FakeNairobiV2",
|
|
100
|
+
"FakeOsaka",
|
|
101
|
+
"FakeOslo",
|
|
102
|
+
"FakeOurenseV2",
|
|
103
|
+
"FakeParisV2",
|
|
104
|
+
"FakePeekskill",
|
|
105
|
+
"FakePerth",
|
|
106
|
+
"FakePrague",
|
|
107
|
+
"FakePoughkeepsieV2",
|
|
108
|
+
"FakeQuebec",
|
|
109
|
+
"FakeQuitoV2",
|
|
110
|
+
"FakeRochesterV2",
|
|
111
|
+
"FakeRomeV2",
|
|
112
|
+
"FakeSantiagoV2",
|
|
113
|
+
"FakeSherbrooke",
|
|
114
|
+
"FakeSingaporeV2",
|
|
115
|
+
"FakeSydneyV2",
|
|
116
|
+
"FakeTorino",
|
|
117
|
+
"FakeTorontoV2",
|
|
118
|
+
"FakeValenciaV2",
|
|
119
|
+
"FakeVigoV2",
|
|
120
|
+
"FakeWashingtonV2",
|
|
121
|
+
"FakeYorktownV2",
|
|
122
|
+
]
|
|
123
|
+
|
|
124
|
+
backend: SimulatorBackend | FakeProviderBackend = Field(
|
|
125
|
+
default=SimulatorBackend(), discriminator="backend_type"
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
@property
|
|
129
|
+
def provider(self) -> str:
|
|
130
|
+
"""
|
|
131
|
+
Retrieve the name of the provider.
|
|
132
|
+
|
|
133
|
+
Returns
|
|
134
|
+
-------
|
|
135
|
+
str
|
|
136
|
+
The name of the provider.
|
|
137
|
+
"""
|
|
138
|
+
return "ibm"
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
from luna_quantum.client.schemas import QpuToken, QpuTokenSource, TokenProvider
|
|
6
|
+
from luna_quantum.solve.domain.abstract import QpuTokenBackend
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Qctrl(QpuTokenBackend):
|
|
10
|
+
"""
|
|
11
|
+
Configuration parameters for Q-CTRL`s Fire Opal Backend.
|
|
12
|
+
|
|
13
|
+
QAOA (Quantum Approximate Optimization Algorithm) is a quantum algorithm designed
|
|
14
|
+
for combinatorial optimization problems. This implementation leverages Q-CTRL's
|
|
15
|
+
Fire Opal framework, which optimizes QAOA execution on quantum hardware to reduce
|
|
16
|
+
errors and improve solution quality.
|
|
17
|
+
|
|
18
|
+
Fire Opal's hardware-tailored optimizations enable solving larger problems with
|
|
19
|
+
better convergence in fewer iterations, reducing overall execution time on real
|
|
20
|
+
quantum devices.
|
|
21
|
+
|
|
22
|
+
Attributes
|
|
23
|
+
----------
|
|
24
|
+
organization_slug: str | None, default=None
|
|
25
|
+
Organization identifier from your Q-CTRL account. Required only if you belong
|
|
26
|
+
to multiple organizations. This can be retrieved from your Q-CTRL account
|
|
27
|
+
settings or dashboard.
|
|
28
|
+
|
|
29
|
+
backend_name: str | None, default=None
|
|
30
|
+
The IBM Quantum backend to use for computations:
|
|
31
|
+
- Specific backend: e.g., 'ibm_fez', 'ibm_marrakesh'
|
|
32
|
+
- 'least_busy': Automatically selects the least busy available backend
|
|
33
|
+
- 'basic_simulator': Uses the basic simulator (default if None)
|
|
34
|
+
Check your IBM Quantum account for available backends.
|
|
35
|
+
|
|
36
|
+
ibm_credentials: IBMQ | IBMCloud
|
|
37
|
+
The IBM backend credentials, i.e. how to access the IBM service. Q-Ctrl
|
|
38
|
+
currently supports two mehtods, via the old IBMQ pattern or the new IBMCloud
|
|
39
|
+
pattern. Default is Qctrl.IBMQ()
|
|
40
|
+
|
|
41
|
+
token: QpuToken | str | None, default=None
|
|
42
|
+
The Q-Ctrl API token.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
Notes
|
|
46
|
+
-----
|
|
47
|
+
For detailed information about Fire Opal's QAOA solver and its capabilities,
|
|
48
|
+
see [Q-CTRL's documentation](
|
|
49
|
+
https://docs.q-ctrl.com/fire-opal/topics/fire-opals-qaoa-solver)
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
class IBMCloud(BaseModel):
|
|
53
|
+
"""
|
|
54
|
+
Configuration parameters for the IBM Cloud backend.
|
|
55
|
+
|
|
56
|
+
Attributes
|
|
57
|
+
----------
|
|
58
|
+
instance: str
|
|
59
|
+
The Qiskit runtime instance CRN (Cloud Resource Name).
|
|
60
|
+
|
|
61
|
+
token: Union[str, None, QpuToken], default=None
|
|
62
|
+
The IBM API token.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
instance: str = ""
|
|
66
|
+
|
|
67
|
+
token: str | QpuToken | None = Field(repr=False, exclude=True, default=None)
|
|
68
|
+
|
|
69
|
+
organization_slug: Any = None
|
|
70
|
+
backend_name: str | None = None
|
|
71
|
+
|
|
72
|
+
ibm_credentials: IBMCloud = Field(default=IBMCloud())
|
|
73
|
+
|
|
74
|
+
token: str | QpuToken | None = Field(repr=False, exclude=True, default=None)
|
|
75
|
+
|
|
76
|
+
def _get_token(self) -> TokenProvider | None:
|
|
77
|
+
if self.token is None or self.ibm_credentials.token is None:
|
|
78
|
+
return None
|
|
79
|
+
qctrl_token = (
|
|
80
|
+
self.token
|
|
81
|
+
if isinstance(self.token, QpuToken)
|
|
82
|
+
else QpuToken(source=QpuTokenSource.INLINE, token=self.token)
|
|
83
|
+
)
|
|
84
|
+
ibm_token = (
|
|
85
|
+
self.ibm_credentials.token
|
|
86
|
+
if isinstance(self.ibm_credentials.token, QpuToken)
|
|
87
|
+
else QpuToken(
|
|
88
|
+
source=QpuTokenSource.INLINE, token=self.ibm_credentials.token
|
|
89
|
+
)
|
|
90
|
+
)
|
|
91
|
+
return TokenProvider(qctrl=qctrl_token, ibm=ibm_token)
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def provider(self) -> str:
|
|
95
|
+
"""
|
|
96
|
+
Retrieve the name of the provider.
|
|
97
|
+
|
|
98
|
+
Returns
|
|
99
|
+
-------
|
|
100
|
+
str
|
|
101
|
+
The name of the provider.
|
|
102
|
+
"""
|
|
103
|
+
return "qctrl"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from luna_quantum.solve.interfaces.backend_i import IBackend
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ZIB(IBackend):
|
|
5
|
+
"""Configuration class for the ZIB backend."""
|
|
6
|
+
|
|
7
|
+
@property
|
|
8
|
+
def provider(self) -> str:
|
|
9
|
+
"""
|
|
10
|
+
Retrieve the name of the provider.
|
|
11
|
+
|
|
12
|
+
Returns
|
|
13
|
+
-------
|
|
14
|
+
str
|
|
15
|
+
The name of the provider.
|
|
16
|
+
"""
|
|
17
|
+
return "zib"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# The default absolute tolerance that should be used for `numpy.isclose(...)`
|
|
2
|
+
# calls. Equal to the default used in `numpy.isclose(..)`.
|
|
3
|
+
DEFAULT_ATOL: float = 1.0e-8
|
|
4
|
+
|
|
5
|
+
# The default relative tolerance that should be used for ``numpy.isclose(...)``
|
|
6
|
+
# calls. Equal to the default used in ``numpy.isclose(..)``.
|
|
7
|
+
DEFAULT_RTOL: float = 1.0e-5
|
|
8
|
+
|
|
9
|
+
# The default timeout used for solver run with a specified target.
|
|
10
|
+
# Number of seconds before routine halts. Default is 2592000 for dimod.qbsolv.
|
|
11
|
+
DEFAULT_TIMEOUT: int = 10
|
|
File without changes
|