luna-quantum 0.0.16__py3-none-any.whl → 0.0.33__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.16.dist-info → luna_quantum-0.0.33.dist-info}/METADATA +2 -1
- {luna_quantum-0.0.16.dist-info → luna_quantum-0.0.33.dist-info}/RECORD +64 -58
- luna_sdk/controllers/luna_http_client.py +27 -0
- luna_sdk/controllers/luna_platform_client.py +41 -23
- luna_sdk/controllers/luna_q.py +11 -16
- luna_sdk/controllers/luna_solve.py +12 -17
- luna_sdk/controllers/luna_transform.py +14 -15
- luna_sdk/error/http_error_utils.py +10 -3
- luna_sdk/interfaces/circuit_repo_i.py +18 -12
- luna_sdk/interfaces/cplex_repo_i.py +25 -10
- luna_sdk/interfaces/info_repo_i.py +10 -3
- luna_sdk/interfaces/lp_repo_i.py +20 -8
- luna_sdk/interfaces/optimization_repo_i.py +35 -60
- luna_sdk/interfaces/qpu_token_repo_i.py +40 -38
- luna_sdk/interfaces/solutions_repo_i.py +44 -24
- luna_sdk/repositories/circuit_repo.py +11 -44
- luna_sdk/repositories/cplex_repo.py +32 -20
- luna_sdk/repositories/info_repo.py +4 -7
- luna_sdk/repositories/lp_repo.py +21 -15
- luna_sdk/repositories/optimization_repo.py +36 -210
- luna_sdk/repositories/qpu_token_repo.py +52 -128
- luna_sdk/repositories/solutions_repo.py +109 -181
- luna_sdk/schemas/create/solution.py +2 -2
- luna_sdk/schemas/enums/optimization.py +8 -7
- luna_sdk/schemas/enums/qpu_token_type.py +1 -1
- luna_sdk/schemas/optimization.py +15 -24
- luna_sdk/schemas/optimization_formats/qubo.py +8 -0
- luna_sdk/schemas/pretty_base.py +10 -3
- luna_sdk/schemas/qpu_token.py +4 -5
- luna_sdk/schemas/rest/qpu_token/qpu_token_source.py +18 -0
- luna_sdk/schemas/rest/qpu_token/token_provider.py +47 -15
- luna_sdk/schemas/solution.py +7 -6
- luna_sdk/schemas/solver_info.py +31 -1
- luna_sdk/schemas/solver_parameters/aws/optimizer_params.py +40 -0
- luna_sdk/schemas/solver_parameters/aws/qaoa.py +36 -4
- luna_sdk/schemas/solver_parameters/base_parameter.py +5 -0
- luna_sdk/schemas/solver_parameters/dwave/base.py +15 -14
- luna_sdk/schemas/solver_parameters/dwave/dialectic_search.py +3 -2
- luna_sdk/schemas/solver_parameters/dwave/kerberos.py +2 -3
- luna_sdk/schemas/solver_parameters/dwave/leap_hybrid_bqm.py +2 -2
- luna_sdk/schemas/solver_parameters/dwave/leap_hybrid_cqm.py +2 -2
- luna_sdk/schemas/solver_parameters/dwave/parallel_tempering.py +2 -3
- luna_sdk/schemas/solver_parameters/dwave/parallel_tempering_qpu.py +2 -3
- luna_sdk/schemas/solver_parameters/dwave/population_annealing.py +2 -3
- luna_sdk/schemas/solver_parameters/dwave/population_annealing_qpu.py +2 -1
- luna_sdk/schemas/solver_parameters/dwave/qaga.py +4 -2
- luna_sdk/schemas/solver_parameters/dwave/qbsolv_like_qpu.py +2 -3
- luna_sdk/schemas/solver_parameters/dwave/qbsolv_like_simulated_annealing.py +2 -3
- luna_sdk/schemas/solver_parameters/dwave/qbsolv_like_tabu_search.py +2 -3
- luna_sdk/schemas/solver_parameters/dwave/quantum_annealing.py +2 -3
- luna_sdk/schemas/solver_parameters/dwave/repeated_reverse_quantum_annealing.py +4 -2
- luna_sdk/schemas/solver_parameters/dwave/repeated_reverse_simulated_annealing.py +3 -2
- luna_sdk/schemas/solver_parameters/dwave/saga.py +1 -1
- luna_sdk/schemas/solver_parameters/dwave/tabu_search.py +3 -1
- luna_sdk/schemas/solver_parameters/fujitsu/base.py +5 -4
- luna_sdk/schemas/solver_parameters/fujitsu/partial_config.py +7 -5
- luna_sdk/schemas/solver_parameters/ibm/standard_parameters.py +121 -7
- luna_sdk/schemas/solver_parameters/qctrl/qaoa.py +2 -2
- luna_sdk/schemas/wrappers/__init__.py +1 -0
- luna_sdk/schemas/wrappers/datetime_wrapper.py +31 -0
- luna_sdk/utils/parameter_finder.py +90 -0
- luna_sdk/utils/qpu_tokens.py +14 -13
- luna_sdk/constants.py +0 -1
- luna_sdk/controllers/custom_login_client.py +0 -61
- {luna_quantum-0.0.16.dist-info → luna_quantum-0.0.33.dist-info}/LICENSE +0 -0
- {luna_quantum-0.0.16.dist-info → luna_quantum-0.0.33.dist-info}/WHEEL +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
2
|
from functools import partial
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import List, Tuple
|
|
4
4
|
|
|
5
5
|
import dimod
|
|
6
6
|
from dimod import ConstrainedQuadraticModel
|
|
7
|
-
from
|
|
7
|
+
from dimod.constrained.constrained import CQMToBQMInverter
|
|
8
|
+
from docplex.mp.model import Model as DOCplexModel
|
|
8
9
|
from qiskit_optimization import QuadraticProgram
|
|
9
10
|
|
|
10
|
-
from luna_sdk.interfaces import IRepository
|
|
11
|
-
from dimod.constrained.constrained import CQMToBQMInverter
|
|
11
|
+
from luna_sdk.interfaces import IRepository
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class ICplexRepo(IRepository, ABC):
|
|
@@ -19,7 +19,7 @@ class ICplexRepo(IRepository, ABC):
|
|
|
19
19
|
return inverter_bqm(var_sample)
|
|
20
20
|
|
|
21
21
|
@abstractmethod
|
|
22
|
-
def to_qubo_qiskit(self, docplex_model: DOCplexModel) -> QuadraticProgram:
|
|
22
|
+
def to_qubo_qiskit(self, docplex_model: DOCplexModel, **kwargs) -> QuadraticProgram:
|
|
23
23
|
"""
|
|
24
24
|
Transform DOCplex model to QUBO Qiskit
|
|
25
25
|
|
|
@@ -27,6 +27,8 @@ class ICplexRepo(IRepository, ABC):
|
|
|
27
27
|
----------
|
|
28
28
|
docplex_model: docplex.mp.model.Model
|
|
29
29
|
DOCplex problem description
|
|
30
|
+
**kwargs
|
|
31
|
+
Parameters to pass to `httpx.request`.
|
|
30
32
|
|
|
31
33
|
Returns
|
|
32
34
|
-------
|
|
@@ -36,7 +38,7 @@ class ICplexRepo(IRepository, ABC):
|
|
|
36
38
|
raise NotImplementedError
|
|
37
39
|
|
|
38
40
|
@abstractmethod
|
|
39
|
-
def to_lp_file(self, docplex_model: DOCplexModel, filepath: str) -> None:
|
|
41
|
+
def to_lp_file(self, docplex_model: DOCplexModel, filepath: str, **kwargs) -> None:
|
|
40
42
|
"""
|
|
41
43
|
Transform DOCplex to LP representation
|
|
42
44
|
|
|
@@ -46,11 +48,13 @@ class ICplexRepo(IRepository, ABC):
|
|
|
46
48
|
DOCplex problem description
|
|
47
49
|
filepath: str
|
|
48
50
|
.lp file path where result should be stored
|
|
51
|
+
**kwargs
|
|
52
|
+
Parameters to pass to `httpx.request`.
|
|
49
53
|
"""
|
|
50
54
|
raise NotImplementedError
|
|
51
55
|
|
|
52
56
|
@abstractmethod
|
|
53
|
-
def to_lp_string(self, docplex_model: DOCplexModel) -> str:
|
|
57
|
+
def to_lp_string(self, docplex_model: DOCplexModel, **kwargs) -> str:
|
|
54
58
|
"""
|
|
55
59
|
Transform DOCplex to LP representation
|
|
56
60
|
|
|
@@ -58,6 +62,9 @@ class ICplexRepo(IRepository, ABC):
|
|
|
58
62
|
----------
|
|
59
63
|
docplex_model: docplex.mp.model.Model
|
|
60
64
|
DOCplex problem description
|
|
65
|
+
**kwargs
|
|
66
|
+
Parameters to pass to `httpx.request`.
|
|
67
|
+
|
|
61
68
|
Returns
|
|
62
69
|
-------
|
|
63
70
|
str
|
|
@@ -67,7 +74,7 @@ class ICplexRepo(IRepository, ABC):
|
|
|
67
74
|
|
|
68
75
|
@abstractmethod
|
|
69
76
|
def to_qubo_matrix(
|
|
70
|
-
self, docplex_model: DOCplexModel
|
|
77
|
+
self, docplex_model: DOCplexModel, **kwargs
|
|
71
78
|
) -> Tuple[List[List[float]], partial]:
|
|
72
79
|
"""
|
|
73
80
|
Transform DOCplex model to QUBO matrix
|
|
@@ -76,6 +83,8 @@ class ICplexRepo(IRepository, ABC):
|
|
|
76
83
|
----------
|
|
77
84
|
docplex_model: docplex.mp.model.Model
|
|
78
85
|
DOCplex problem description
|
|
86
|
+
**kwargs
|
|
87
|
+
Parameters to pass to `httpx.request`.
|
|
79
88
|
|
|
80
89
|
Returns
|
|
81
90
|
-------
|
|
@@ -86,7 +95,7 @@ class ICplexRepo(IRepository, ABC):
|
|
|
86
95
|
|
|
87
96
|
@abstractmethod
|
|
88
97
|
def to_bqm(
|
|
89
|
-
self, docplex_model: DOCplexModel
|
|
98
|
+
self, docplex_model: DOCplexModel, **kwargs
|
|
90
99
|
) -> Tuple[dimod.BinaryQuadraticModel, CQMToBQMInverter]:
|
|
91
100
|
"""
|
|
92
101
|
Transform DOCplex model to BQM model
|
|
@@ -95,6 +104,8 @@ class ICplexRepo(IRepository, ABC):
|
|
|
95
104
|
----------
|
|
96
105
|
docplex_model: docplex.mp.model.Model
|
|
97
106
|
DOCplex problem description
|
|
107
|
+
**kwargs
|
|
108
|
+
Parameters to pass to `httpx.request`.
|
|
98
109
|
|
|
99
110
|
Returns
|
|
100
111
|
-------
|
|
@@ -104,7 +115,9 @@ class ICplexRepo(IRepository, ABC):
|
|
|
104
115
|
raise NotImplementedError
|
|
105
116
|
|
|
106
117
|
@abstractmethod
|
|
107
|
-
def to_cqm(
|
|
118
|
+
def to_cqm(
|
|
119
|
+
self, docplex_model: DOCplexModel, **kwargs
|
|
120
|
+
) -> ConstrainedQuadraticModel:
|
|
108
121
|
"""
|
|
109
122
|
Transform DOCplex model to CQM model
|
|
110
123
|
|
|
@@ -112,6 +125,8 @@ class ICplexRepo(IRepository, ABC):
|
|
|
112
125
|
----------
|
|
113
126
|
docplex_model: docplex.mp.model.Model
|
|
114
127
|
DOCplex problem description
|
|
128
|
+
**kwargs
|
|
129
|
+
Parameters to pass to `httpx.request`.
|
|
115
130
|
|
|
116
131
|
Returns
|
|
117
132
|
-------
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
|
-
from typing import Dict, List, Optional
|
|
2
|
+
from typing import Any, Dict, List, Optional
|
|
3
3
|
|
|
4
4
|
from luna_sdk.interfaces.repository_i import IRepository
|
|
5
5
|
from luna_sdk.schemas.solver_info import SolverInfo
|
|
@@ -8,7 +8,7 @@ from luna_sdk.schemas.solver_info import SolverInfo
|
|
|
8
8
|
class IInfoRepo(IRepository, ABC):
|
|
9
9
|
@abstractmethod
|
|
10
10
|
def solvers_available(
|
|
11
|
-
self, solver_name: Optional[str] = None
|
|
11
|
+
self, solver_name: Optional[str] = None, **kwargs
|
|
12
12
|
) -> Dict[str, Dict[str, SolverInfo]]:
|
|
13
13
|
"""
|
|
14
14
|
Get list of available solvers.
|
|
@@ -18,6 +18,8 @@ class IInfoRepo(IRepository, ABC):
|
|
|
18
18
|
solver_name: Optional[str]
|
|
19
19
|
Name of the solver that should be retrieved. If not specified, all solvers
|
|
20
20
|
will be returned.
|
|
21
|
+
**kwargs
|
|
22
|
+
Parameters to pass to `httpx.request`.
|
|
21
23
|
|
|
22
24
|
Returns
|
|
23
25
|
-------
|
|
@@ -28,10 +30,15 @@ class IInfoRepo(IRepository, ABC):
|
|
|
28
30
|
raise NotImplementedError
|
|
29
31
|
|
|
30
32
|
@abstractmethod
|
|
31
|
-
def providers_available(self) -> List[str]:
|
|
33
|
+
def providers_available(self, **kwargs) -> List[str]:
|
|
32
34
|
"""
|
|
33
35
|
Get list of available providers.
|
|
34
36
|
|
|
37
|
+
Parameters
|
|
38
|
+
----------
|
|
39
|
+
**kwargs
|
|
40
|
+
Parameters to pass to `httpx.request`.
|
|
41
|
+
|
|
35
42
|
Returns
|
|
36
43
|
-------
|
|
37
44
|
List[str]
|
luna_sdk/interfaces/lp_repo_i.py
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
2
|
from functools import partial
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Any, Dict, List, Tuple
|
|
4
4
|
|
|
5
5
|
import dimod
|
|
6
6
|
from dimod import ConstrainedQuadraticModel
|
|
7
7
|
from dimod.constrained.constrained import CQMToBQMInverter
|
|
8
|
-
from docplex.mp.model import Model as DOCplexModel
|
|
8
|
+
from docplex.mp.model import Model as DOCplexModel
|
|
9
9
|
from qiskit_optimization import QuadraticProgram
|
|
10
10
|
|
|
11
|
-
from luna_sdk.interfaces import IRepository
|
|
11
|
+
from luna_sdk.interfaces import IRepository
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class ILPRepo(IRepository, ABC):
|
|
@@ -19,7 +19,7 @@ class ILPRepo(IRepository, ABC):
|
|
|
19
19
|
return inverter_bqm(var_sample)
|
|
20
20
|
|
|
21
21
|
@abstractmethod
|
|
22
|
-
def to_qubo_qiskit(self, lp_string: str) -> QuadraticProgram:
|
|
22
|
+
def to_qubo_qiskit(self, lp_string: str, **kwargs) -> QuadraticProgram:
|
|
23
23
|
"""
|
|
24
24
|
Transform LP to QUBO Qiskit
|
|
25
25
|
|
|
@@ -27,6 +27,8 @@ class ILPRepo(IRepository, ABC):
|
|
|
27
27
|
----------
|
|
28
28
|
lp_string: str
|
|
29
29
|
LP problem description
|
|
30
|
+
**kwargs
|
|
31
|
+
Parameters to pass to `httpx.request`.
|
|
30
32
|
|
|
31
33
|
Returns
|
|
32
34
|
-------
|
|
@@ -36,7 +38,7 @@ class ILPRepo(IRepository, ABC):
|
|
|
36
38
|
raise NotImplementedError
|
|
37
39
|
|
|
38
40
|
@abstractmethod
|
|
39
|
-
def to_docplex(self, lp_string: str) -> DOCplexModel:
|
|
41
|
+
def to_docplex(self, lp_string: str, **kwargs) -> DOCplexModel:
|
|
40
42
|
"""
|
|
41
43
|
Transform LP to DOCplex
|
|
42
44
|
|
|
@@ -44,6 +46,8 @@ class ILPRepo(IRepository, ABC):
|
|
|
44
46
|
----------
|
|
45
47
|
lp_string: str
|
|
46
48
|
LP problem description
|
|
49
|
+
**kwargs
|
|
50
|
+
Parameters to pass to `httpx.request`.
|
|
47
51
|
|
|
48
52
|
Returns
|
|
49
53
|
-------
|
|
@@ -53,7 +57,9 @@ class ILPRepo(IRepository, ABC):
|
|
|
53
57
|
raise NotImplementedError
|
|
54
58
|
|
|
55
59
|
@abstractmethod
|
|
56
|
-
def to_qubo_matrix(
|
|
60
|
+
def to_qubo_matrix(
|
|
61
|
+
self, lp_string: str, **kwargs
|
|
62
|
+
) -> Tuple[List[List[float]], partial]:
|
|
57
63
|
"""
|
|
58
64
|
Transform LP to QUBO matrix
|
|
59
65
|
|
|
@@ -61,6 +67,8 @@ class ILPRepo(IRepository, ABC):
|
|
|
61
67
|
----------
|
|
62
68
|
lp_string: str
|
|
63
69
|
LP problem description
|
|
70
|
+
**kwargs
|
|
71
|
+
Parameters to pass to `httpx.request`.
|
|
64
72
|
|
|
65
73
|
Returns
|
|
66
74
|
-------
|
|
@@ -71,7 +79,7 @@ class ILPRepo(IRepository, ABC):
|
|
|
71
79
|
|
|
72
80
|
@abstractmethod
|
|
73
81
|
def to_bqm(
|
|
74
|
-
self, lp_string: str
|
|
82
|
+
self, lp_string: str, **kwargs
|
|
75
83
|
) -> Tuple[dimod.BinaryQuadraticModel, CQMToBQMInverter]:
|
|
76
84
|
"""
|
|
77
85
|
Transform LP to BQM model
|
|
@@ -80,6 +88,8 @@ class ILPRepo(IRepository, ABC):
|
|
|
80
88
|
----------
|
|
81
89
|
lp_string: str
|
|
82
90
|
LP problem description
|
|
91
|
+
**kwargs
|
|
92
|
+
Parameters to pass to `httpx.request`.
|
|
83
93
|
|
|
84
94
|
Returns
|
|
85
95
|
-------
|
|
@@ -89,7 +99,7 @@ class ILPRepo(IRepository, ABC):
|
|
|
89
99
|
raise NotImplementedError
|
|
90
100
|
|
|
91
101
|
@abstractmethod
|
|
92
|
-
def to_cqm(self, lp_string: str) -> ConstrainedQuadraticModel:
|
|
102
|
+
def to_cqm(self, lp_string: str, **kwargs) -> ConstrainedQuadraticModel:
|
|
93
103
|
"""
|
|
94
104
|
Transform LP to CQM model
|
|
95
105
|
|
|
@@ -97,6 +107,8 @@ class ILPRepo(IRepository, ABC):
|
|
|
97
107
|
----------
|
|
98
108
|
lp_string: str
|
|
99
109
|
LP problem description
|
|
110
|
+
**kwargs
|
|
111
|
+
Parameters to pass to `httpx.request`.
|
|
100
112
|
|
|
101
113
|
Returns
|
|
102
114
|
-------
|
|
@@ -5,20 +5,16 @@ from typing import List, Optional
|
|
|
5
5
|
from dimod import BinaryQuadraticModel, ConstrainedQuadraticModel
|
|
6
6
|
|
|
7
7
|
from luna_sdk.interfaces.repository_i import IRepository
|
|
8
|
-
from luna_sdk.schemas.enums.optimization import
|
|
8
|
+
from luna_sdk.schemas.enums.optimization import OptFormat
|
|
9
9
|
from luna_sdk.schemas.enums.timeframe import TimeframeEnum
|
|
10
|
-
from luna_sdk.schemas.optimization import
|
|
11
|
-
|
|
12
|
-
)
|
|
10
|
+
from luna_sdk.schemas.optimization import Optimization
|
|
11
|
+
from luna_sdk.schemas.solution import Numeric
|
|
13
12
|
from luna_sdk.schemas.use_cases import UseCase
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
class IOptimizationRepo(IRepository, ABC):
|
|
17
16
|
@abstractmethod
|
|
18
|
-
def get(
|
|
19
|
-
self,
|
|
20
|
-
optimization_id: str,
|
|
21
|
-
) -> Optimization:
|
|
17
|
+
def get(self, optimization_id: str, **kwargs) -> Optimization:
|
|
22
18
|
"""
|
|
23
19
|
Retrieve a optimization by id.
|
|
24
20
|
|
|
@@ -26,6 +22,8 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
26
22
|
----------
|
|
27
23
|
optimization_id: str
|
|
28
24
|
Id of the optimization to be retrieved.
|
|
25
|
+
**kwargs
|
|
26
|
+
Parameters to pass to `httpx.request`.
|
|
29
27
|
|
|
30
28
|
Returns
|
|
31
29
|
-------
|
|
@@ -38,9 +36,10 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
38
36
|
def get_all(
|
|
39
37
|
self,
|
|
40
38
|
timeframe: Optional[TimeframeEnum] = None,
|
|
41
|
-
input_type: Optional[
|
|
39
|
+
input_type: Optional[OptFormat] = None,
|
|
42
40
|
limit: int = 50,
|
|
43
41
|
offset: int = 0,
|
|
42
|
+
**kwargs,
|
|
44
43
|
) -> List[Optimization]:
|
|
45
44
|
"""
|
|
46
45
|
Retrieve a list of optimizations.
|
|
@@ -50,12 +49,14 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
50
49
|
timeframe: Optional[TimeframeEnum]
|
|
51
50
|
Only return optimizations created within a specified timeframe.
|
|
52
51
|
Default None.
|
|
53
|
-
input_type: Optional[
|
|
52
|
+
input_type: Optional[OptFormat]
|
|
54
53
|
Only return optimizations of a specified input type. Default None.
|
|
55
54
|
limit:
|
|
56
55
|
Limit the number of optimizations to be returned. Default value 50.
|
|
57
56
|
offset:
|
|
58
57
|
Offset the list of optimizations by this amount. Default value 0.
|
|
58
|
+
**kwargs
|
|
59
|
+
Parameters to pass to `httpx.request`.
|
|
59
60
|
|
|
60
61
|
Returns
|
|
61
62
|
-------
|
|
@@ -66,10 +67,7 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
66
67
|
|
|
67
68
|
@abstractmethod
|
|
68
69
|
def create_from_qubo(
|
|
69
|
-
self,
|
|
70
|
-
name: str,
|
|
71
|
-
matrix: List[List[float]],
|
|
72
|
-
timeout: Optional[float] = 10.0,
|
|
70
|
+
self, name: str, matrix: List[List[Numeric]], **kwargs
|
|
73
71
|
) -> Optimization:
|
|
74
72
|
"""
|
|
75
73
|
Create an optimization from a QUBO matrix.
|
|
@@ -80,10 +78,8 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
80
78
|
Name of the optimization to be created.
|
|
81
79
|
matrix: List[List[float]]
|
|
82
80
|
QUBO matrix.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
there won't be any timeout. Increase or disable the timeout if you face
|
|
86
|
-
issues uploading big QUBO matrices.
|
|
81
|
+
**kwargs
|
|
82
|
+
Parameters to pass to `httpx.request`.
|
|
87
83
|
|
|
88
84
|
Returns
|
|
89
85
|
-------
|
|
@@ -94,10 +90,7 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
94
90
|
|
|
95
91
|
@abstractmethod
|
|
96
92
|
def create_from_use_case(
|
|
97
|
-
self,
|
|
98
|
-
name: str,
|
|
99
|
-
use_case: UseCase,
|
|
100
|
-
timeout: Optional[float] = 10.0,
|
|
93
|
+
self, name: str, use_case: UseCase, **kwargs
|
|
101
94
|
) -> Optimization:
|
|
102
95
|
"""
|
|
103
96
|
Create an optimization from a use case.
|
|
@@ -108,10 +101,8 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
108
101
|
Name of the optimization to be created.
|
|
109
102
|
use_case: UseCase
|
|
110
103
|
Use case.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
there won't be any timeout. Increase or disable the timeout if you face
|
|
114
|
-
issues uploading big Problems.
|
|
104
|
+
**kwargs
|
|
105
|
+
Parameters to pass to `httpx.request`.
|
|
115
106
|
|
|
116
107
|
Returns
|
|
117
108
|
-------
|
|
@@ -122,10 +113,7 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
122
113
|
|
|
123
114
|
@abstractmethod
|
|
124
115
|
def create_from_bqm(
|
|
125
|
-
self,
|
|
126
|
-
name: str,
|
|
127
|
-
bqm: BinaryQuadraticModel,
|
|
128
|
-
timeout: Optional[float] = 10.0,
|
|
116
|
+
self, name: str, bqm: BinaryQuadraticModel, **kwargs
|
|
129
117
|
) -> Optimization:
|
|
130
118
|
"""
|
|
131
119
|
Create an optimization from BQM.
|
|
@@ -136,10 +124,8 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
136
124
|
Name of the optimization to be created.
|
|
137
125
|
bqm: BinaryQuadraticModel
|
|
138
126
|
QUBO in dimod BQM format.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
there won't be any timeout. Increase or disable the timeout if you face
|
|
142
|
-
issues uploading big Problems.
|
|
127
|
+
**kwargs
|
|
128
|
+
Parameters to pass to `httpx.request`.
|
|
143
129
|
|
|
144
130
|
Returns
|
|
145
131
|
-------
|
|
@@ -150,10 +136,7 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
150
136
|
|
|
151
137
|
@abstractmethod
|
|
152
138
|
def create_from_cqm(
|
|
153
|
-
self,
|
|
154
|
-
name: str,
|
|
155
|
-
cqm: ConstrainedQuadraticModel,
|
|
156
|
-
timeout: Optional[float] = 10.0,
|
|
139
|
+
self, name: str, cqm: ConstrainedQuadraticModel, **kwargs
|
|
157
140
|
) -> Optimization:
|
|
158
141
|
"""
|
|
159
142
|
Create an optimization from CQM.
|
|
@@ -164,7 +147,8 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
164
147
|
Name of the optimization to be created.
|
|
165
148
|
cqm: ConstrainedQuadraticModel
|
|
166
149
|
in dimod CQM format.
|
|
167
|
-
|
|
150
|
+
**kwargs
|
|
151
|
+
Parameters to pass to `httpx.request`.
|
|
168
152
|
|
|
169
153
|
Returns
|
|
170
154
|
-------
|
|
@@ -175,10 +159,7 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
175
159
|
|
|
176
160
|
@abstractmethod
|
|
177
161
|
def create_from_lp_file(
|
|
178
|
-
self,
|
|
179
|
-
name: str,
|
|
180
|
-
lp_file: BufferedReader,
|
|
181
|
-
timeout: Optional[float] = 10.0,
|
|
162
|
+
self, name: str, lp_file: BufferedReader, **kwargs
|
|
182
163
|
) -> Optimization:
|
|
183
164
|
"""
|
|
184
165
|
Create an optimization from LP file.
|
|
@@ -188,10 +169,8 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
188
169
|
name: str
|
|
189
170
|
Name of the optimization to be created.
|
|
190
171
|
lp_file: buffer reader.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
there won't be any timeout. Increase or disable the timeout if you face
|
|
194
|
-
issues uploading big Problems.
|
|
172
|
+
**kwargs
|
|
173
|
+
Parameters to pass to `httpx.request`.
|
|
195
174
|
|
|
196
175
|
Returns
|
|
197
176
|
-------
|
|
@@ -202,10 +181,7 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
202
181
|
|
|
203
182
|
@abstractmethod
|
|
204
183
|
def create_from_lp_string(
|
|
205
|
-
self,
|
|
206
|
-
name: str,
|
|
207
|
-
lp_string: str,
|
|
208
|
-
timeout: Optional[float] = 10.0,
|
|
184
|
+
self, name: str, lp_string: str, **kwargs
|
|
209
185
|
) -> Optimization:
|
|
210
186
|
"""
|
|
211
187
|
Create an optimization from LP file.
|
|
@@ -215,10 +191,8 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
215
191
|
name: str
|
|
216
192
|
Name of the optimization to be created.
|
|
217
193
|
lp_string: string.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
there won't be any timeout. Increase or disable the timeout if you face
|
|
221
|
-
issues uploading big Problems.
|
|
194
|
+
**kwargs
|
|
195
|
+
Parameters to pass to `httpx.request`.
|
|
222
196
|
|
|
223
197
|
Returns
|
|
224
198
|
-------
|
|
@@ -228,7 +202,7 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
228
202
|
raise NotImplementedError
|
|
229
203
|
|
|
230
204
|
@abstractmethod
|
|
231
|
-
def rename(self, optimization_id: str, name: str) -> Optimization:
|
|
205
|
+
def rename(self, optimization_id: str, name: str, **kwargs) -> Optimization:
|
|
232
206
|
"""
|
|
233
207
|
Update the name of the optimization
|
|
234
208
|
|
|
@@ -238,6 +212,8 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
238
212
|
Id of the optimization to be updated.
|
|
239
213
|
name: str
|
|
240
214
|
New name of the optimization
|
|
215
|
+
**kwargs
|
|
216
|
+
Parameters to pass to `httpx.request`.
|
|
241
217
|
|
|
242
218
|
Returns
|
|
243
219
|
-------
|
|
@@ -247,10 +223,7 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
247
223
|
raise NotImplementedError
|
|
248
224
|
|
|
249
225
|
@abstractmethod
|
|
250
|
-
def delete(
|
|
251
|
-
self,
|
|
252
|
-
optimization_id: str,
|
|
253
|
-
) -> None:
|
|
226
|
+
def delete(self, optimization_id: str, **kwargs) -> None:
|
|
254
227
|
"""
|
|
255
228
|
Delete an optimization by id.
|
|
256
229
|
|
|
@@ -258,5 +231,7 @@ class IOptimizationRepo(IRepository, ABC):
|
|
|
258
231
|
----------
|
|
259
232
|
optimization_id: str
|
|
260
233
|
Id of the optimization to be deleted.
|
|
234
|
+
**kwargs
|
|
235
|
+
Parameters to pass to `httpx.request`.
|
|
261
236
|
"""
|
|
262
237
|
raise NotImplementedError
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
|
-
from typing import Dict, List,
|
|
2
|
+
from typing import Dict, List, Optional
|
|
3
3
|
|
|
4
4
|
from luna_sdk.interfaces.repository_i import IRepository
|
|
5
5
|
from luna_sdk.schemas import QpuTokenOut
|
|
@@ -13,27 +13,30 @@ class IQpuTokenRepo(IRepository, ABC):
|
|
|
13
13
|
name: str,
|
|
14
14
|
provider: str,
|
|
15
15
|
token: str,
|
|
16
|
-
token_type: QpuTokenTypeEnum
|
|
16
|
+
token_type: QpuTokenTypeEnum,
|
|
17
17
|
encryption_key: Optional[str] = None,
|
|
18
|
+
**kwargs,
|
|
18
19
|
) -> QpuTokenOut:
|
|
19
20
|
"""
|
|
20
|
-
Create
|
|
21
|
+
Create QPU token
|
|
21
22
|
|
|
22
23
|
Parameters
|
|
23
24
|
----------
|
|
24
25
|
name: str
|
|
25
26
|
Name of the QPU token
|
|
26
|
-
provider:
|
|
27
|
+
provider: str
|
|
27
28
|
Name of provider
|
|
28
29
|
token: str
|
|
29
30
|
Token
|
|
30
31
|
token_type: QpuTokenTypeEnum
|
|
31
|
-
There are two types of QPU tokens: PERSONAL and
|
|
32
|
-
|
|
33
|
-
All users of an organization can use organization QPU tokens.
|
|
32
|
+
There are two types of QPU tokens: PERSONAL and GROUP.
|
|
33
|
+
All users of a group can use group QPU tokens.
|
|
34
34
|
User QPU tokens can only be used by the user who created them.
|
|
35
35
|
encryption_key: Optional[str]
|
|
36
36
|
Encryption key to be used for encryption of QPU tokens.
|
|
37
|
+
**kwargs
|
|
38
|
+
Parameters to pass to `httpx.request`.
|
|
39
|
+
|
|
37
40
|
Returns
|
|
38
41
|
-------
|
|
39
42
|
QpuTokenOut
|
|
@@ -47,6 +50,9 @@ class IQpuTokenRepo(IRepository, ABC):
|
|
|
47
50
|
filter_provider: Optional[str] = None,
|
|
48
51
|
name: Optional[str] = None,
|
|
49
52
|
token_type: Optional[QpuTokenTypeEnum] = None,
|
|
53
|
+
limit: Optional[int] = None,
|
|
54
|
+
offset: Optional[int] = None,
|
|
55
|
+
**kwargs,
|
|
50
56
|
) -> Dict[QpuTokenTypeEnum, List[QpuTokenOut]]:
|
|
51
57
|
"""
|
|
52
58
|
Retrieve a list of QPU tokens.
|
|
@@ -58,8 +64,15 @@ class IQpuTokenRepo(IRepository, ABC):
|
|
|
58
64
|
name: Optional[str]
|
|
59
65
|
Name of the QPU token that should be retrieved
|
|
60
66
|
token_type: Optional[QpuTokenTypeEnum]
|
|
61
|
-
If you want to retrieve only user or
|
|
67
|
+
If you want to retrieve only user or group QPU tokens
|
|
62
68
|
otherwise all QPU tokens will be retrieved
|
|
69
|
+
limit: Optional[int]
|
|
70
|
+
Number of items to fetch. Default is 10.
|
|
71
|
+
offset: Optional[int]
|
|
72
|
+
Optional. Number of items to skip. Default is 0.
|
|
73
|
+
**kwargs
|
|
74
|
+
Parameters to pass to `httpx.request`.
|
|
75
|
+
|
|
63
76
|
Returns
|
|
64
77
|
-------
|
|
65
78
|
Dict[QpuTokenTypeEnum, List[QpuTokenOut]]
|
|
@@ -68,24 +81,20 @@ class IQpuTokenRepo(IRepository, ABC):
|
|
|
68
81
|
raise NotImplementedError
|
|
69
82
|
|
|
70
83
|
@abstractmethod
|
|
71
|
-
def get(
|
|
72
|
-
self,
|
|
73
|
-
name: str,
|
|
74
|
-
token_type: QpuTokenTypeEnum = QpuTokenTypeEnum.PERSONAL,
|
|
75
|
-
) -> QpuTokenOut:
|
|
84
|
+
def get(self, name: str, token_type: QpuTokenTypeEnum, **kwargs) -> QpuTokenOut:
|
|
76
85
|
"""
|
|
77
|
-
Retrieve user QPU token by id
|
|
86
|
+
Retrieve user QPU token by id.
|
|
78
87
|
|
|
79
88
|
Parameters
|
|
80
89
|
----------
|
|
81
90
|
name: str
|
|
82
91
|
Name of the QPU token that should be retrieved
|
|
83
|
-
|
|
84
92
|
token_type: QpuTokenTypeEnum
|
|
85
|
-
There are two types of QPU tokens: PERSONAL and
|
|
86
|
-
|
|
87
|
-
All users of an organization can use organization QPU tokens.
|
|
93
|
+
There are two types of QPU tokens: PERSONAL and GROUP.
|
|
94
|
+
All users of a group can use group QPU tokens.
|
|
88
95
|
User QPU tokens can only be used by the user who created them.
|
|
96
|
+
**kwargs
|
|
97
|
+
Parameters to pass to `httpx.request`.
|
|
89
98
|
|
|
90
99
|
Returns
|
|
91
100
|
-------
|
|
@@ -99,10 +108,11 @@ class IQpuTokenRepo(IRepository, ABC):
|
|
|
99
108
|
self,
|
|
100
109
|
name: str,
|
|
101
110
|
new_name: str,
|
|
102
|
-
token_type: QpuTokenTypeEnum
|
|
111
|
+
token_type: QpuTokenTypeEnum,
|
|
112
|
+
**kwargs,
|
|
103
113
|
) -> QpuTokenOut:
|
|
104
114
|
"""
|
|
105
|
-
Update
|
|
115
|
+
Update QPU token by id.
|
|
106
116
|
|
|
107
117
|
Parameters
|
|
108
118
|
----------
|
|
@@ -110,13 +120,12 @@ class IQpuTokenRepo(IRepository, ABC):
|
|
|
110
120
|
Current name of the QPU token that should be updated
|
|
111
121
|
new_name: str
|
|
112
122
|
The new name
|
|
113
|
-
|
|
114
123
|
token_type: QpuTokenTypeEnum
|
|
115
|
-
There are two types of QPU tokens: PERSONAL and
|
|
116
|
-
|
|
117
|
-
All users of an organization can use organization QPU tokens.
|
|
124
|
+
There are two types of QPU tokens: PERSONAL and GROUP.
|
|
125
|
+
All users of a group can use group QPU tokens.
|
|
118
126
|
User QPU tokens can only be used by the user who created them.
|
|
119
|
-
|
|
127
|
+
**kwargs
|
|
128
|
+
Parameters to pass to `httpx.request`.
|
|
120
129
|
|
|
121
130
|
Returns
|
|
122
131
|
-------
|
|
@@ -126,26 +135,19 @@ class IQpuTokenRepo(IRepository, ABC):
|
|
|
126
135
|
raise NotImplementedError
|
|
127
136
|
|
|
128
137
|
@abstractmethod
|
|
129
|
-
def delete(
|
|
130
|
-
self,
|
|
131
|
-
name: str,
|
|
132
|
-
token_type: QpuTokenTypeEnum = QpuTokenTypeEnum.PERSONAL,
|
|
133
|
-
) -> None:
|
|
138
|
+
def delete(self, name: str, token_type: QpuTokenTypeEnum, **kwargs) -> None:
|
|
134
139
|
"""
|
|
135
|
-
Delete
|
|
140
|
+
Delete QPU token by name.
|
|
136
141
|
|
|
137
142
|
Parameters
|
|
138
143
|
----------
|
|
139
144
|
name: str
|
|
140
145
|
Name of the QPU token that should be deleted
|
|
141
|
-
|
|
142
146
|
token_type: QpuTokenTypeEnum
|
|
143
|
-
There are two types of QPU tokens: PERSONAL and
|
|
144
|
-
|
|
145
|
-
All users of an organization can use organization QPU tokens.
|
|
147
|
+
There are two types of QPU tokens: PERSONAL and GROUP.
|
|
148
|
+
All users of a group can use organization QPU tokens.
|
|
146
149
|
User QPU tokens can only be used by the user who created them.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
-------
|
|
150
|
+
**kwargs
|
|
151
|
+
Parameters to pass to `httpx.request`.
|
|
150
152
|
"""
|
|
151
153
|
raise NotImplementedError
|