luna-quantum 0.0.33__py3-none-any.whl → 0.0.37__py3-none-any.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-0.0.33.dist-info → luna_quantum-0.0.37.dist-info}/METADATA +1 -1
- {luna_quantum-0.0.33.dist-info → luna_quantum-0.0.37.dist-info}/RECORD +20 -20
- luna_sdk/exceptions/encryption_exception.py +0 -6
- luna_sdk/interfaces/circuit_repo_i.py +0 -6
- luna_sdk/interfaces/qpu_token_repo_i.py +0 -6
- luna_sdk/interfaces/solutions_repo_i.py +0 -6
- luna_sdk/repositories/circuit_repo.py +0 -11
- luna_sdk/repositories/qpu_token_repo.py +29 -36
- luna_sdk/repositories/solutions_repo.py +0 -8
- luna_sdk/schemas/create/circuit.py +0 -3
- luna_sdk/schemas/create/qpu_token.py +0 -3
- luna_sdk/schemas/create/solution.py +0 -1
- luna_sdk/schemas/optimization.py +45 -0
- luna_sdk/schemas/solution.py +89 -35
- luna_sdk/schemas/solver_parameters/dwave/base.py +4 -1
- luna_sdk/schemas/solver_parameters/dwave/quantum_annealing.py +13 -0
- luna_sdk/schemas/solver_parameters/dwave/repeated_reverse_quantum_annealing.py +13 -1
- luna_sdk/schemas/solver_parameters/dwave/tabu_search.py +2 -4
- {luna_quantum-0.0.33.dist-info → luna_quantum-0.0.37.dist-info}/LICENSE +0 -0
- {luna_quantum-0.0.33.dist-info → luna_quantum-0.0.37.dist-info}/WHEEL +0 -0
|
@@ -8,13 +8,13 @@ luna_sdk/controllers/luna_transform.py,sha256=7kdIp5oRMG1NQZ1hBSkcNrj-z6g_2dWvQZ
|
|
|
8
8
|
luna_sdk/error/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
luna_sdk/error/http_error_utils.py,sha256=qZ4a43GVR35-bn3QTVmGZBJzEjieo43r36M2G5rfIyw,3509
|
|
10
10
|
luna_sdk/exceptions/__init__.py,sha256=DSKaPN374rR2zccmpLvlqntxDsjFwgSexXtva795ae0,52
|
|
11
|
-
luna_sdk/exceptions/encryption_exception.py,sha256=
|
|
11
|
+
luna_sdk/exceptions/encryption_exception.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
luna_sdk/exceptions/luna_exception.py,sha256=m7U3qFpP9Sc77Z3RG9I4bQXsJSQuVeBLvfHQWziC9sQ,114
|
|
13
13
|
luna_sdk/exceptions/luna_server_exception.py,sha256=y4J1TzfMF_kmuh5g8hpP2k_SnV0acaxks8lg5EOvo0I,639
|
|
14
14
|
luna_sdk/exceptions/timeout_exception.py,sha256=ppEGsUk-6NtBy2-RyBfzjR1IhDmIwPWwg03BOsET4OA,367
|
|
15
15
|
luna_sdk/exceptions/transformation.py,sha256=lykEeWonvfvWAyU2DoKzR-GtFc-KEAvrfWlnWT9ylqc,381
|
|
16
16
|
luna_sdk/interfaces/__init__.py,sha256=WwAzuNWP6SNMJk_U_Hqc5U2mRsG2_m-sSQZPMYUDWfY,213
|
|
17
|
-
luna_sdk/interfaces/circuit_repo_i.py,sha256=
|
|
17
|
+
luna_sdk/interfaces/circuit_repo_i.py,sha256=Y3PZQDILT016UNwORBg51sgHFnDxMTgfQ0JXmEowoK0,1642
|
|
18
18
|
luna_sdk/interfaces/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
luna_sdk/interfaces/clients/client_i.py,sha256=_I8mTIfavI3Yv7TPD9HsTxF3uI4WzDucFvgEb2EtOAo,185
|
|
20
20
|
luna_sdk/interfaces/clients/luna_q_i.py,sha256=_DHDirve9yoVO8zb5i3WkTMx-LPu9TtasjF4OUfCaRw,765
|
|
@@ -24,26 +24,26 @@ luna_sdk/interfaces/cplex_repo_i.py,sha256=a2CWG1m4YmQAlcM022Xfk09BHVmcd3y2H-GMr
|
|
|
24
24
|
luna_sdk/interfaces/info_repo_i.py,sha256=hCUYNoqjAKwz6l-61XtymX-UboosDX1RaTTiX64EXXc,1345
|
|
25
25
|
luna_sdk/interfaces/lp_repo_i.py,sha256=hixIKvJ8jz9VOUi33B3K2VvFLcR7eKfeooJwktquyhc,3052
|
|
26
26
|
luna_sdk/interfaces/optimization_repo_i.py,sha256=4JZikxWTJZTX4tG85ydSP711WROQ5B8RtbvOp1EDvxE,6202
|
|
27
|
-
luna_sdk/interfaces/qpu_token_repo_i.py,sha256=
|
|
27
|
+
luna_sdk/interfaces/qpu_token_repo_i.py,sha256=OeF9PRcGBjHzNwrllt266M2ELJ7h03c7gt_16FPh4yg,4351
|
|
28
28
|
luna_sdk/interfaces/repository_i.py,sha256=vJz8pbggkuLLC333qzjepj3TMPh49LUnyh3pJDlcGi0,287
|
|
29
|
-
luna_sdk/interfaces/solutions_repo_i.py,sha256=
|
|
29
|
+
luna_sdk/interfaces/solutions_repo_i.py,sha256=Xu-8qQkPoedIp47Uc0ogv5HS45Plsi6zRBEQouxRws0,7463
|
|
30
30
|
luna_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
31
|
luna_sdk/repositories/__init__.py,sha256=HxD02fpzlcIt5YkBHd7LwIp_eE6eFuAz2VDnlrakwJQ,169
|
|
32
|
-
luna_sdk/repositories/circuit_repo.py,sha256=
|
|
32
|
+
luna_sdk/repositories/circuit_repo.py,sha256=gpjEmCRrl8UghJrelOt6VOULIJmM-thJAhf8oaA5Ckg,1964
|
|
33
33
|
luna_sdk/repositories/cplex_repo.py,sha256=6vlx6YTJoDSWFSZDDNrPk3E7pa5WWGqG25bhTwQdqHQ,5098
|
|
34
34
|
luna_sdk/repositories/info_repo.py,sha256=GzRW5RwhRJrNjujw8Y7vJY8vV_tHzbfwXo0viHuxqUM,1270
|
|
35
35
|
luna_sdk/repositories/lp_repo.py,sha256=T44XMbdbW7k9a4z6JgIj1kb0bBZxepn-93vxdZOQa80,4370
|
|
36
36
|
luna_sdk/repositories/optimization_repo.py,sha256=xHjMdXhzdwt9DtZG7AvGtUgOqWH142veOpAzaNe-nxk,6078
|
|
37
|
-
luna_sdk/repositories/qpu_token_repo.py,sha256=
|
|
38
|
-
luna_sdk/repositories/solutions_repo.py,sha256=
|
|
37
|
+
luna_sdk/repositories/qpu_token_repo.py,sha256=Mn3ojxXhLIC-zbjBzEJis6WKNHUYUVkex_qTcuXeQ3Y,4685
|
|
38
|
+
luna_sdk/repositories/solutions_repo.py,sha256=xI1KQ1JeleBJrBRFxfuxdusb_pgjBLeLhdpFi7nqdXY,8825
|
|
39
39
|
luna_sdk/schemas/__init__.py,sha256=lTix3zUl2Z8ZLA2BTF4pls5S-kqlVZ3cIdAZwGxPSUI,248
|
|
40
40
|
luna_sdk/schemas/circuit.py,sha256=r3Bv0lyhrvFoI3Gf8eq-PS3kyivTWY3IJmRH0X2LoCk,1067
|
|
41
41
|
luna_sdk/schemas/create/__init__.py,sha256=7G2yflImpZJxHn3l4Op5CsQAxwKGmvWJSttq9kmiHq0,90
|
|
42
|
-
luna_sdk/schemas/create/circuit.py,sha256=
|
|
42
|
+
luna_sdk/schemas/create/circuit.py,sha256=zYtM6SV1QH4JzjYaAhrGNjdNn8EDYsdG1QKwayTqkEY,643
|
|
43
43
|
luna_sdk/schemas/create/optimization.py,sha256=Z9pKoD0y6BjKvl8gQ6XK76bdvq8etvcoNU4RwxnUvHA,759
|
|
44
|
-
luna_sdk/schemas/create/qpu_token.py,sha256=
|
|
44
|
+
luna_sdk/schemas/create/qpu_token.py,sha256=_D_QtYOeZQ6b0lG5ALTDmyr4bU42bUZ8OJ0VdwadMNA,380
|
|
45
45
|
luna_sdk/schemas/create/qubo.py,sha256=5Y_jWicEnoV82Ubc-f0a_qy9hCuPBumhsGWY8wzMIuA,293
|
|
46
|
-
luna_sdk/schemas/create/solution.py,sha256=
|
|
46
|
+
luna_sdk/schemas/create/solution.py,sha256=zPPgm0wGwfn23ccgBoYs6SMTZNmbT_uO1po_je15WjA,386
|
|
47
47
|
luna_sdk/schemas/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
48
|
luna_sdk/schemas/enums/circuit.py,sha256=smz_DouDo_K8rs4N5aIOj2PS9w6DX1CFYX0bv6f6JFw,252
|
|
49
49
|
luna_sdk/schemas/enums/optimization.py,sha256=XtFdcfLxGe-MAL64itjxszhRkTcUzUf83tO-5DBVLeY,198
|
|
@@ -53,7 +53,7 @@ luna_sdk/schemas/enums/solution.py,sha256=Vax6MX62UDwApbwzf1nrhuFWw1Iiq77gUch7_1
|
|
|
53
53
|
luna_sdk/schemas/enums/status.py,sha256=KHaOgePqB3GNhFYLo2Sp-JAEXBPN_ZVDmj2WobrT5N4,204
|
|
54
54
|
luna_sdk/schemas/enums/timeframe.py,sha256=vwoZsgAYGvqF67qdcXMEnHkqbiRcVY5uK-4-ZTFcurI,238
|
|
55
55
|
luna_sdk/schemas/error_message.py,sha256=svCs-mWQsp3BMEhzZFqskbyP6iS78eVUOPaiWFc4sEQ,307
|
|
56
|
-
luna_sdk/schemas/optimization.py,sha256=
|
|
56
|
+
luna_sdk/schemas/optimization.py,sha256=X7Eb7K7ximWpmtIItn2sJEgxgN8dmlvuioQV-Q71BrY,3174
|
|
57
57
|
luna_sdk/schemas/optimization_formats/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
58
|
luna_sdk/schemas/optimization_formats/bqm.py,sha256=rrmiZYe_iEdgBFusJeJfY8PVSxgf1Wv79FgMQUm2YVs,910
|
|
59
59
|
luna_sdk/schemas/optimization_formats/cqm.py,sha256=VZiNJy4yc-8o3gHoH0E-uaNOHj7UfAGCqznTzKBv0NQ,4257
|
|
@@ -67,14 +67,14 @@ luna_sdk/schemas/rest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
|
67
67
|
luna_sdk/schemas/rest/qpu_token/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
68
|
luna_sdk/schemas/rest/qpu_token/qpu_token_source.py,sha256=EPMXHpgxqsQ4uJ1hlwe5gPdSsjuHEuKKAIMtBFgPJ1A,583
|
|
69
69
|
luna_sdk/schemas/rest/qpu_token/token_provider.py,sha256=3Gecn2AmN7E_wAPUac_c55Fg-LwdDKsgbwAN2-0msJU,2985
|
|
70
|
-
luna_sdk/schemas/solution.py,sha256=
|
|
70
|
+
luna_sdk/schemas/solution.py,sha256=3I4J-7UXNV95kpK0yjB4iPdq2lx3KB_cZ81m4WNbWwg,8684
|
|
71
71
|
luna_sdk/schemas/solver_info.py,sha256=ZUCdTI8zpPZ8EquLYyrLU35pZ4VkzcPUSYeQWkdijHM,799
|
|
72
72
|
luna_sdk/schemas/solver_parameters/aws/__init__.py,sha256=CXjKWzgnP_d1_RvQUfWyaaWvsZ1FxLJN5K61QmRa-uw,33
|
|
73
73
|
luna_sdk/schemas/solver_parameters/aws/optimizer_params.py,sha256=w0eg1SnTpKnuq48YG8JAC1LY0bxsTlZIJ2XbT2ySTHw,1374
|
|
74
74
|
luna_sdk/schemas/solver_parameters/aws/qaoa.py,sha256=Mc7zfdWgLxh2Kb0r5OmL3RIkYlB1mnu6jUpmfYG2BBg,2290
|
|
75
75
|
luna_sdk/schemas/solver_parameters/base_parameter.py,sha256=v8nk1aVKW_MaePxxNXXb3hcVDtzkQF1sGlvZ2YXXJVI,123
|
|
76
76
|
luna_sdk/schemas/solver_parameters/dwave/__init__.py,sha256=yHsBQ5d1mCS90Y1JcTCOPjNCrEiGT23wI9GyPnYlIqo,2453
|
|
77
|
-
luna_sdk/schemas/solver_parameters/dwave/base.py,sha256=
|
|
77
|
+
luna_sdk/schemas/solver_parameters/dwave/base.py,sha256=z3zWZQAqDJU5dVY5sYTMe8Sxq92SIjhWlfBAmbsowE4,17364
|
|
78
78
|
luna_sdk/schemas/solver_parameters/dwave/dialectic_search.py,sha256=CnXg7rcZ7mHkbSLrYXPot3-73YiWTRhkhyRmjZ_pvvs,1205
|
|
79
79
|
luna_sdk/schemas/solver_parameters/dwave/kerberos.py,sha256=OPzCgo9h5845R3Sg_TrSkwp4gjoRKEHxhAhSdcJxY6c,2674
|
|
80
80
|
luna_sdk/schemas/solver_parameters/dwave/leap_hybrid_bqm.py,sha256=foPfMJLQ0enO3omknKuqIxfZTXd9oIbfi_e-N0o2tmM,637
|
|
@@ -87,12 +87,12 @@ luna_sdk/schemas/solver_parameters/dwave/qaga.py,sha256=gVucZ_1feFb7aKl6W2m34_Hx
|
|
|
87
87
|
luna_sdk/schemas/solver_parameters/dwave/qbsolv_like_qpu.py,sha256=d72lNLdtD-G6WtVGwqmCse9r_O3inDAbLc6tbDlyu-Y,554
|
|
88
88
|
luna_sdk/schemas/solver_parameters/dwave/qbsolv_like_simulated_annealing.py,sha256=wo5Gt6A-N7APE2Nhz_eOhxmW7P_IYTzvdDKe-4kIMn4,976
|
|
89
89
|
luna_sdk/schemas/solver_parameters/dwave/qbsolv_like_tabu_search.py,sha256=5r5piwo5BsAAlXmyqYMxXZDvgVTvjdJ2hVMr7-7h_lk,840
|
|
90
|
-
luna_sdk/schemas/solver_parameters/dwave/quantum_annealing.py,sha256=
|
|
91
|
-
luna_sdk/schemas/solver_parameters/dwave/repeated_reverse_quantum_annealing.py,sha256=
|
|
90
|
+
luna_sdk/schemas/solver_parameters/dwave/quantum_annealing.py,sha256=V00ZV2XMaYv9TZSezFm36kDUgiHpwBKG6K2t38ebgvY,1008
|
|
91
|
+
luna_sdk/schemas/solver_parameters/dwave/repeated_reverse_quantum_annealing.py,sha256=Y04GIwLAergf-6QXSsdZzdhuxYPsSwTf0Np9ahCwUTQ,4117
|
|
92
92
|
luna_sdk/schemas/solver_parameters/dwave/repeated_reverse_simulated_annealing.py,sha256=UeLr2MnPS3zTBQgH6eq5hYvPJpOjQjqG-shHuQ8Ct0M,4569
|
|
93
93
|
luna_sdk/schemas/solver_parameters/dwave/saga.py,sha256=pXWGZVXRgSMJRi3-NuyO7moai198cWXeGbvq5We-1EE,3118
|
|
94
94
|
luna_sdk/schemas/solver_parameters/dwave/simulated_annealing.py,sha256=cU2UoN8xo3iM34LJhaLc-tYsCo-RqpOstiktEi79QRU,4047
|
|
95
|
-
luna_sdk/schemas/solver_parameters/dwave/tabu_search.py,sha256=
|
|
95
|
+
luna_sdk/schemas/solver_parameters/dwave/tabu_search.py,sha256=M027TrynHGPFWuzXcBwVaJz3J-Qf38k5poQRVqi7jLw,3885
|
|
96
96
|
luna_sdk/schemas/solver_parameters/fujitsu/__init__.py,sha256=V4CSTiNSmtBvNuQpxiTZqX9T-oV4M8hZGQ_eO5Ro8vU,549
|
|
97
97
|
luna_sdk/schemas/solver_parameters/fujitsu/base.py,sha256=yDM2sLBtg-a5OsD3GqwTd-HMmIwJtubbP_QxQcrkDnA,1813
|
|
98
98
|
luna_sdk/schemas/solver_parameters/fujitsu/digital_annealer_cpu.py,sha256=EBPE7mwtUNs5CmyVkdWV9jQT_YnW8FWsYQ0VyCHBVNM,9747
|
|
@@ -160,7 +160,7 @@ luna_sdk/schemas/wrappers/datetime_wrapper.py,sha256=6usmPJNRYA4Fe_-0NGwe7RYams4
|
|
|
160
160
|
luna_sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
161
161
|
luna_sdk/utils/parameter_finder.py,sha256=LKkd1upH3Djd6eqkcSQ2feNwPUiKi8soYkx6JT1_VSg,2937
|
|
162
162
|
luna_sdk/utils/qpu_tokens.py,sha256=xrh5KSoWzbul-6eRa0ELH9iwEENanE7PIms7jlCt3NY,1641
|
|
163
|
-
luna_quantum-0.0.
|
|
164
|
-
luna_quantum-0.0.
|
|
165
|
-
luna_quantum-0.0.
|
|
166
|
-
luna_quantum-0.0.
|
|
163
|
+
luna_quantum-0.0.37.dist-info/LICENSE,sha256=rwwuFPLz36oRvjWu2oEeX42Qtn9gmbh7zRC2OqCFNaI,11342
|
|
164
|
+
luna_quantum-0.0.37.dist-info/METADATA,sha256=199H7vfTIgzdGHF0Bz6eFhCtJnhHMiQuxl93YicnhYk,2311
|
|
165
|
+
luna_quantum-0.0.37.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
166
|
+
luna_quantum-0.0.37.dist-info/RECORD,,
|
|
@@ -15,7 +15,6 @@ class ICircuitRepo(IRepository, ABC):
|
|
|
15
15
|
provider: CircuitProviderEnum,
|
|
16
16
|
params: Dict[str, Any] = {},
|
|
17
17
|
qpu_tokens: Optional[TokenProvider] = None,
|
|
18
|
-
encryption_key: Optional[str] = None,
|
|
19
18
|
**kwargs,
|
|
20
19
|
) -> CircuitJob:
|
|
21
20
|
"""
|
|
@@ -31,8 +30,6 @@ class ICircuitRepo(IRepository, ABC):
|
|
|
31
30
|
Additional parameters of the circuit.
|
|
32
31
|
qpu_tokens: Optional[TokenProvider]
|
|
33
32
|
The tokens to be used for the QPU.
|
|
34
|
-
encryption_key: Optional[str]
|
|
35
|
-
Encryption key to be used for encryption of QPU tokens.
|
|
36
33
|
**kwargs
|
|
37
34
|
Parameters to pass to `httpx.request`.
|
|
38
35
|
|
|
@@ -47,7 +44,6 @@ class ICircuitRepo(IRepository, ABC):
|
|
|
47
44
|
def get(
|
|
48
45
|
self,
|
|
49
46
|
job: CircuitJob,
|
|
50
|
-
encryption_key: Optional[str] = None,
|
|
51
47
|
**kwargs,
|
|
52
48
|
) -> CircuitResult:
|
|
53
49
|
"""
|
|
@@ -55,8 +51,6 @@ class ICircuitRepo(IRepository, ABC):
|
|
|
55
51
|
|
|
56
52
|
Parameters
|
|
57
53
|
----------
|
|
58
|
-
encryption_key: Optional[str]
|
|
59
|
-
Encryption key to be used for encryption of QPU tokens.
|
|
60
54
|
**kwargs
|
|
61
55
|
Parameters to pass to `httpx.request`.
|
|
62
56
|
|
|
@@ -14,7 +14,6 @@ class IQpuTokenRepo(IRepository, ABC):
|
|
|
14
14
|
provider: str,
|
|
15
15
|
token: str,
|
|
16
16
|
token_type: QpuTokenTypeEnum,
|
|
17
|
-
encryption_key: Optional[str] = None,
|
|
18
17
|
**kwargs,
|
|
19
18
|
) -> QpuTokenOut:
|
|
20
19
|
"""
|
|
@@ -32,8 +31,6 @@ class IQpuTokenRepo(IRepository, ABC):
|
|
|
32
31
|
There are two types of QPU tokens: PERSONAL and GROUP.
|
|
33
32
|
All users of a group can use group QPU tokens.
|
|
34
33
|
User QPU tokens can only be used by the user who created them.
|
|
35
|
-
encryption_key: Optional[str]
|
|
36
|
-
Encryption key to be used for encryption of QPU tokens.
|
|
37
34
|
**kwargs
|
|
38
35
|
Parameters to pass to `httpx.request`.
|
|
39
36
|
|
|
@@ -48,7 +45,6 @@ class IQpuTokenRepo(IRepository, ABC):
|
|
|
48
45
|
def get_all(
|
|
49
46
|
self,
|
|
50
47
|
filter_provider: Optional[str] = None,
|
|
51
|
-
name: Optional[str] = None,
|
|
52
48
|
token_type: Optional[QpuTokenTypeEnum] = None,
|
|
53
49
|
limit: Optional[int] = None,
|
|
54
50
|
offset: Optional[int] = None,
|
|
@@ -61,8 +57,6 @@ class IQpuTokenRepo(IRepository, ABC):
|
|
|
61
57
|
----------
|
|
62
58
|
filter_provider: Optional[str]
|
|
63
59
|
The provider for which qpu tokens should be retrieved
|
|
64
|
-
name: Optional[str]
|
|
65
|
-
Name of the QPU token that should be retrieved
|
|
66
60
|
token_type: Optional[QpuTokenTypeEnum]
|
|
67
61
|
If you want to retrieve only user or group QPU tokens
|
|
68
62
|
otherwise all QPU tokens will be retrieved
|
|
@@ -108,7 +108,6 @@ class ISolutionsRepo(IRepository, ABC):
|
|
|
108
108
|
provider: str,
|
|
109
109
|
qpu_tokens: Optional[TokenProvider] = None,
|
|
110
110
|
solver_parameters: Optional[Union[Dict[str, Any], BaseModel]] = None,
|
|
111
|
-
encryption_key: Optional[str] = None,
|
|
112
111
|
name: Optional[str] = None,
|
|
113
112
|
fail_on_invalid_params: bool = True,
|
|
114
113
|
**kwargs,
|
|
@@ -128,8 +127,6 @@ class ISolutionsRepo(IRepository, ABC):
|
|
|
128
127
|
The tokens to be used for the QPU.
|
|
129
128
|
solver_parameters: Optional[Union[Dict[str, Any], BaseModel]]
|
|
130
129
|
Parameters to be passed to the solver.
|
|
131
|
-
encryption_key: Optional[str]
|
|
132
|
-
Encryption key to be used for encryption of QPU tokens.
|
|
133
130
|
name: Optional[str]
|
|
134
131
|
Default: None, The name of the solution to create.
|
|
135
132
|
fail_on_invalid_params: bool
|
|
@@ -155,7 +152,6 @@ class ISolutionsRepo(IRepository, ABC):
|
|
|
155
152
|
sleep_time_max: float = 60.0,
|
|
156
153
|
sleep_time_increment: float = 5.0,
|
|
157
154
|
sleep_time_initial: float = 5.0,
|
|
158
|
-
encryption_key: Optional[str] = None,
|
|
159
155
|
name: Optional[str] = None,
|
|
160
156
|
fail_on_invalid_params: bool = True,
|
|
161
157
|
**kwargs,
|
|
@@ -182,8 +178,6 @@ class ISolutionsRepo(IRepository, ABC):
|
|
|
182
178
|
Increment of sleep time between requests. Initial sleep time will be
|
|
183
179
|
sleep_time_initial: float
|
|
184
180
|
Initial sleep time.
|
|
185
|
-
encryption_key: Optional[str]
|
|
186
|
-
Encryption key to be used for encryption of QPU tokens.
|
|
187
181
|
name: Optional[str]
|
|
188
182
|
Default: None, The name of the solution to create.
|
|
189
183
|
fail_on_invalid_params: bool
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
from typing import Any, Dict, Optional
|
|
3
3
|
|
|
4
|
-
from luna_sdk.exceptions.encryption_exception import EncryptionNotSetException
|
|
5
4
|
from luna_sdk.interfaces.circuit_repo_i import ICircuitRepo
|
|
6
5
|
from luna_sdk.schemas.circuit import CircuitJob, CircuitResult
|
|
7
6
|
from luna_sdk.schemas.create.circuit import CircuitIn
|
|
@@ -20,7 +19,6 @@ class CircuitRepo(ICircuitRepo):
|
|
|
20
19
|
provider: CircuitProviderEnum,
|
|
21
20
|
params: Dict[str, Any] = {},
|
|
22
21
|
qpu_tokens: Optional[TokenProvider] = None,
|
|
23
|
-
encryption_key: Optional[str] = None,
|
|
24
22
|
**kwargs,
|
|
25
23
|
) -> CircuitJob:
|
|
26
24
|
if qpu_tokens is not None:
|
|
@@ -34,15 +32,11 @@ class CircuitRepo(ICircuitRepo):
|
|
|
34
32
|
if rest_qpu_tokens is None:
|
|
35
33
|
rest_qpu_tokens = extract_qpu_tokens_from_env()
|
|
36
34
|
|
|
37
|
-
encryption_key = encryption_key or os.environ.get("LUNA_ENCRYPTION_KEY")
|
|
38
|
-
if encryption_key is None:
|
|
39
|
-
raise EncryptionNotSetException
|
|
40
35
|
circuit_in: CircuitIn = CircuitIn(
|
|
41
36
|
provider=provider,
|
|
42
37
|
circuit=circuit,
|
|
43
38
|
params=params,
|
|
44
39
|
qpu_tokens=rest_qpu_tokens,
|
|
45
|
-
encryption_key=encryption_key,
|
|
46
40
|
)
|
|
47
41
|
|
|
48
42
|
response = self._client.post(
|
|
@@ -55,16 +49,11 @@ class CircuitRepo(ICircuitRepo):
|
|
|
55
49
|
def get(
|
|
56
50
|
self,
|
|
57
51
|
job: CircuitJob,
|
|
58
|
-
encryption_key: Optional[str] = None,
|
|
59
52
|
**kwargs,
|
|
60
53
|
) -> CircuitResult:
|
|
61
54
|
url = f"{self._endpoint}/{job.id}/{job.provider.value}"
|
|
62
|
-
encryption_key = encryption_key or os.environ.get("LUNA_ENCRYPTION_KEY")
|
|
63
|
-
if encryption_key is None:
|
|
64
|
-
raise EncryptionNotSetException
|
|
65
55
|
if job.params is None:
|
|
66
56
|
job.params = {}
|
|
67
|
-
job.params["encryption_key"] = encryption_key
|
|
68
57
|
response = self._client.get(url, params=job.params, **kwargs)
|
|
69
58
|
|
|
70
59
|
response.raise_for_status()
|
|
@@ -3,14 +3,18 @@ import os
|
|
|
3
3
|
from typing import Dict, List, Optional
|
|
4
4
|
|
|
5
5
|
from httpx import Response
|
|
6
|
+
from pydantic import TypeAdapter
|
|
6
7
|
|
|
7
|
-
from luna_sdk.exceptions.encryption_exception import EncryptionNotSetException
|
|
8
8
|
from luna_sdk.interfaces.qpu_token_repo_i import IQpuTokenRepo
|
|
9
9
|
from luna_sdk.schemas import QpuTokenOut
|
|
10
10
|
from luna_sdk.schemas.create import QpuTokenIn
|
|
11
11
|
from luna_sdk.schemas.enums.qpu_token_type import QpuTokenTypeEnum
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
_ORGANIZATION_QPU_TOKENS_BACKEND = "shared"
|
|
15
|
+
_PERSONAL_QPU_TOKENS_BACKEND = "private"
|
|
16
|
+
|
|
17
|
+
|
|
14
18
|
class QpuTokenRepo(IQpuTokenRepo):
|
|
15
19
|
@property
|
|
16
20
|
def _endpoint(self) -> str:
|
|
@@ -22,9 +26,9 @@ class QpuTokenRepo(IQpuTokenRepo):
|
|
|
22
26
|
if token_type is None:
|
|
23
27
|
return f"{self._endpoint}"
|
|
24
28
|
elif token_type == QpuTokenTypeEnum.PERSONAL:
|
|
25
|
-
return f"{self._endpoint}/
|
|
29
|
+
return f"{self._endpoint}/{_PERSONAL_QPU_TOKENS_BACKEND}"
|
|
26
30
|
else:
|
|
27
|
-
return f"{self._endpoint}/
|
|
31
|
+
return f"{self._endpoint}/{_ORGANIZATION_QPU_TOKENS_BACKEND}"
|
|
28
32
|
|
|
29
33
|
def _get_by_name(
|
|
30
34
|
self, name: str, token_type: QpuTokenTypeEnum, **kwargs
|
|
@@ -44,17 +48,12 @@ class QpuTokenRepo(IQpuTokenRepo):
|
|
|
44
48
|
provider: str,
|
|
45
49
|
token: str,
|
|
46
50
|
token_type: QpuTokenTypeEnum,
|
|
47
|
-
encryption_key: Optional[str] = None,
|
|
48
51
|
**kwargs,
|
|
49
52
|
) -> QpuTokenOut:
|
|
50
|
-
encryption_key = encryption_key or os.environ.get("LUNA_ENCRYPTION_KEY")
|
|
51
|
-
if encryption_key is None:
|
|
52
|
-
raise EncryptionNotSetException
|
|
53
53
|
qpu_token = QpuTokenIn(
|
|
54
54
|
name=name,
|
|
55
55
|
provider=provider,
|
|
56
56
|
token=token,
|
|
57
|
-
encryption_key=encryption_key,
|
|
58
57
|
)
|
|
59
58
|
|
|
60
59
|
response: Response = self._client.post(
|
|
@@ -70,7 +69,6 @@ class QpuTokenRepo(IQpuTokenRepo):
|
|
|
70
69
|
def get_all(
|
|
71
70
|
self,
|
|
72
71
|
filter_provider: Optional[str] = None,
|
|
73
|
-
name: Optional[str] = None,
|
|
74
72
|
token_type: Optional[QpuTokenTypeEnum] = None,
|
|
75
73
|
limit: Optional[int] = None,
|
|
76
74
|
offset: Optional[int] = None,
|
|
@@ -80,38 +78,33 @@ class QpuTokenRepo(IQpuTokenRepo):
|
|
|
80
78
|
if filter_provider:
|
|
81
79
|
params["filter_provider"] = filter_provider
|
|
82
80
|
|
|
83
|
-
if name:
|
|
84
|
-
params["name"] = name
|
|
85
81
|
if limit is not None:
|
|
86
82
|
params["limit"] = str(limit)
|
|
87
83
|
if offset is not None:
|
|
88
84
|
params["offset"] = str(offset)
|
|
89
|
-
|
|
85
|
+
if token_type == QpuTokenTypeEnum.PERSONAL:
|
|
86
|
+
params["token_type"] = _PERSONAL_QPU_TOKENS_BACKEND
|
|
87
|
+
if token_type == QpuTokenTypeEnum.GROUP:
|
|
88
|
+
params["token_type"] = _ORGANIZATION_QPU_TOKENS_BACKEND
|
|
89
|
+
|
|
90
|
+
response = self._client.get(
|
|
91
|
+
self._endpoint,
|
|
92
|
+
params=params,
|
|
93
|
+
**kwargs,
|
|
94
|
+
)
|
|
95
|
+
ta = TypeAdapter(List[QpuTokenOut])
|
|
90
96
|
to_return: Dict[QpuTokenTypeEnum, List[QpuTokenOut]] = {}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
]
|
|
103
|
-
if token_type is None or token_type == QpuTokenTypeEnum.GROUP:
|
|
104
|
-
response = self._client.get(
|
|
105
|
-
self._get_endpoint_by_type(QpuTokenTypeEnum.GROUP),
|
|
106
|
-
params=params,
|
|
107
|
-
**kwargs,
|
|
108
|
-
)
|
|
109
|
-
response.raise_for_status()
|
|
110
|
-
shared_qpu_tokens = response.json()
|
|
111
|
-
to_return[QpuTokenTypeEnum.GROUP] = [
|
|
112
|
-
QpuTokenOut(**qpu_token, token_type=QpuTokenTypeEnum.GROUP)
|
|
113
|
-
for qpu_token in shared_qpu_tokens
|
|
114
|
-
]
|
|
97
|
+
resp = response.json()
|
|
98
|
+
|
|
99
|
+
shared_tokens = resp.get(_ORGANIZATION_QPU_TOKENS_BACKEND, [])
|
|
100
|
+
for qpu_token in shared_tokens:
|
|
101
|
+
qpu_token["token_type"] = QpuTokenTypeEnum.GROUP
|
|
102
|
+
to_return[QpuTokenTypeEnum.GROUP] = ta.validate_python(shared_tokens)
|
|
103
|
+
|
|
104
|
+
personal_tokens = resp.get(_PERSONAL_QPU_TOKENS_BACKEND, [])
|
|
105
|
+
for qpu_token in personal_tokens:
|
|
106
|
+
qpu_token["token_type"] = QpuTokenTypeEnum.PERSONAL
|
|
107
|
+
to_return[QpuTokenTypeEnum.PERSONAL] = ta.validate_python(personal_tokens)
|
|
115
108
|
|
|
116
109
|
return to_return
|
|
117
110
|
|
|
@@ -5,7 +5,6 @@ from typing import Any, Dict, List, Optional, Type, Union
|
|
|
5
5
|
|
|
6
6
|
from pydantic import BaseModel, ValidationError
|
|
7
7
|
|
|
8
|
-
from luna_sdk.exceptions.encryption_exception import EncryptionNotSetException
|
|
9
8
|
from luna_sdk.interfaces.solutions_repo_i import ISolutionsRepo
|
|
10
9
|
from luna_sdk.schemas.create.solution import SolutionIn
|
|
11
10
|
from luna_sdk.schemas.enums.solution import SenseEnum
|
|
@@ -70,7 +69,6 @@ class SolutionsRepo(ISolutionsRepo):
|
|
|
70
69
|
provider: str,
|
|
71
70
|
qpu_tokens: Optional[TokenProvider] = None,
|
|
72
71
|
solver_parameters: Optional[Union[Dict[str, Any], BaseModel]] = None,
|
|
73
|
-
encryption_key: Optional[str] = None,
|
|
74
72
|
name: Optional[str] = None,
|
|
75
73
|
fail_on_invalid_params: bool = True,
|
|
76
74
|
**kwargs,
|
|
@@ -85,9 +83,6 @@ class SolutionsRepo(ISolutionsRepo):
|
|
|
85
83
|
if rest_qpu_tokens is None:
|
|
86
84
|
rest_qpu_tokens = extract_qpu_tokens_from_env()
|
|
87
85
|
|
|
88
|
-
encryption_key = encryption_key or os.environ.get("LUNA_ENCRYPTION_KEY")
|
|
89
|
-
if encryption_key is None:
|
|
90
|
-
raise EncryptionNotSetException
|
|
91
86
|
params = SolutionsRepo.validate_solver_params(
|
|
92
87
|
solver_name, provider, solver_parameters, fail_on_invalid_params
|
|
93
88
|
)
|
|
@@ -98,7 +93,6 @@ class SolutionsRepo(ISolutionsRepo):
|
|
|
98
93
|
provider=provider,
|
|
99
94
|
parameters=params,
|
|
100
95
|
qpu_tokens=rest_qpu_tokens,
|
|
101
|
-
encryption_key=encryption_key,
|
|
102
96
|
name=name,
|
|
103
97
|
)
|
|
104
98
|
response = self._client.post(
|
|
@@ -118,7 +112,6 @@ class SolutionsRepo(ISolutionsRepo):
|
|
|
118
112
|
sleep_time_max: float = 60.0,
|
|
119
113
|
sleep_time_increment: float = 5.0,
|
|
120
114
|
sleep_time_initial: float = 5.0,
|
|
121
|
-
encryption_key: Optional[str] = None,
|
|
122
115
|
name: Optional[str] = None,
|
|
123
116
|
fail_on_invalid_params: bool = True,
|
|
124
117
|
**kwargs,
|
|
@@ -134,7 +127,6 @@ class SolutionsRepo(ISolutionsRepo):
|
|
|
134
127
|
provider=provider,
|
|
135
128
|
solver_parameters=params,
|
|
136
129
|
qpu_tokens=qpu_tokens,
|
|
137
|
-
encryption_key=encryption_key,
|
|
138
130
|
name=name,
|
|
139
131
|
**kwargs,
|
|
140
132
|
)
|
|
@@ -18,12 +18,9 @@ class CircuitIn(BaseModel):
|
|
|
18
18
|
The QASM circuit
|
|
19
19
|
params: Dict[str, Any]
|
|
20
20
|
Additional parameters
|
|
21
|
-
encryption_key: str
|
|
22
|
-
Encryption key to be used for encryption of QPU tokens.
|
|
23
21
|
"""
|
|
24
22
|
|
|
25
23
|
provider: CircuitProviderEnum
|
|
26
24
|
circuit: str
|
|
27
25
|
params: Dict[str, Any] = {}
|
|
28
26
|
qpu_tokens: Optional[RestAPITokenProvider] = None
|
|
29
|
-
encryption_key: str
|
|
@@ -13,14 +13,11 @@ class QpuTokenIn(BaseModel):
|
|
|
13
13
|
Name of provider
|
|
14
14
|
token: str
|
|
15
15
|
Token
|
|
16
|
-
encryption_key: str
|
|
17
|
-
Encryption key to be used for encryption of QPU tokens.
|
|
18
16
|
"""
|
|
19
17
|
|
|
20
18
|
name: str
|
|
21
19
|
provider: str
|
|
22
20
|
token: str
|
|
23
|
-
encryption_key: str
|
|
24
21
|
|
|
25
22
|
class Config:
|
|
26
23
|
extra = Extra.forbid
|
luna_sdk/schemas/optimization.py
CHANGED
|
@@ -38,6 +38,51 @@ class Optimization(PrettyBase):
|
|
|
38
38
|
use_case_name: Optional[str] = None
|
|
39
39
|
params: Optional[Dict[str, Any]] = None
|
|
40
40
|
|
|
41
|
+
verbose: bool = False
|
|
42
|
+
|
|
43
|
+
def __str__(self):
|
|
44
|
+
if self.verbose:
|
|
45
|
+
return self.details()
|
|
46
|
+
return self.subset()
|
|
47
|
+
|
|
48
|
+
def details(self):
|
|
49
|
+
trimmed_keys = [
|
|
50
|
+
"verbose",
|
|
51
|
+
]
|
|
52
|
+
data = self.model_dump()
|
|
53
|
+
output = ""
|
|
54
|
+
data_subset = {key: data[key] for key in data if key not in trimmed_keys}
|
|
55
|
+
ordered_subset = {
|
|
56
|
+
"id": data_subset.pop("id"),
|
|
57
|
+
"name": data_subset.pop("name"),
|
|
58
|
+
"original_format": data_subset.pop("original_format"),
|
|
59
|
+
**data_subset,
|
|
60
|
+
}
|
|
61
|
+
output += self._pretty_print(ordered_subset)
|
|
62
|
+
return output
|
|
63
|
+
|
|
64
|
+
def subset(self):
|
|
65
|
+
trimmed_keys = [
|
|
66
|
+
"created_by",
|
|
67
|
+
"modified_date",
|
|
68
|
+
"modified_by",
|
|
69
|
+
"use_case_name",
|
|
70
|
+
"params",
|
|
71
|
+
"verbose",
|
|
72
|
+
]
|
|
73
|
+
data = self.model_dump()
|
|
74
|
+
output = ""
|
|
75
|
+
data_subset = {key: data[key] for key in data if key not in trimmed_keys}
|
|
76
|
+
|
|
77
|
+
ordered_subset = {
|
|
78
|
+
"id": data_subset.pop("id"),
|
|
79
|
+
"name": data_subset.pop("name"),
|
|
80
|
+
"original_format": data_subset.pop("original_format"),
|
|
81
|
+
**data_subset,
|
|
82
|
+
}
|
|
83
|
+
output += self._pretty_print(ordered_subset)
|
|
84
|
+
return output
|
|
85
|
+
|
|
41
86
|
model_config = ConfigDict(extra="ignore", from_attributes=False)
|
|
42
87
|
|
|
43
88
|
|
luna_sdk/schemas/solution.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
from datetime import datetime
|
|
1
2
|
from typing import Any, Dict, List, Optional, Union
|
|
2
3
|
|
|
3
4
|
from pydantic import BaseModel
|
|
4
5
|
|
|
6
|
+
from luna_sdk.schemas.enums.optimization import OptFormat
|
|
5
7
|
from luna_sdk.schemas.enums.solution import SenseEnum
|
|
6
8
|
from luna_sdk.schemas.enums.status import StatusEnum
|
|
7
9
|
from luna_sdk.schemas.optimization import Optimization
|
|
@@ -105,45 +107,17 @@ class Solution(PrettyBase):
|
|
|
105
107
|
solver: str
|
|
106
108
|
provider: str
|
|
107
109
|
status: StatusEnum
|
|
110
|
+
status_timeline: Dict[StatusEnum, datetime] = {}
|
|
111
|
+
used_format: Optional[OptFormat] = None
|
|
108
112
|
optimization: Union[Optimization, str]
|
|
109
113
|
representation: Optional[Any] = None
|
|
110
114
|
|
|
111
|
-
|
|
112
|
-
"""Overwrite the default object string representation to use the custom pretty print console representation"""
|
|
113
|
-
data = self.model_dump()
|
|
114
|
-
results = data.pop("results") # Extract and remove results from data
|
|
115
|
-
metadata = data.pop("metadata") # Extract and remove metadata from data
|
|
116
|
-
provider = data["provider"]
|
|
115
|
+
verbose: bool = False
|
|
117
116
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
output += self._pretty_print(data)
|
|
123
|
-
|
|
124
|
-
# Build Results section
|
|
125
|
-
if results:
|
|
126
|
-
output += f"\n\n{divider}RESULTS:\n{divider}"
|
|
127
|
-
for i, result in enumerate(results, start=1):
|
|
128
|
-
r = f"Result {i}:\n"
|
|
129
|
-
r += f" {result}\n"
|
|
130
|
-
output += r
|
|
131
|
-
else:
|
|
132
|
-
output += f"\n\n{divider}RESULTS:\n{divider}"
|
|
133
|
-
output += " No results..\n"
|
|
134
|
-
output += " Solution has status: " + str(self.status.value) + "\n"
|
|
135
|
-
if self.error_message:
|
|
136
|
-
output += " Error message: " + str(self.error_message) + "\n"
|
|
137
|
-
|
|
138
|
-
# Build Provider Meta Data section
|
|
139
|
-
output += f"\n\n{divider}{provider.upper()} META DATA:\n{divider}"
|
|
140
|
-
output += (
|
|
141
|
-
self._pretty_print(metadata)
|
|
142
|
-
if metadata
|
|
143
|
-
else " No metadata from provider..\n"
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
return output
|
|
117
|
+
def __str__(self):
|
|
118
|
+
if self.verbose:
|
|
119
|
+
return self.details()
|
|
120
|
+
return self.subset()
|
|
147
121
|
|
|
148
122
|
@property
|
|
149
123
|
def head(self):
|
|
@@ -216,6 +190,86 @@ class Solution(PrettyBase):
|
|
|
216
190
|
|
|
217
191
|
return output
|
|
218
192
|
|
|
193
|
+
def details(self):
|
|
194
|
+
"""Overwrite the default object string representation to use the custom pretty print console representation"""
|
|
195
|
+
data = self.model_dump()
|
|
196
|
+
results = data.pop("results") # Extract and remove results from data
|
|
197
|
+
metadata = data.pop("metadata") # Extract and remove metadata from data
|
|
198
|
+
provider = data["provider"]
|
|
199
|
+
|
|
200
|
+
divider = "--------------------------------------------------------------------------------\n"
|
|
201
|
+
|
|
202
|
+
# Build Meta Data section
|
|
203
|
+
output = f"{divider}META DATA:\n{divider}"
|
|
204
|
+
output += self._pretty_print(data)
|
|
205
|
+
|
|
206
|
+
# Build Results section
|
|
207
|
+
if results:
|
|
208
|
+
output += f"\n\n{divider}RESULTS:\n{divider}"
|
|
209
|
+
for i, result in enumerate(results, start=1):
|
|
210
|
+
r = f"Result {i}:\n"
|
|
211
|
+
r += f" {result}\n"
|
|
212
|
+
output += r
|
|
213
|
+
else:
|
|
214
|
+
output += f"\n\n{divider}RESULTS:\n{divider}"
|
|
215
|
+
output += " No results..\n"
|
|
216
|
+
output += " Solution has status: " + str(self.status.value) + "\n"
|
|
217
|
+
if self.error_message:
|
|
218
|
+
output += " Error message: " + str(self.error_message) + "\n"
|
|
219
|
+
|
|
220
|
+
# Build Provider Meta Data section
|
|
221
|
+
output += f"\n\n{divider}{provider.upper()} META DATA:\n{divider}"
|
|
222
|
+
output += (
|
|
223
|
+
self._pretty_print(metadata)
|
|
224
|
+
if metadata
|
|
225
|
+
else " No metadata from provider..\n"
|
|
226
|
+
)
|
|
227
|
+
return output
|
|
228
|
+
|
|
229
|
+
def subset(self):
|
|
230
|
+
limit = 5
|
|
231
|
+
subset_keys = [
|
|
232
|
+
"id",
|
|
233
|
+
"name",
|
|
234
|
+
"status",
|
|
235
|
+
"solver",
|
|
236
|
+
"provider",
|
|
237
|
+
"runtime",
|
|
238
|
+
"optimization_name",
|
|
239
|
+
"created_date",
|
|
240
|
+
]
|
|
241
|
+
data = self.model_dump()
|
|
242
|
+
data["optimization_name"] = data["optimization"]["original_format"]
|
|
243
|
+
output = ""
|
|
244
|
+
data_subset = {key: data.get(key) for key in subset_keys if key in data}
|
|
245
|
+
output += self._pretty_print(data_subset)
|
|
246
|
+
|
|
247
|
+
# Build Results section
|
|
248
|
+
results = data.pop("results")
|
|
249
|
+
if results:
|
|
250
|
+
output += "results:\n"
|
|
251
|
+
output += (
|
|
252
|
+
f"{len(results)} results found. Displaying first {limit} results.\n"
|
|
253
|
+
)
|
|
254
|
+
for i, result in enumerate(results, start=1):
|
|
255
|
+
if i > limit:
|
|
256
|
+
output += "....\n"
|
|
257
|
+
break
|
|
258
|
+
r = f"Result {i}:\n"
|
|
259
|
+
r += (
|
|
260
|
+
f" {str(result)[:150]} ....\n"
|
|
261
|
+
if len(str(result)) > 150
|
|
262
|
+
else f" {result}\n"
|
|
263
|
+
)
|
|
264
|
+
output += r
|
|
265
|
+
else:
|
|
266
|
+
output += "results:\n"
|
|
267
|
+
output += " No results..\n"
|
|
268
|
+
output += " Solution has status: " + str(self.status.value) + "\n"
|
|
269
|
+
if self.error_message:
|
|
270
|
+
output += " Error message: " + str(self.error_message) + "\n"
|
|
271
|
+
return output
|
|
272
|
+
|
|
219
273
|
|
|
220
274
|
class UseCaseResult(BaseModel):
|
|
221
275
|
representation: Any
|
|
@@ -376,6 +376,8 @@ class Loop(BaseParameter):
|
|
|
376
376
|
Energy level that the algorithm tries to reach.
|
|
377
377
|
rtol: float
|
|
378
378
|
Relative tolerance for convergence.
|
|
379
|
+
rtol: float
|
|
380
|
+
Relative tolerance for convergence.
|
|
379
381
|
atol: float
|
|
380
382
|
Absolute tolerance for convergence.
|
|
381
383
|
"""
|
|
@@ -383,7 +385,8 @@ class Loop(BaseParameter):
|
|
|
383
385
|
max_iter: Optional[int] = 100
|
|
384
386
|
max_time: int = 5
|
|
385
387
|
convergence: int = 3
|
|
386
|
-
target: Optional[float] =
|
|
388
|
+
target: Optional[float] = None
|
|
389
|
+
rtol: float = DEFAULT_RTOL
|
|
387
390
|
atol: float = DEFAULT_ATOL
|
|
388
391
|
|
|
389
392
|
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
2
2
|
from luna_sdk.schemas.solver_parameters.dwave import Embedding, SamplingParams
|
|
3
|
+
from pydantic import StringConstraints
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
if sys.version_info >= (3, 9):
|
|
8
|
+
from typing import Annotated
|
|
9
|
+
else:
|
|
10
|
+
from typing_extensions import Annotated
|
|
3
11
|
|
|
4
12
|
|
|
5
13
|
class QuantumAnnealingParameters(BaseParameter):
|
|
@@ -13,7 +21,12 @@ class QuantumAnnealingParameters(BaseParameter):
|
|
|
13
21
|
sampling_params: SamplingParams
|
|
14
22
|
Parameters for the sampling. See https://docs.dwavesys.com/docs/latest/c_solver_parameters.html
|
|
15
23
|
for more details.
|
|
24
|
+
qpu_backend: str
|
|
25
|
+
Specific D-Wave quantum processing unit (QPU) for your optimization
|
|
16
26
|
"""
|
|
17
27
|
|
|
18
28
|
embedding: Embedding = Embedding()
|
|
19
29
|
sampling_params: SamplingParams = SamplingParams()
|
|
30
|
+
qpu_backend: Annotated[
|
|
31
|
+
str, StringConstraints(strip_whitespace=True, min_length=1)
|
|
32
|
+
] = "default"
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
from typing import Any, Dict, List, Optional
|
|
2
2
|
|
|
3
|
-
from pydantic import
|
|
3
|
+
from pydantic import Field, StringConstraints
|
|
4
4
|
|
|
5
5
|
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
6
6
|
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
if sys.version_info >= (3, 9):
|
|
10
|
+
from typing import Annotated
|
|
11
|
+
else:
|
|
12
|
+
from typing_extensions import Annotated
|
|
13
|
+
|
|
7
14
|
|
|
8
15
|
class RRQuantumAnnealingSamplingParams(BaseParameter):
|
|
9
16
|
"""
|
|
@@ -69,6 +76,8 @@ class RepeatedReverseQuantumAnnealingParameters(BaseParameter):
|
|
|
69
76
|
The target energy for the solving process.
|
|
70
77
|
check_trivial: bool
|
|
71
78
|
Whether to check for trivial variables. Checking for trivial variables means an overhead. On the other hand, when set to `False`, trivial variables, i.e., variables without interactions, will lead to a runtime error.
|
|
79
|
+
qpu_backend: str
|
|
80
|
+
Specific D-Wave quantum processing unit (QPU) for your optimization
|
|
72
81
|
"""
|
|
73
82
|
|
|
74
83
|
sampling_params: RRQuantumAnnealingSamplingParams = (
|
|
@@ -82,3 +91,6 @@ class RepeatedReverseQuantumAnnealingParameters(BaseParameter):
|
|
|
82
91
|
max_iter: int = 10
|
|
83
92
|
target: Optional[Any] = None
|
|
84
93
|
check_trivial: bool = True
|
|
94
|
+
qpu_backend: Annotated[
|
|
95
|
+
str, StringConstraints(strip_whitespace=True, min_length=1)
|
|
96
|
+
] = "default"
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
from typing import Any, Optional
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from .base import Tabu
|
|
4
4
|
|
|
5
|
-
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
class TabuSearchParameters(BaseParameter):
|
|
6
|
+
class TabuSearchParameters(Tabu):
|
|
9
7
|
"""
|
|
10
8
|
Tabu Search is a heuristic optimization method that works with the help of a tabu list.
|
|
11
9
|
Initially, random states are chosen in the solution landscape.
|
|
File without changes
|
|
File without changes
|