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.
- luna_quantum/__init__.py +139 -0
- luna_quantum/__init__.pyi +98 -0
- luna_quantum/_core.cp312-win_amd64.pyd +0 -0
- luna_quantum/_core.pyi +4286 -0
- luna_quantum/_utility.py +148 -0
- luna_quantum/_utility.pyi +20 -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/luna_quantum_call_type_error.py +9 -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 +489 -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 +230 -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 +59 -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_by_id_usecase_i.py +27 -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 +10 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/__init__.py +29 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/config.py +58 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/flexqaoa.py +188 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/optimizers.py +53 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/pipeline.py +164 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/qaoa.py +112 -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 +27 -0
- luna_quantum/solve/parameters/backends/aqarios.py +17 -0
- luna_quantum/solve/parameters/backends/aqarios_gpu.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/cudaq/__init__.py +5 -0
- luna_quantum/solve/parameters/backends/cudaq/cudaq_base.py +16 -0
- luna_quantum/solve/parameters/backends/cudaq/cudaq_cpu.py +30 -0
- luna_quantum/solve/parameters/backends/cudaq/cudaq_gpu.py +32 -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/errors.py +30 -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_by_id_usecase.py +44 -0
- luna_quantum/solve/usecases/solve_job_get_result_usecase.py +105 -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.1.0.dist-info/METADATA +36 -0
- luna_quantum-1.1.0.dist-info/RECORD +276 -0
- luna_quantum-1.1.0.dist-info/WHEEL +4 -0
- luna_quantum-1.1.0.dist-info/licenses/LICENSE +176 -0
- luna_quantum-1.1.0.dist-info/licenses/NOTICE +13 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
from luna_quantum.solve.use_cases.arbitrage_edge_based import ArbitrageEdgeBased
|
|
2
|
+
from luna_quantum.solve.use_cases.arbitrage_node_based import ArbitrageNodeBased
|
|
3
|
+
from luna_quantum.solve.use_cases.base import UseCase
|
|
4
|
+
from luna_quantum.solve.use_cases.binary_integer_linear_programming import (
|
|
5
|
+
BinaryIntegerLinearProgramming,
|
|
6
|
+
)
|
|
7
|
+
from luna_quantum.solve.use_cases.binary_paint_shop_problem import (
|
|
8
|
+
BinaryPaintShopProblem,
|
|
9
|
+
)
|
|
10
|
+
from luna_quantum.solve.use_cases.credit_scoring_feature_selection import (
|
|
11
|
+
CreditScoringFeatureSelection,
|
|
12
|
+
)
|
|
13
|
+
from luna_quantum.solve.use_cases.dynamic_portfolio_optimization import (
|
|
14
|
+
DynamicPortfolioOptimization,
|
|
15
|
+
)
|
|
16
|
+
from luna_quantum.solve.use_cases.exact_cover import ExactCover
|
|
17
|
+
from luna_quantum.solve.use_cases.flight_gate_assignment import FlightGateAssignment
|
|
18
|
+
from luna_quantum.solve.use_cases.graph_coloring import GraphColoring
|
|
19
|
+
from luna_quantum.solve.use_cases.graph_isomorphism import GraphIsomorphism
|
|
20
|
+
from luna_quantum.solve.use_cases.graph_partitioning import GraphPartitioning
|
|
21
|
+
from luna_quantum.solve.use_cases.hamiltonian_cycle import HamiltonianCycle
|
|
22
|
+
from luna_quantum.solve.use_cases.induced_subgraph_isomorphism import (
|
|
23
|
+
InducedSubGraphIsomorphism,
|
|
24
|
+
)
|
|
25
|
+
from luna_quantum.solve.use_cases.job_shop_scheduling import JobShopScheduling
|
|
26
|
+
from luna_quantum.solve.use_cases.k_medoids_clustering import KMedoidsClustering
|
|
27
|
+
from luna_quantum.solve.use_cases.knapsack_integer_weights import KnapsackIntegerWeights
|
|
28
|
+
from luna_quantum.solve.use_cases.linear_regression import LinearRegression
|
|
29
|
+
from luna_quantum.solve.use_cases.lmwcs import LabeledMaxWeightedCommonSubgraph
|
|
30
|
+
from luna_quantum.solve.use_cases.longest_path import LongestPath
|
|
31
|
+
from luna_quantum.solve.use_cases.market_graph_clustering import MarketGraphClustering
|
|
32
|
+
from luna_quantum.solve.use_cases.max2sat import Max2SAT
|
|
33
|
+
from luna_quantum.solve.use_cases.max3sat import Max3SAT
|
|
34
|
+
from luna_quantum.solve.use_cases.max_clique import MaxClique
|
|
35
|
+
from luna_quantum.solve.use_cases.max_cut import MaxCut
|
|
36
|
+
from luna_quantum.solve.use_cases.max_independent_set import MaxIndependentSet
|
|
37
|
+
from luna_quantum.solve.use_cases.minimal_maximal_matching import MinimalMaximalMatching
|
|
38
|
+
from luna_quantum.solve.use_cases.minimal_spanning_tree import MinimalSpanningTree
|
|
39
|
+
from luna_quantum.solve.use_cases.minimum_vertex_cover import MinimumVertexCover
|
|
40
|
+
from luna_quantum.solve.use_cases.number_partitioning import NumberPartitioning
|
|
41
|
+
from luna_quantum.solve.use_cases.portfolio_optimization import PortfolioOptimization
|
|
42
|
+
from luna_quantum.solve.use_cases.portfolio_optimization_ib_tv import (
|
|
43
|
+
PortfolioOptimizationInvestmentBandsTargetVolatility,
|
|
44
|
+
)
|
|
45
|
+
from luna_quantum.solve.use_cases.quadratic_assignment import QuadraticAssignment
|
|
46
|
+
from luna_quantum.solve.use_cases.quadratic_knapsack import QuadraticKnapsack
|
|
47
|
+
from luna_quantum.solve.use_cases.satellite_scheduling import SatelliteScheduling
|
|
48
|
+
from luna_quantum.solve.use_cases.sensor_placement import SensorPlacement
|
|
49
|
+
from luna_quantum.solve.use_cases.set_cover import SetCover
|
|
50
|
+
from luna_quantum.solve.use_cases.set_packing import SetPacking
|
|
51
|
+
from luna_quantum.solve.use_cases.set_partitioning import SetPartitioning
|
|
52
|
+
from luna_quantum.solve.use_cases.subgraph_isomorphism import SubGraphIsomorphism
|
|
53
|
+
from luna_quantum.solve.use_cases.subset_sum import SubsetSum
|
|
54
|
+
from luna_quantum.solve.use_cases.support_vector_machine import SupportVectorMachine
|
|
55
|
+
from luna_quantum.solve.use_cases.traffic_flow import TrafficFlow
|
|
56
|
+
from luna_quantum.solve.use_cases.travelling_salesman_problem import (
|
|
57
|
+
TravellingSalesmanProblem,
|
|
58
|
+
)
|
|
59
|
+
from luna_quantum.solve.use_cases.type_aliases import (
|
|
60
|
+
CalculusLiteral,
|
|
61
|
+
Clause,
|
|
62
|
+
NestedDictGraph,
|
|
63
|
+
NestedDictIntGraph,
|
|
64
|
+
Node,
|
|
65
|
+
)
|
|
66
|
+
from luna_quantum.solve.use_cases.weighted_max_cut import WeightedMaxCut
|
|
67
|
+
|
|
68
|
+
__all__ = [
|
|
69
|
+
"ArbitrageEdgeBased",
|
|
70
|
+
"ArbitrageNodeBased",
|
|
71
|
+
"BinaryIntegerLinearProgramming",
|
|
72
|
+
"BinaryPaintShopProblem",
|
|
73
|
+
"CalculusLiteral",
|
|
74
|
+
"Clause",
|
|
75
|
+
"CreditScoringFeatureSelection",
|
|
76
|
+
"DynamicPortfolioOptimization",
|
|
77
|
+
"ExactCover",
|
|
78
|
+
"FlightGateAssignment",
|
|
79
|
+
"GraphColoring",
|
|
80
|
+
"GraphIsomorphism",
|
|
81
|
+
"GraphPartitioning",
|
|
82
|
+
"HamiltonianCycle",
|
|
83
|
+
"InducedSubGraphIsomorphism",
|
|
84
|
+
"JobShopScheduling",
|
|
85
|
+
"KMedoidsClustering",
|
|
86
|
+
"KnapsackIntegerWeights",
|
|
87
|
+
"LabeledMaxWeightedCommonSubgraph",
|
|
88
|
+
"LinearRegression",
|
|
89
|
+
"LongestPath",
|
|
90
|
+
"MarketGraphClustering",
|
|
91
|
+
"Max2SAT",
|
|
92
|
+
"Max3SAT",
|
|
93
|
+
"MaxClique",
|
|
94
|
+
"MaxCut",
|
|
95
|
+
"MaxIndependentSet",
|
|
96
|
+
"MinimalMaximalMatching",
|
|
97
|
+
"MinimalSpanningTree",
|
|
98
|
+
"MinimumVertexCover",
|
|
99
|
+
"NestedDictGraph",
|
|
100
|
+
"NestedDictIntGraph",
|
|
101
|
+
"Node",
|
|
102
|
+
"NumberPartitioning",
|
|
103
|
+
"PortfolioOptimization",
|
|
104
|
+
"PortfolioOptimizationInvestmentBandsTargetVolatility",
|
|
105
|
+
"QuadraticAssignment",
|
|
106
|
+
"QuadraticKnapsack",
|
|
107
|
+
"SatelliteScheduling",
|
|
108
|
+
"SensorPlacement",
|
|
109
|
+
"SetCover",
|
|
110
|
+
"SetPacking",
|
|
111
|
+
"SetPartitioning",
|
|
112
|
+
"SubGraphIsomorphism",
|
|
113
|
+
"SubsetSum",
|
|
114
|
+
"SupportVectorMachine",
|
|
115
|
+
"TrafficFlow",
|
|
116
|
+
"TravellingSalesmanProblem",
|
|
117
|
+
"UseCase",
|
|
118
|
+
"WeightedMaxCut",
|
|
119
|
+
]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
|
|
7
|
+
from luna_quantum.solve.use_cases.base import UseCase
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ArbitrageEdgeBased(UseCase):
|
|
11
|
+
r"""
|
|
12
|
+
# Arbitrage Edge Based.
|
|
13
|
+
|
|
14
|
+
Description
|
|
15
|
+
-----------
|
|
16
|
+
|
|
17
|
+
In economics and finance, arbitrage is the practice of taking advantage of a
|
|
18
|
+
difference in prices in two or more markets; striking a combination of matching
|
|
19
|
+
deals to capitalize on the difference.
|
|
20
|
+
The edge based Arbitrage problem tries to find the best cycle in a directed and
|
|
21
|
+
complete graph. In this graph, each node corresponds to an asset and each directed
|
|
22
|
+
edge is weighted with the corresponding conversion rate. It creates a QUBO with the
|
|
23
|
+
size _n_edges x n_edges_, which produces a solution vector where each binary
|
|
24
|
+
position maps to an edge.
|
|
25
|
+
|
|
26
|
+
Links
|
|
27
|
+
-----
|
|
28
|
+
|
|
29
|
+
[Wikipedia](https://en.wikipedia.org/wiki/Arbitrage)
|
|
30
|
+
|
|
31
|
+
[Transformation](http://1qbit.com/files/white-papers/1QBit-White-Paper-%E2%80%93-Finding-Optimal-Arbitrage-Opportunities-Using-a-Quantum-Annealer.pdf)
|
|
32
|
+
|
|
33
|
+
Attributes
|
|
34
|
+
----------
|
|
35
|
+
### graph: Dict[str, Dict[str, Dict[str, float]]]
|
|
36
|
+
\n The input graph as described above in the form of nested dictionaries.
|
|
37
|
+
\n Example for three different currencies:
|
|
38
|
+
\n _{_
|
|
39
|
+
\n _0: {1: {'weight': 1.31904}, 2: {'weight': 6.72585}},_
|
|
40
|
+
\n _1: {0: {'weight': 0.75799}, 2: {'weight': 5.10327},_
|
|
41
|
+
\n _2: {0: {'weight': 0.14864}, 1: {'weight': 0.19586}}_
|
|
42
|
+
\n _}_
|
|
43
|
+
|
|
44
|
+
### penalty: Optional[float] = None
|
|
45
|
+
\n The penalty term for the QUBO matrix. Has to be greater than 0.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
name: Literal["AEB"] = "AEB"
|
|
49
|
+
graph: dict[str, dict[str, dict[str, float]]] = Field(name="graph") # type: ignore[call-overload]
|
|
50
|
+
penalty: float | None = None
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
|
|
7
|
+
from luna_quantum.solve.use_cases.base import UseCase
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ArbitrageNodeBased(UseCase):
|
|
11
|
+
r"""
|
|
12
|
+
# Arbitrage Node Based.
|
|
13
|
+
|
|
14
|
+
Description
|
|
15
|
+
-----------
|
|
16
|
+
|
|
17
|
+
In economics and finance, arbitrage is the practice of taking advantage of a
|
|
18
|
+
difference in prices in two or more markets; striking a combination of matching
|
|
19
|
+
deals to capitalize on the difference.
|
|
20
|
+
The node based Arbitrage problem tries to find the best cycle in a directed and
|
|
21
|
+
complete graph. In this graph, each node corresponds to an asset and each directed
|
|
22
|
+
edge is weighted with the corresponding conversion rate.
|
|
23
|
+
The problem creates a QUBO with the size
|
|
24
|
+
_(n_nodes * cycle_length) x (n_nodes * cycle_length)_, which produces a solution
|
|
25
|
+
vector where each binary position maps to to a node and its position in the cycle.
|
|
26
|
+
|
|
27
|
+
Links
|
|
28
|
+
-----
|
|
29
|
+
|
|
30
|
+
[Wikipedia](https://en.wikipedia.org/wiki/Arbitrage)
|
|
31
|
+
|
|
32
|
+
[Transformation](http://1qbit.com/files/white-papers/1QBit-White-Paper-%E2%80%93-Finding-Optimal-Arbitrage-Opportunities-Using-a-Quantum-Annealer.pdf)
|
|
33
|
+
|
|
34
|
+
Attributes
|
|
35
|
+
----------
|
|
36
|
+
### graph: Dict[str, Dict[str, Dict[str, float]]]
|
|
37
|
+
\n The input graph as described above in the form of nested dictionaries.
|
|
38
|
+
\n Example for three different currencies:\n
|
|
39
|
+
\n _{_
|
|
40
|
+
\n _0: {1: {'weight': 1.31904}, 2: {'weight': 6.72585}},_
|
|
41
|
+
\n _1: {0: {'weight': 0.75799}, 2: {'weight': 5.10327},_
|
|
42
|
+
\n _2: {0: {'weight': 0.14864}, 1: {'weight': 0.19586}}_
|
|
43
|
+
\n _}_
|
|
44
|
+
|
|
45
|
+
### penalty: Optional[float] = None
|
|
46
|
+
\n The penalty term for the QUBO matrix. Has to be greater than 0.
|
|
47
|
+
|
|
48
|
+
### K: Optional[int] = None
|
|
49
|
+
\n The maximum length of the arbitrage cycle.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
name: Literal["ANB"] = "ANB"
|
|
53
|
+
graph: dict[str, dict[str, dict[str, float]]] = Field(name="graph") # type: ignore[call-overload]
|
|
54
|
+
penalty: float | None = None
|
|
55
|
+
K: int | None = None
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from luna_quantum.solve.use_cases.base import UseCase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class BinaryIntegerLinearProgramming(UseCase):
|
|
9
|
+
r"""
|
|
10
|
+
# Binary Integer Linear Programming.
|
|
11
|
+
|
|
12
|
+
Description
|
|
13
|
+
-----------
|
|
14
|
+
|
|
15
|
+
For a binary decision vector _x_ and some vector _c_ of length _N_, the Binary
|
|
16
|
+
Integer Linear Programming problem maximizes _c * x_, given the constraint _Sx = b_
|
|
17
|
+
with _S_ being an _m x N_ matrix and _b_ a vector with _m_ components.
|
|
18
|
+
|
|
19
|
+
Q-Bit Interpretation
|
|
20
|
+
--------------------
|
|
21
|
+
|
|
22
|
+
The vector of qubits is simply the decision vector _x_.
|
|
23
|
+
|
|
24
|
+
Links
|
|
25
|
+
-----
|
|
26
|
+
|
|
27
|
+
[Wikipedia](https://en.wikipedia.org/wiki/Integer_programming)
|
|
28
|
+
|
|
29
|
+
[Transformation](https://arxiv.org/pdf/1302.5843.pdf)
|
|
30
|
+
|
|
31
|
+
Attributes
|
|
32
|
+
----------
|
|
33
|
+
### S: List[List[int]]
|
|
34
|
+
\n The _m x N_ matrix.
|
|
35
|
+
|
|
36
|
+
### b: List[int]
|
|
37
|
+
\n Vector with _m_ components.
|
|
38
|
+
|
|
39
|
+
### c: List[int]
|
|
40
|
+
\n Custom vector of length _N_.
|
|
41
|
+
|
|
42
|
+
### A: int
|
|
43
|
+
\n A constant enforcing, if possible, that _Sx = b_.
|
|
44
|
+
|
|
45
|
+
### B: int
|
|
46
|
+
\n A constant (_B << A_) helping maximize _c * x_.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
name: Literal["BIP"] = "BIP"
|
|
50
|
+
S: list[list[int]]
|
|
51
|
+
b: list[int]
|
|
52
|
+
c: list[int]
|
|
53
|
+
A: int = 10
|
|
54
|
+
B: int = 2
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from luna_quantum.solve.use_cases.base import UseCase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class BinaryPaintShopProblem(UseCase):
|
|
9
|
+
r"""
|
|
10
|
+
# Binary Paint Shop.
|
|
11
|
+
|
|
12
|
+
Description
|
|
13
|
+
-----------
|
|
14
|
+
|
|
15
|
+
The Binary Paint Shop Problem tries to minimize the color change of a paint job with
|
|
16
|
+
two colors of a sequence of cars. The sequence consists of a fixed number of cars,
|
|
17
|
+
in which each car type occurs exactly twice and these are to be colored in different
|
|
18
|
+
colors. Therefore, the car sequence consists of exactly twice as many cars as there
|
|
19
|
+
are car types.
|
|
20
|
+
|
|
21
|
+
Links
|
|
22
|
+
-----
|
|
23
|
+
|
|
24
|
+
[Transformation](https://arxiv.org/pdf/2011.03403.pdf)
|
|
25
|
+
|
|
26
|
+
Attributes
|
|
27
|
+
----------
|
|
28
|
+
### n_cars: int
|
|
29
|
+
\n Amount of different car types.
|
|
30
|
+
|
|
31
|
+
### sequence: List[int]
|
|
32
|
+
\n Sequence of the cars.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
name: Literal["BPSP"] = "BPSP"
|
|
36
|
+
n_cars: int
|
|
37
|
+
sequence: list[int]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from luna_quantum.solve.use_cases.base import UseCase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CreditScoringFeatureSelection(UseCase):
|
|
9
|
+
r"""
|
|
10
|
+
# Feature Selection for Credit Scoring.
|
|
11
|
+
|
|
12
|
+
Description
|
|
13
|
+
-----------
|
|
14
|
+
|
|
15
|
+
Find the optimal feature subset with regard to independence and influence of
|
|
16
|
+
features for credit scoring of credit applicants.
|
|
17
|
+
|
|
18
|
+
Links
|
|
19
|
+
-----
|
|
20
|
+
|
|
21
|
+
[Transformation](https://1qbit.com/files/white-papers/1QBit-White-Paper-%E2%80%93-Optimal-Feature-Selection-in-Credit-Scoring-and-Classification-Using-a-Quantum-Annealer_-_2017.04.13.pdf)
|
|
22
|
+
|
|
23
|
+
Attributes
|
|
24
|
+
----------
|
|
25
|
+
### U: List[List[float]]
|
|
26
|
+
\n The matrix U is the design matrix, where each column represents a feature
|
|
27
|
+
and each row represents the specific values for a feature set.
|
|
28
|
+
|
|
29
|
+
### V: List[int]
|
|
30
|
+
\n The binary label vector for the respective row in matrix U.
|
|
31
|
+
|
|
32
|
+
### alpha: float
|
|
33
|
+
\n The balance between feature influence and feature independence in the range
|
|
34
|
+
_[0, 1]_.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
name: Literal["CSFS"] = "CSFS"
|
|
38
|
+
U: list[list[float]]
|
|
39
|
+
V: list[int]
|
|
40
|
+
alpha: float
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from luna_quantum.solve.use_cases.base import UseCase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DynamicPortfolioOptimization(UseCase):
|
|
9
|
+
r"""
|
|
10
|
+
# Dynamic Portfolio Optimization.
|
|
11
|
+
|
|
12
|
+
Description
|
|
13
|
+
-----------
|
|
14
|
+
|
|
15
|
+
The Dynamic Portfolio Optimization problem tries to find the optimal portfolio for a
|
|
16
|
+
given set of assets and a fixed investment amount. It aims to find the portfolio
|
|
17
|
+
with optimal returns for a given risk tolerance. It considers transaction costs when
|
|
18
|
+
rebalancing across multiple time steps. The optimal portfolio is defined by the
|
|
19
|
+
binary choices whether to invest in a specific asset and how much to invest in it.
|
|
20
|
+
The investment amount is split into several so called packages defined as
|
|
21
|
+
2^(package number). The total number of packages determines the granularity of the
|
|
22
|
+
result. It defines the amount of possible investment sums in one asset as well as
|
|
23
|
+
the maximum possible investment in any one asset, which is
|
|
24
|
+
2^(Number of packages) - 1.
|
|
25
|
+
|
|
26
|
+
Links
|
|
27
|
+
-----
|
|
28
|
+
|
|
29
|
+
[Transformation](https://journals.aps.org/prresearch/pdf/10.1103/PhysRevResearch.4.013006)
|
|
30
|
+
|
|
31
|
+
Attributes
|
|
32
|
+
----------
|
|
33
|
+
### tickers: List
|
|
34
|
+
\n Tickers of assets being tested.
|
|
35
|
+
### mu: List[List[float]]
|
|
36
|
+
\n Expected Returns of the assets.
|
|
37
|
+
\n Shape: [time_steps][number_of_assets]
|
|
38
|
+
### sigma: List[List[List[float]]]
|
|
39
|
+
\n Coviariance Matrix of the assets.
|
|
40
|
+
\n Shape: [time_steps][number_of_assets][number_of_assets]
|
|
41
|
+
### packages: int
|
|
42
|
+
\n Number of packages per asset, determines granularity of investment.
|
|
43
|
+
\n _Package value = 2^(package number)_
|
|
44
|
+
### K: int
|
|
45
|
+
\n Total investment amount, which is fixed.
|
|
46
|
+
### gamma: float
|
|
47
|
+
\n Risk Aversion Coefficient.
|
|
48
|
+
\n Range: Risk Seeking 0-100 Very Risk Averse.
|
|
49
|
+
\n Divided by factor 2 as a convention, as stated in paper.
|
|
50
|
+
### nu: float
|
|
51
|
+
\n Transaction Cost percentage, e.g., 0.01 = 1% of transaction size.
|
|
52
|
+
### rho: float
|
|
53
|
+
\n Total investment size constraint factor, Lagrange Multiplier.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
name: Literal["DPO"] = "DPO"
|
|
57
|
+
tickers: list[str | int]
|
|
58
|
+
mu: list[list[float]]
|
|
59
|
+
sigma: list[list[list[float]]]
|
|
60
|
+
packages: int
|
|
61
|
+
K: int
|
|
62
|
+
gamma: float
|
|
63
|
+
nu: float
|
|
64
|
+
rho: float
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from luna_quantum.solve.use_cases.base import UseCase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ExactCover(UseCase):
|
|
9
|
+
r"""
|
|
10
|
+
# Exact Cover.
|
|
11
|
+
|
|
12
|
+
Description
|
|
13
|
+
-----------
|
|
14
|
+
|
|
15
|
+
Given a set _S_ and a list of subsets of _S_, an exact cover is a family _C_ of
|
|
16
|
+
these subsets so that all elements of _S_ are contained in exactly one subset of
|
|
17
|
+
_C_. For a set _S_ and a list of subsets of _S_, the Exact Cover problem tries to
|
|
18
|
+
find the smallest exact cover, i.e. the one that uses the least subsets.
|
|
19
|
+
|
|
20
|
+
Q-Bit Interpretation
|
|
21
|
+
--------------------
|
|
22
|
+
|
|
23
|
+
Subset _i_ is part of the exact cover iff. qubit _i_ is 1.
|
|
24
|
+
|
|
25
|
+
Links
|
|
26
|
+
-----
|
|
27
|
+
|
|
28
|
+
[Wikipedia](https://en.wikipedia.org/wiki/Exact_cover)
|
|
29
|
+
|
|
30
|
+
[Transformation](https://arxiv.org/pdf/1302.5843.pdf)
|
|
31
|
+
|
|
32
|
+
Attributes
|
|
33
|
+
----------
|
|
34
|
+
### subset_matrix: List[List[float]]
|
|
35
|
+
\n A matrix containing all subsets.
|
|
36
|
+
\n e.g. for the set _{1, 2, 3}_ and the subsets _{1, 2}_, _{2, 3}_, and _{3}_:
|
|
37
|
+
\n _[[1, 1, 0], [0, 1, 1], [0, 0, 1]]_
|
|
38
|
+
\n or:
|
|
39
|
+
\n _ExactCover.gen_subsets_matrix([1, 2, 3], [[1, 2], [2, 3], [3]])_
|
|
40
|
+
|
|
41
|
+
### A: int
|
|
42
|
+
\n A constant enforcing the exact cover of the solution.
|
|
43
|
+
|
|
44
|
+
### B: int
|
|
45
|
+
\n A constant (_A > nB_) helping find the smallest exact cover.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
name: Literal["EC"] = "EC"
|
|
49
|
+
subset_matrix: list[list[int]]
|
|
50
|
+
A: int = 2
|
|
51
|
+
B: int = 2
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from luna_quantum.solve.use_cases.base import UseCase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FlightGateAssignment(UseCase):
|
|
9
|
+
r"""
|
|
10
|
+
# Flight Gate Assignment.
|
|
11
|
+
|
|
12
|
+
Description
|
|
13
|
+
-----------
|
|
14
|
+
|
|
15
|
+
Flight Gate Assignment is a highly relevant optimization problem in airport
|
|
16
|
+
management. It tries to minimize the total transit time of passengers, considering
|
|
17
|
+
three typical parts of passenger flow in an airport:
|
|
18
|
+
\n 1) After a flight, passengers claim their baggage and leave the airport.
|
|
19
|
+
\n 2) Other passengers switch from one plane to another to get a connecting flight.
|
|
20
|
+
\n 3) A third group of passengers pass the security check and leave with a flight.
|
|
21
|
+
|
|
22
|
+
Links
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
[Description and Transformation](https://arxiv.org/pdf/1811.09465.pdf)
|
|
26
|
+
|
|
27
|
+
Attributes
|
|
28
|
+
----------
|
|
29
|
+
### n_flights: int
|
|
30
|
+
\n Number of flights.
|
|
31
|
+
|
|
32
|
+
### n_gates: int
|
|
33
|
+
\n Number of gates.
|
|
34
|
+
|
|
35
|
+
### n_passengers: List[Tuple[int, int]]
|
|
36
|
+
\n Number of passengers arriving and departing with each flight.
|
|
37
|
+
\n Example: _n_passengers[3][departure_index]_, gives us the number of
|
|
38
|
+
passengers departing with flight _3_.
|
|
39
|
+
|
|
40
|
+
### time_gates: List[Tuple[float, float]]
|
|
41
|
+
\n The time it takes between every gate and check-in (when leaving) or the gate
|
|
42
|
+
and baggage claim (when arriving).
|
|
43
|
+
\n Example: _time_gates[0][arriving_index]_, gives us the time it takes to go
|
|
44
|
+
from gate _0_ to baggage claim.
|
|
45
|
+
|
|
46
|
+
### time_flights: List[Tuple[float, float]]
|
|
47
|
+
\n The time at which a flight arrives/leaves.
|
|
48
|
+
\n Example: _time_flights[2][departure_index]_, gives us the time at which
|
|
49
|
+
flight 2 departs.
|
|
50
|
+
|
|
51
|
+
### transfer_passengers: List[List[int]]
|
|
52
|
+
\n Matrix with the information of the passengers transferring from one flight to
|
|
53
|
+
another.
|
|
54
|
+
\n Example: _transfer_passengers[2][5]_, gives the number of passengers
|
|
55
|
+
transferring from flight 2 to flight 5.
|
|
56
|
+
|
|
57
|
+
### time_between_gates: List[List[float]]
|
|
58
|
+
\n Gives the time it takes to go from one gate to another.
|
|
59
|
+
|
|
60
|
+
### t_buf: float
|
|
61
|
+
\n Time needed for a gate to be free after a flight has departed.
|
|
62
|
+
|
|
63
|
+
### arrival_index, departure_index: int
|
|
64
|
+
\n Index to subscribe the variables _time_gates_, _n_passengers_,
|
|
65
|
+
_time_gates_, _time_flights_.
|
|
66
|
+
\n One of these variables needs to be _0_, the other _1_.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
name: Literal["FGO"] = "FGO"
|
|
70
|
+
n_flights: int
|
|
71
|
+
n_gates: int
|
|
72
|
+
n_passengers: list[tuple[int, int]]
|
|
73
|
+
time_gates: list[tuple[float, float]]
|
|
74
|
+
time_flights: list[tuple[float, float]]
|
|
75
|
+
transfer_passengers: list[list[int]]
|
|
76
|
+
time_between_gates: list[list[float]]
|
|
77
|
+
t_buf: float
|
|
78
|
+
arrival_index: int = 0
|
|
79
|
+
departure_index: int = 1
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
|
|
7
|
+
from luna_quantum.solve.use_cases.base import UseCase
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class GraphColoring(UseCase):
|
|
11
|
+
r"""
|
|
12
|
+
# Graph Coloring.
|
|
13
|
+
|
|
14
|
+
Description
|
|
15
|
+
-----------
|
|
16
|
+
|
|
17
|
+
The Graph Coloring problem tries to color the nodes of a graph with a given number
|
|
18
|
+
of different colors so that no adjacent nodes have the same color.
|
|
19
|
+
|
|
20
|
+
Links
|
|
21
|
+
-----
|
|
22
|
+
|
|
23
|
+
[Wikipedia](https://en.wikipedia.org/wiki/Graph_coloring)
|
|
24
|
+
|
|
25
|
+
[Transformation](https://arxiv.org/pdf/1811.11538.pdf)
|
|
26
|
+
|
|
27
|
+
Attributes
|
|
28
|
+
----------
|
|
29
|
+
### graph: Dict[int, Dict[int, Dict[str, float]]]
|
|
30
|
+
\n Problem graph for the graph coloring problem in form of nested dictionaries.
|
|
31
|
+
\n (e.g. fully connected graph with 3 nodes:
|
|
32
|
+
\n _{0: {1: {}, 2: {}}, 1: {0: {}, 2: {}}, 2: {0: {}, 1: {}}}_
|
|
33
|
+
\n or _networkx.to_dict_of_dicts(networkx.complete_graph(3))_ )
|
|
34
|
+
|
|
35
|
+
### n_colors: int
|
|
36
|
+
\n Number of different colors.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
name: Literal["GC"] = "GC"
|
|
40
|
+
graph: dict[str, dict[str, dict[str, float]]] = Field(name="graph") # type: ignore[call-overload]
|
|
41
|
+
n_colors: int
|
|
42
|
+
P: int = 4
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from luna_quantum.solve.use_cases.base import UseCase
|
|
6
|
+
from luna_quantum.solve.use_cases.type_aliases import NestedDictIntGraph
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class GraphIsomorphism(UseCase):
|
|
10
|
+
r"""
|
|
11
|
+
# Graph Isomorphism.
|
|
12
|
+
|
|
13
|
+
Description
|
|
14
|
+
-----------
|
|
15
|
+
|
|
16
|
+
The Graph Isomorphism problem tries to find out whether two graphs _G1_ and _G2_are
|
|
17
|
+
isomorphic, i.e. there exists a bijective, edge-invariant vertex mapping from _G1_
|
|
18
|
+
to _G2_.
|
|
19
|
+
|
|
20
|
+
Links
|
|
21
|
+
-----
|
|
22
|
+
|
|
23
|
+
[Wikipedia](https://en.wikipedia.org/wiki/Graph_isomorphism)
|
|
24
|
+
|
|
25
|
+
[Transformation](https://researchspace.auckland.ac.nz/bitstream/handle/2292/31756/CDMTCS499.pdf?sequence=1)
|
|
26
|
+
|
|
27
|
+
Attributes
|
|
28
|
+
----------
|
|
29
|
+
### graph1: Dict[int, Dict[int, Dict[str, float]]]
|
|
30
|
+
\n The first graph (in form of nested dictionaries) to check for isomorphism.
|
|
31
|
+
\n (e.g. fully connected graph with 3 nodes:
|
|
32
|
+
\n _{0: {1: {}, 2: {}}, 1: {0: {}, 2: {}}, 2: {0: {}, 1: {}}}_
|
|
33
|
+
\n or _networkx.to_dict_of_dicts(networkx.complete_graph(3))_ )
|
|
34
|
+
|
|
35
|
+
### graph2: Dict[int, Dict[int, Dict[str, float]]]
|
|
36
|
+
\n The second graph (in form of nested dictionaries) to check for isomorphism.
|
|
37
|
+
\n (e.g. fully connected graph with 3 nodes:
|
|
38
|
+
\n _{0: {1: {}, 2: {}}, 1: {0: {}, 2: {}}, 2: {0: {}, 1: {}}}_
|
|
39
|
+
\n or _networkx.to_dict_of_dicts(networkx.complete_graph(3))_ )
|
|
40
|
+
|
|
41
|
+
### a: float
|
|
42
|
+
\n A penalty value enforcing the bijectivity of the isomorphism.
|
|
43
|
+
|
|
44
|
+
### b: float
|
|
45
|
+
\n A penalty value (b > a) enforcing the edge-invariance of the isomorphism.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
name: Literal["GI"] = "GI"
|
|
49
|
+
graph1: NestedDictIntGraph = Field(name="graph") # type: ignore[call-overload]
|
|
50
|
+
graph2: NestedDictIntGraph = Field(name="graph") # type: ignore[call-overload]
|
|
51
|
+
a: float = 1
|
|
52
|
+
b: float = 2
|