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,20 +1,48 @@
|
|
|
1
|
-
from typing import Optional
|
|
1
|
+
from typing import Optional, Union
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, Extra
|
|
4
4
|
|
|
5
|
-
from luna_sdk.schemas import QpuToken, TokenProvider
|
|
5
|
+
from luna_sdk.schemas import QpuToken, TokenProvider, QpuTokenSource
|
|
6
|
+
from luna_sdk.schemas.rest.qpu_token.qpu_token_source import _RESTQpuTokenSource
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class _RestQpuToken(BaseModel):
|
|
10
|
+
source: _RESTQpuTokenSource
|
|
11
|
+
# A unique name for a stored token
|
|
12
|
+
name: Optional[str] = None
|
|
13
|
+
# This could be a QPU token, an API key or any token key for a QPU provider.
|
|
14
|
+
# If the token is not passed from this API call, one stored in the user's
|
|
15
|
+
# account will be used.
|
|
16
|
+
token: Optional[str] = None
|
|
17
|
+
|
|
18
|
+
@classmethod
|
|
19
|
+
def from_qpu_token(cls, qpu_token: Optional[QpuToken]) -> Optional["_RestQpuToken"]:
|
|
20
|
+
if qpu_token is None:
|
|
21
|
+
return None
|
|
22
|
+
# Organizational tokens were renamed to group in #1851
|
|
23
|
+
# For smoother transition we only change naming in the SDK,
|
|
24
|
+
# and therefore we need a mapping between Group and Organization here.
|
|
25
|
+
# However, in backend for now QPU tokens still has source organization
|
|
26
|
+
# TODO: Remove it when backend I/O schema is changed
|
|
27
|
+
if qpu_token.source == QpuTokenSource.GROUP:
|
|
28
|
+
return cls(
|
|
29
|
+
source=_RESTQpuTokenSource.ORGANIZATION,
|
|
30
|
+
name=qpu_token.name,
|
|
31
|
+
token=qpu_token.token,
|
|
32
|
+
)
|
|
33
|
+
return cls.model_validate(qpu_token, from_attributes=True)
|
|
6
34
|
|
|
7
35
|
|
|
8
36
|
class AWSQpuTokens(BaseModel):
|
|
9
|
-
aws_access_key:
|
|
10
|
-
aws_secret_access_key:
|
|
37
|
+
aws_access_key: _RestQpuToken
|
|
38
|
+
aws_secret_access_key: _RestQpuToken
|
|
11
39
|
|
|
12
40
|
|
|
13
41
|
class RestAPITokenProvider(BaseModel):
|
|
14
|
-
dwave: Optional[
|
|
15
|
-
ibm: Optional[
|
|
16
|
-
fujitsu: Optional[
|
|
17
|
-
qctrl: Optional[
|
|
42
|
+
dwave: Optional[_RestQpuToken] = None
|
|
43
|
+
ibm: Optional[_RestQpuToken] = None
|
|
44
|
+
fujitsu: Optional[_RestQpuToken] = None
|
|
45
|
+
qctrl: Optional[_RestQpuToken] = None
|
|
18
46
|
aws: Optional[AWSQpuTokens] = None
|
|
19
47
|
|
|
20
48
|
@classmethod
|
|
@@ -28,16 +56,20 @@ class RestAPITokenProvider(BaseModel):
|
|
|
28
56
|
):
|
|
29
57
|
# Ignoring mypy here to receive validation error, because we always need 2 tokens for aws
|
|
30
58
|
aws = AWSQpuTokens(
|
|
31
|
-
aws_access_key=
|
|
32
|
-
|
|
33
|
-
|
|
59
|
+
aws_access_key=_RestQpuToken.from_qpu_token(
|
|
60
|
+
getattr(token_provider, "aws_access_key", None)
|
|
61
|
+
), # type: ignore[arg-type]
|
|
62
|
+
aws_secret_access_key=_RestQpuToken.from_qpu_token(
|
|
63
|
+
getattr( # type: ignore[arg-type]
|
|
64
|
+
token_provider, "aws_secret_access_key", None
|
|
65
|
+
)
|
|
34
66
|
),
|
|
35
67
|
)
|
|
36
68
|
return cls(
|
|
37
|
-
dwave=token_provider.dwave,
|
|
38
|
-
ibm=token_provider.ibm,
|
|
39
|
-
fujitsu=token_provider.fujitsu,
|
|
40
|
-
qctrl=token_provider.qctrl,
|
|
69
|
+
dwave=_RestQpuToken.from_qpu_token(token_provider.dwave),
|
|
70
|
+
ibm=_RestQpuToken.from_qpu_token(token_provider.ibm),
|
|
71
|
+
fujitsu=_RestQpuToken.from_qpu_token(token_provider.fujitsu),
|
|
72
|
+
qctrl=_RestQpuToken.from_qpu_token(token_provider.qctrl),
|
|
41
73
|
aws=aws,
|
|
42
74
|
)
|
|
43
75
|
|
luna_sdk/schemas/solution.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from datetime import datetime
|
|
2
1
|
from typing import Any, Dict, List, Optional, Union
|
|
3
2
|
|
|
4
3
|
from pydantic import BaseModel
|
|
@@ -7,6 +6,7 @@ from luna_sdk.schemas.enums.solution import SenseEnum
|
|
|
7
6
|
from luna_sdk.schemas.enums.status import StatusEnum
|
|
8
7
|
from luna_sdk.schemas.optimization import Optimization
|
|
9
8
|
from luna_sdk.schemas.pretty_base import PrettyBase
|
|
9
|
+
from luna_sdk.schemas.wrappers import PydanticDatetimeWrapper
|
|
10
10
|
|
|
11
11
|
Numeric = Union[float, int]
|
|
12
12
|
Sample = Dict[str, Numeric]
|
|
@@ -20,14 +20,11 @@ class Runtime(BaseModel):
|
|
|
20
20
|
----------
|
|
21
21
|
total: float
|
|
22
22
|
Total time of solution processing
|
|
23
|
-
overhead: Optional[float]
|
|
24
|
-
Time of the classical computing processes
|
|
25
23
|
qpu: Optional[float]
|
|
26
24
|
Total time of the quantum computing processes
|
|
27
25
|
"""
|
|
28
26
|
|
|
29
27
|
total: float
|
|
30
|
-
overhead: Optional[float]
|
|
31
28
|
qpu: Optional[float]
|
|
32
29
|
# ...
|
|
33
30
|
|
|
@@ -79,6 +76,8 @@ class Solution(PrettyBase):
|
|
|
79
76
|
Optimization sense, can be 'min' or 'max'.
|
|
80
77
|
metadata: Optional[Dict]
|
|
81
78
|
Solution's metadata
|
|
79
|
+
solver: str
|
|
80
|
+
Solver's name
|
|
82
81
|
provider: str
|
|
83
82
|
The solver provider
|
|
84
83
|
|
|
@@ -90,18 +89,20 @@ class Solution(PrettyBase):
|
|
|
90
89
|
|
|
91
90
|
id: str
|
|
92
91
|
name: Optional[str] = None
|
|
93
|
-
created_date:
|
|
92
|
+
created_date: PydanticDatetimeWrapper
|
|
94
93
|
created_by: str
|
|
95
|
-
modified_date: Optional[
|
|
94
|
+
modified_date: Optional[PydanticDatetimeWrapper] = None
|
|
96
95
|
modified_by: Optional[str] = None
|
|
97
96
|
|
|
98
97
|
error_message: Optional[str] = None
|
|
98
|
+
solver_job_info: Optional[str] = None
|
|
99
99
|
|
|
100
100
|
results: Optional[List[Result]]
|
|
101
101
|
params: Dict[str, Any]
|
|
102
102
|
runtime: Optional[Runtime]
|
|
103
103
|
sense: Optional[SenseEnum]
|
|
104
104
|
metadata: Optional[Dict[str, Any]]
|
|
105
|
+
solver: str
|
|
105
106
|
provider: str
|
|
106
107
|
status: StatusEnum
|
|
107
108
|
optimization: Union[Optimization, str]
|
luna_sdk/schemas/solver_info.py
CHANGED
|
@@ -1,11 +1,41 @@
|
|
|
1
|
-
from
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import List, Optional
|
|
2
3
|
|
|
3
4
|
from pydantic import BaseModel
|
|
4
5
|
|
|
5
6
|
|
|
7
|
+
class OptimizationSense(str, Enum):
|
|
8
|
+
Max = "max"
|
|
9
|
+
Min = "min"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class VariableTypes(str, Enum):
|
|
13
|
+
Binary = "B"
|
|
14
|
+
Integer = "I"
|
|
15
|
+
Float = "F"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ConstraintTypes(str, Enum):
|
|
19
|
+
OneHot = "one-hot"
|
|
20
|
+
Arithmetic = "arithemtic"
|
|
21
|
+
Soft = "soft"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ModelSpecs(BaseModel):
|
|
25
|
+
"""Serialized Model specs"""
|
|
26
|
+
|
|
27
|
+
max_degree: int
|
|
28
|
+
min_degree: int
|
|
29
|
+
needed_constraints: List[ConstraintTypes]
|
|
30
|
+
can_handle_constraints: List[ConstraintTypes]
|
|
31
|
+
can_handle_vtype: List[VariableTypes]
|
|
32
|
+
can_handle_sense: List[OptimizationSense]
|
|
33
|
+
|
|
34
|
+
|
|
6
35
|
class SolverInfo(BaseModel):
|
|
7
36
|
full_name: str
|
|
8
37
|
short_name: str
|
|
9
38
|
available: bool
|
|
10
39
|
params: dict
|
|
11
40
|
description: Optional[str]
|
|
41
|
+
specs: ModelSpecs
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from typing import Any, Optional, List, Tuple, Dict, Literal
|
|
2
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class OptimizerParams(BaseParameter):
|
|
6
|
+
"""
|
|
7
|
+
Parameters for scipy optimizer
|
|
8
|
+
|
|
9
|
+
Attributes
|
|
10
|
+
----------
|
|
11
|
+
method: Literal
|
|
12
|
+
Type of solver. Currently available methods:
|
|
13
|
+
Nelder-Mead, Powell, CG, BFGS, L-BFGS-B, TNC, COBYLA, COBYQA, SLSQP, trust-constr
|
|
14
|
+
bounds: Optional[list[[tuple[float, float]]]]
|
|
15
|
+
Bounds on variables for Nelder-Mead, L-BFGS-B, TNC, SLSQP, Powell, trust-constr,
|
|
16
|
+
and COBYLA methods. Sequence of (min, max) pairs for each element in x.
|
|
17
|
+
None is used to specify no bound.
|
|
18
|
+
tol: Optional[float]
|
|
19
|
+
Tolerance for termination. When tol is specified, the selected minimization
|
|
20
|
+
algorithm sets some relevant solver-specific tolerance(s) equal to tol.
|
|
21
|
+
For detailed control, use solver-specific options.
|
|
22
|
+
options: Optional[dict[str, Any]]
|
|
23
|
+
A dictionary of solver options.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
method: Literal[
|
|
27
|
+
"Nelder-Mead",
|
|
28
|
+
"Powell",
|
|
29
|
+
"CG",
|
|
30
|
+
"BFGS",
|
|
31
|
+
"L-BFGS-B",
|
|
32
|
+
"TNC",
|
|
33
|
+
"COBYLA",
|
|
34
|
+
"COBYQA",
|
|
35
|
+
"SLSQP",
|
|
36
|
+
"trust-constr",
|
|
37
|
+
] = "COBYLA"
|
|
38
|
+
bounds: Optional[List[Tuple[float, float]]] = None
|
|
39
|
+
tol: Optional[float] = None
|
|
40
|
+
options: Optional[Dict[str, Any]] = {"maxiter": 20}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import List, Optional
|
|
2
2
|
|
|
3
|
-
from pydantic import
|
|
3
|
+
from pydantic import Field
|
|
4
4
|
|
|
5
|
+
from luna_sdk.schemas.solver_parameters.aws.optimizer_params import OptimizerParams
|
|
6
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
|
|
9
|
+
class QaoaParameters(BaseParameter):
|
|
7
10
|
"""
|
|
8
11
|
The Quantum Approximate Optimization Algorithm ([QAOA](https://arxiv.org/abs/1411.4028))
|
|
9
12
|
solves combinatorial optimization problems by approximating the solution.
|
|
@@ -13,6 +16,35 @@ class QaoaParameters(BaseModel):
|
|
|
13
16
|
for the current NISQ (noisy intermediate-scale quantum) era. In this NISQ era QAOA is also an emerging
|
|
14
17
|
approach for benchmarking quantum devices and is a prime candidate for demonstrating a practical
|
|
15
18
|
quantum speed-up on near-term NISQ device.
|
|
19
|
+
|
|
20
|
+
Parameters
|
|
21
|
+
----------
|
|
22
|
+
aws_provider: str
|
|
23
|
+
QPU provider name from Amazon Braket.
|
|
24
|
+
Available providers and devices can be found
|
|
25
|
+
[here](https://us-east-1.console.aws.amazon.com/braket/home?region=us-east-1#/devices).
|
|
26
|
+
|
|
27
|
+
aws_device: str
|
|
28
|
+
QPU device name from Amazon Braket.
|
|
29
|
+
Available providers and devices can be found
|
|
30
|
+
[here](https://us-east-1.console.aws.amazon.com/braket/home?region=us-east-1#/devices).
|
|
31
|
+
|
|
32
|
+
seed: Optional[int]
|
|
33
|
+
Seed for the random number generator. Default: 385920.
|
|
34
|
+
|
|
35
|
+
reps: Optional[int]
|
|
36
|
+
The number of repetitions in the QAOA circuit. Default: 1.
|
|
37
|
+
|
|
38
|
+
initial_values: Optional[List[float]]
|
|
39
|
+
Initial values for the QAOA parameters. Default: None.
|
|
40
|
+
|
|
41
|
+
shots: int
|
|
42
|
+
The number of shots to run on the quantum device. Default: 1024.
|
|
43
|
+
|
|
44
|
+
optimizer_params: Optional[dict]
|
|
45
|
+
Parameters for the optimizer. Default: None.
|
|
46
|
+
|
|
47
|
+
All possible optimizer parameters can be found in the [scipy.optimize.minimize documentation](https://docs.scipy.org/doc/scipy-1.13.1/reference/generated/scipy.optimize.minimize.html).
|
|
16
48
|
"""
|
|
17
49
|
|
|
18
50
|
aws_provider: str = ""
|
|
@@ -21,4 +53,4 @@ class QaoaParameters(BaseModel):
|
|
|
21
53
|
reps: Optional[int] = 1
|
|
22
54
|
initial_values: Optional[List[float]] = None
|
|
23
55
|
shots: Optional[int] = 1024
|
|
24
|
-
optimizer_params:
|
|
56
|
+
optimizer_params: OptimizerParams = OptimizerParams()
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import multiprocessing as mp
|
|
2
2
|
from typing import Any, List, Mapping, Optional, Tuple, Union
|
|
3
3
|
|
|
4
|
-
from pydantic import
|
|
4
|
+
from pydantic import Field
|
|
5
5
|
from typing_extensions import Literal
|
|
6
6
|
|
|
7
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
8
|
+
|
|
7
9
|
# The default absolute tolerance that should be used for `numpy.isclose(...)`
|
|
8
10
|
# calls. Equal to the default used in `numpy.isclose(..)`.
|
|
9
11
|
DEFAULT_ATOL: float = 1.0e-8
|
|
@@ -16,7 +18,6 @@ DEFAULT_RTOL: float = 1.0e-5
|
|
|
16
18
|
# Number of seconds before routine halts. Default is 2592000 for dimod.qbsolv.
|
|
17
19
|
DEFAULT_TIMEOUT: int = 10
|
|
18
20
|
|
|
19
|
-
|
|
20
21
|
# The number of processes that should be used for parallel solving.
|
|
21
22
|
# Default is `mp.cpu_count()`.
|
|
22
23
|
DEFAULT_MULTIPROCESSING_CPU_COUNT: int = mp.cpu_count()
|
|
@@ -26,11 +27,11 @@ DEFAULT_MULTIPROCESSING_CPU_COUNT: int = mp.cpu_count()
|
|
|
26
27
|
DRAMATIQ_ACTOR_MAX_RETRIES: int = 0
|
|
27
28
|
|
|
28
29
|
|
|
29
|
-
class BaseSolver(
|
|
30
|
+
class BaseSolver(BaseParameter):
|
|
30
31
|
timeout: Optional[Any] = None
|
|
31
32
|
|
|
32
33
|
|
|
33
|
-
class Tabu(
|
|
34
|
+
class Tabu(BaseParameter):
|
|
34
35
|
"""
|
|
35
36
|
Parameters
|
|
36
37
|
----------
|
|
@@ -62,7 +63,7 @@ class Tabu(BaseModel):
|
|
|
62
63
|
initial_states_generator: Literal["none", "tile", "random"] = "random"
|
|
63
64
|
|
|
64
65
|
|
|
65
|
-
class SimulatedAnnealing(
|
|
66
|
+
class SimulatedAnnealing(BaseParameter):
|
|
66
67
|
"""
|
|
67
68
|
Parameters
|
|
68
69
|
----------
|
|
@@ -98,7 +99,7 @@ class SimulatedAnnealing(BaseModel):
|
|
|
98
99
|
initial_states_generator: Literal["none", "tile", "random"] = "random"
|
|
99
100
|
|
|
100
101
|
|
|
101
|
-
class Decomposer(
|
|
102
|
+
class Decomposer(BaseParameter):
|
|
102
103
|
"""
|
|
103
104
|
Parameters
|
|
104
105
|
----------
|
|
@@ -139,7 +140,7 @@ class Decomposer(BaseModel):
|
|
|
139
140
|
traversal: Literal["energy", "bfs", "pfs"] = "energy"
|
|
140
141
|
|
|
141
142
|
|
|
142
|
-
class FixedTemperatureSampler(
|
|
143
|
+
class FixedTemperatureSampler(BaseParameter):
|
|
143
144
|
"""
|
|
144
145
|
Parameters
|
|
145
146
|
----------
|
|
@@ -153,7 +154,7 @@ class FixedTemperatureSampler(BaseModel):
|
|
|
153
154
|
num_reads: Optional[int] = None
|
|
154
155
|
|
|
155
156
|
|
|
156
|
-
class EmbeddingParameters(
|
|
157
|
+
class EmbeddingParameters(BaseParameter):
|
|
157
158
|
"""
|
|
158
159
|
Parameters
|
|
159
160
|
----------
|
|
@@ -253,7 +254,7 @@ class EmbeddingParameters(BaseModel):
|
|
|
253
254
|
suspend_chains: Any = ()
|
|
254
255
|
|
|
255
256
|
|
|
256
|
-
class AutoEmbeddingParams(
|
|
257
|
+
class AutoEmbeddingParams(BaseParameter):
|
|
257
258
|
"""
|
|
258
259
|
Parameters
|
|
259
260
|
----------
|
|
@@ -264,7 +265,7 @@ class AutoEmbeddingParams(BaseModel):
|
|
|
264
265
|
embedding_parameters: EmbeddingParameters = EmbeddingParameters()
|
|
265
266
|
|
|
266
267
|
|
|
267
|
-
class Embedding(
|
|
268
|
+
class Embedding(BaseParameter):
|
|
268
269
|
"""
|
|
269
270
|
Parameters
|
|
270
271
|
----------
|
|
@@ -285,7 +286,7 @@ class Embedding(BaseModel):
|
|
|
285
286
|
embedding_parameters: EmbeddingParameters = EmbeddingParameters()
|
|
286
287
|
|
|
287
288
|
|
|
288
|
-
class SamplingParams(
|
|
289
|
+
class SamplingParams(BaseParameter):
|
|
289
290
|
"""
|
|
290
291
|
Parameters
|
|
291
292
|
----------
|
|
@@ -339,7 +340,7 @@ class SamplingParams(BaseModel):
|
|
|
339
340
|
reinitialize_state: Optional[bool] = None
|
|
340
341
|
|
|
341
342
|
|
|
342
|
-
class Qpu(
|
|
343
|
+
class Qpu(BaseParameter):
|
|
343
344
|
"""
|
|
344
345
|
Parameters
|
|
345
346
|
----------
|
|
@@ -361,7 +362,7 @@ class Qpu(BaseModel):
|
|
|
361
362
|
auto_embedding_params: AutoEmbeddingParams = AutoEmbeddingParams()
|
|
362
363
|
|
|
363
364
|
|
|
364
|
-
class Loop(
|
|
365
|
+
class Loop(BaseParameter):
|
|
365
366
|
"""
|
|
366
367
|
Parameters
|
|
367
368
|
----------
|
|
@@ -386,7 +387,7 @@ class Loop(BaseModel):
|
|
|
386
387
|
atol: float = DEFAULT_ATOL
|
|
387
388
|
|
|
388
389
|
|
|
389
|
-
class QBSOLVLike(
|
|
390
|
+
class QBSOLVLike(BaseParameter):
|
|
390
391
|
"""
|
|
391
392
|
Parameters
|
|
392
393
|
----------
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
|
|
3
|
-
from pydantic import
|
|
3
|
+
from pydantic import Field
|
|
4
4
|
|
|
5
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
5
6
|
from luna_sdk.schemas.solver_parameters.dwave import Decomposer, Loop, Tabu
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
class DialecticSearchParameters(
|
|
9
|
+
class DialecticSearchParameters(BaseParameter):
|
|
9
10
|
"""
|
|
10
11
|
The Dialectic Search Solver uses a path search between two states representing the thesis and antithesis.
|
|
11
12
|
A greedy search is used to reduce the energy by applying bit flips in an attempt to find the solution.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
|
|
3
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
5
4
|
from luna_sdk.schemas.solver_parameters.dwave import (
|
|
6
5
|
Decomposer,
|
|
7
6
|
Loop,
|
|
@@ -41,7 +40,7 @@ class TabuKerberos(Tabu):
|
|
|
41
40
|
max_time: Optional[float] = None
|
|
42
41
|
|
|
43
42
|
|
|
44
|
-
class KerberosParameters(
|
|
43
|
+
class KerberosParameters(BaseParameter):
|
|
45
44
|
"""
|
|
46
45
|
Kerberos divides the problem into subproblems and solves them using Tabu Search, Simulated Annealing and QPU Subproblem Sampling.
|
|
47
46
|
These algorithms are executed in parallel and afterwards the best solutions are combined.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from typing import Optional, Union
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class LeapHybridBqmParameters(
|
|
6
|
+
class LeapHybridBqmParameters(BaseParameter):
|
|
7
7
|
"""
|
|
8
8
|
Leap's quantum-classical hybrid solvers are intended to solve arbitrary application
|
|
9
9
|
problems formulated as quadratic models.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from typing import List, Optional, Union
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class LeapHybridCqmParameters(
|
|
6
|
+
class LeapHybridCqmParameters(BaseParameter):
|
|
7
7
|
"""
|
|
8
8
|
Leap's quantum-classical hybrid solvers are intended to solve arbitrary application
|
|
9
9
|
problems formulated as quadratic models.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
3
2
|
from luna_sdk.schemas.solver_parameters.dwave import FixedTemperatureSampler, Loop
|
|
4
3
|
|
|
5
4
|
|
|
6
|
-
class ParallelTemperingParameters(
|
|
5
|
+
class ParallelTemperingParameters(BaseParameter):
|
|
7
6
|
"""
|
|
8
7
|
Parallel Tempering uses multiple optimization procedures per temperature.
|
|
9
8
|
During the cooling process, an exchange of replicas can take place between the parallel procedures,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
3
2
|
from luna_sdk.schemas.solver_parameters.dwave import (
|
|
4
3
|
Decomposer,
|
|
5
4
|
FixedTemperatureSampler,
|
|
@@ -8,7 +7,7 @@ from luna_sdk.schemas.solver_parameters.dwave import (
|
|
|
8
7
|
)
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
class ParallelTemperingQpuParameters(
|
|
10
|
+
class ParallelTemperingQpuParameters(BaseParameter):
|
|
12
11
|
"""
|
|
13
12
|
Parallel Tempering uses multiple optimization procedures per temperature. During the cooling process,
|
|
14
13
|
an exchange of replicas can take place between the parallel procedures, thus enabling higher energy mountains to be overcome.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
3
2
|
from luna_sdk.schemas.solver_parameters.dwave import FixedTemperatureSampler
|
|
4
3
|
|
|
5
4
|
|
|
6
|
-
class PopulationAnnealingParameters(
|
|
5
|
+
class PopulationAnnealingParameters(BaseParameter):
|
|
7
6
|
"""
|
|
8
7
|
Population Annealing uses a sequential Monte Carlo method to minimize the energy of a population.
|
|
9
8
|
The population consists of walkers that can explore their neighborhood during the cooling process.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from pydantic import BaseModel
|
|
2
2
|
|
|
3
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
3
4
|
from luna_sdk.schemas.solver_parameters.dwave import (
|
|
4
5
|
Decomposer,
|
|
5
6
|
FixedTemperatureSampler,
|
|
@@ -7,7 +8,7 @@ from luna_sdk.schemas.solver_parameters.dwave import (
|
|
|
7
8
|
)
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
class PopulationAnnealingQpuParameters(
|
|
11
|
+
class PopulationAnnealingQpuParameters(BaseParameter):
|
|
11
12
|
"""
|
|
12
13
|
Population Annealing uses a sequential Monte Carlo method to minimize the energy of a population.
|
|
13
14
|
The population consists of walkers that can explore their neighborhood during the cooling process.
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
|
|
3
|
-
from pydantic import
|
|
3
|
+
from pydantic import Field
|
|
4
4
|
from typing_extensions import Literal
|
|
5
5
|
|
|
6
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
class QAGAParameters(BaseParameter):
|
|
8
10
|
"""
|
|
9
11
|
Parameters for the Quantum Assisted Genetic Algorithm (QAGA).
|
|
10
12
|
QAGA combines the principles of genetic algorithms and quantum annealing to solve optimization problems.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
3
2
|
from luna_sdk.schemas.solver_parameters.dwave import QBSOLVLike, Qpu
|
|
4
3
|
|
|
5
4
|
|
|
6
|
-
class QbSolvLikeQpuParameters(
|
|
5
|
+
class QbSolvLikeQpuParameters(BaseParameter):
|
|
7
6
|
"""
|
|
8
7
|
QBSolv QPU splits the problem into parts and solves them using the Tabu Search algorithm. For this purpose, the DWaveSampler is used.
|
|
9
8
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
3
2
|
from luna_sdk.schemas.solver_parameters.dwave import QBSOLVLike, SimulatedAnnealing
|
|
4
3
|
|
|
5
4
|
|
|
6
|
-
class QbSolvLikeSimulatedAnnealingParameters(
|
|
5
|
+
class QbSolvLikeSimulatedAnnealingParameters(BaseParameter):
|
|
7
6
|
"""
|
|
8
7
|
QBSolv Like Simulated Annealing breaks down the problem and solves the parts individually using a classic solver that uses Simulated Annealing.
|
|
9
8
|
This particular implementation uses hybrid.SimulatedAnnealingSubproblemSampler
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
3
2
|
from luna_sdk.schemas.solver_parameters.dwave import QBSOLVLike, Tabu
|
|
4
3
|
|
|
5
4
|
|
|
6
|
-
class QbSolvLikeTabuSearchParameters(
|
|
5
|
+
class QbSolvLikeTabuSearchParameters(BaseParameter):
|
|
7
6
|
"""
|
|
8
7
|
QBSolv Like Tabu Search breaks down the problem and solves the parts individually using a classic solver that uses Tabu Search.
|
|
9
8
|
This particular implementation uses hybrid.TabuSubproblemSampler (https://docs.ocean.dwavesys.com/projects/hybrid/en/stable/reference/samplers.html#tabusubproblemsampler)
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
3
2
|
from luna_sdk.schemas.solver_parameters.dwave import Embedding, SamplingParams
|
|
4
3
|
|
|
5
4
|
|
|
6
|
-
class QuantumAnnealingParameters(
|
|
5
|
+
class QuantumAnnealingParameters(BaseParameter):
|
|
7
6
|
"""
|
|
8
7
|
Parameters for the Quantum Annealing solver.
|
|
9
8
|
|
|
@@ -2,8 +2,10 @@ from typing import Any, Dict, List, Optional
|
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, Field
|
|
4
4
|
|
|
5
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
class RRQuantumAnnealingSamplingParams(BaseParameter):
|
|
7
9
|
"""
|
|
8
10
|
Parameters
|
|
9
11
|
----------
|
|
@@ -41,7 +43,7 @@ class RRQuantumAnnealingSamplingParams(BaseModel):
|
|
|
41
43
|
reduce_intersample_correlation: bool = False
|
|
42
44
|
|
|
43
45
|
|
|
44
|
-
class RepeatedReverseQuantumAnnealingParameters(
|
|
46
|
+
class RepeatedReverseQuantumAnnealingParameters(BaseParameter):
|
|
45
47
|
"""
|
|
46
48
|
Repeated Reverse Quantum Annealing begins the annealing process from a previously initialized state and increases the temperature from there.
|
|
47
49
|
Afterwards, the temperature is decreased again until the solution is found.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
from typing import Any, List, Optional, Sequence
|
|
2
2
|
|
|
3
|
-
from pydantic import
|
|
3
|
+
from pydantic import Field
|
|
4
4
|
from typing_extensions import Literal
|
|
5
5
|
|
|
6
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
6
7
|
from luna_sdk.schemas.solver_parameters.dwave import SimulatedAnnealing
|
|
7
8
|
|
|
8
9
|
|
|
@@ -61,7 +62,7 @@ class RRSimulatedAnnealing(SimulatedAnnealing):
|
|
|
61
62
|
proposal_acceptance_criteria: Literal["Gibbs", "Metropolis"] = "Metropolis"
|
|
62
63
|
|
|
63
64
|
|
|
64
|
-
class RepeatedReverseSimulatedAnnealingParameters(
|
|
65
|
+
class RepeatedReverseSimulatedAnnealingParameters(BaseParameter):
|
|
65
66
|
"""
|
|
66
67
|
Parameters for the Repeated Reverse Simulated Annealing solver.
|
|
67
68
|
|
|
@@ -2,8 +2,10 @@ from typing import Any, Optional
|
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel
|
|
4
4
|
|
|
5
|
+
from luna_sdk.schemas.solver_parameters.base_parameter import BaseParameter
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
class TabuSearchParameters(BaseParameter):
|
|
7
9
|
"""
|
|
8
10
|
Tabu Search is a heuristic optimization method that works with the help of a tabu list.
|
|
9
11
|
Initially, random states are chosen in the solution landscape.
|