luna-quantum 0.0.16__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.

Files changed (160) hide show
  1. luna_quantum-0.0.16.dist-info/LICENSE +201 -0
  2. luna_quantum-0.0.16.dist-info/METADATA +46 -0
  3. luna_quantum-0.0.16.dist-info/RECORD +160 -0
  4. luna_quantum-0.0.16.dist-info/WHEEL +4 -0
  5. luna_sdk/__init__.py +2 -0
  6. luna_sdk/constants.py +1 -0
  7. luna_sdk/controllers/__init__.py +2 -0
  8. luna_sdk/controllers/custom_login_client.py +61 -0
  9. luna_sdk/controllers/luna_platform_client.py +62 -0
  10. luna_sdk/controllers/luna_q.py +36 -0
  11. luna_sdk/controllers/luna_solve.py +49 -0
  12. luna_sdk/controllers/luna_transform.py +41 -0
  13. luna_sdk/error/__init__.py +0 -0
  14. luna_sdk/error/http_error_utils.py +100 -0
  15. luna_sdk/exceptions/__init__.py +1 -0
  16. luna_sdk/exceptions/encryption_exception.py +6 -0
  17. luna_sdk/exceptions/luna_exception.py +7 -0
  18. luna_sdk/exceptions/luna_server_exception.py +18 -0
  19. luna_sdk/exceptions/timeout_exception.py +10 -0
  20. luna_sdk/exceptions/transformation.py +11 -0
  21. luna_sdk/interfaces/__init__.py +5 -0
  22. luna_sdk/interfaces/circuit_repo_i.py +62 -0
  23. luna_sdk/interfaces/clients/__init__.py +0 -0
  24. luna_sdk/interfaces/clients/client_i.py +10 -0
  25. luna_sdk/interfaces/clients/luna_q_i.py +39 -0
  26. luna_sdk/interfaces/clients/luna_solve_i.py +37 -0
  27. luna_sdk/interfaces/clients/luna_transform_i.py +33 -0
  28. luna_sdk/interfaces/cplex_repo_i.py +121 -0
  29. luna_sdk/interfaces/info_repo_i.py +40 -0
  30. luna_sdk/interfaces/lp_repo_i.py +106 -0
  31. luna_sdk/interfaces/optimization_repo_i.py +262 -0
  32. luna_sdk/interfaces/qpu_token_repo_i.py +151 -0
  33. luna_sdk/interfaces/repository_i.py +14 -0
  34. luna_sdk/interfaces/solutions_repo_i.py +219 -0
  35. luna_sdk/py.typed +0 -0
  36. luna_sdk/repositories/__init__.py +4 -0
  37. luna_sdk/repositories/circuit_repo.py +104 -0
  38. luna_sdk/repositories/cplex_repo.py +118 -0
  39. luna_sdk/repositories/info_repo.py +45 -0
  40. luna_sdk/repositories/lp_repo.py +105 -0
  41. luna_sdk/repositories/optimization_repo.py +358 -0
  42. luna_sdk/repositories/qpu_token_repo.py +226 -0
  43. luna_sdk/repositories/solutions_repo.py +347 -0
  44. luna_sdk/schemas/__init__.py +4 -0
  45. luna_sdk/schemas/circuit.py +43 -0
  46. luna_sdk/schemas/create/__init__.py +3 -0
  47. luna_sdk/schemas/create/circuit.py +29 -0
  48. luna_sdk/schemas/create/optimization.py +22 -0
  49. luna_sdk/schemas/create/qpu_token.py +26 -0
  50. luna_sdk/schemas/create/qubo.py +19 -0
  51. luna_sdk/schemas/create/solution.py +15 -0
  52. luna_sdk/schemas/enums/__init__.py +0 -0
  53. luna_sdk/schemas/enums/circuit.py +14 -0
  54. luna_sdk/schemas/enums/optimization.py +10 -0
  55. luna_sdk/schemas/enums/problem.py +48 -0
  56. luna_sdk/schemas/enums/qpu_token_type.py +6 -0
  57. luna_sdk/schemas/enums/solution.py +8 -0
  58. luna_sdk/schemas/enums/status.py +10 -0
  59. luna_sdk/schemas/enums/timeframe.py +11 -0
  60. luna_sdk/schemas/error_message.py +12 -0
  61. luna_sdk/schemas/optimization.py +75 -0
  62. luna_sdk/schemas/optimization_formats/__init__.py +0 -0
  63. luna_sdk/schemas/optimization_formats/bqm.py +34 -0
  64. luna_sdk/schemas/optimization_formats/cqm.py +127 -0
  65. luna_sdk/schemas/optimization_formats/lp.py +9 -0
  66. luna_sdk/schemas/optimization_formats/qm.py +30 -0
  67. luna_sdk/schemas/pretty_base.py +49 -0
  68. luna_sdk/schemas/qpu_token.py +60 -0
  69. luna_sdk/schemas/representation.py +19 -0
  70. luna_sdk/schemas/rest/__init__.py +0 -0
  71. luna_sdk/schemas/rest/qpu_token/__init__.py +0 -0
  72. luna_sdk/schemas/rest/qpu_token/token_provider.py +45 -0
  73. luna_sdk/schemas/solution.py +227 -0
  74. luna_sdk/schemas/solver_info.py +11 -0
  75. luna_sdk/schemas/solver_parameters/aws/__init__.py +1 -0
  76. luna_sdk/schemas/solver_parameters/aws/qaoa.py +24 -0
  77. luna_sdk/schemas/solver_parameters/dwave/__init__.py +72 -0
  78. luna_sdk/schemas/solver_parameters/dwave/base.py +409 -0
  79. luna_sdk/schemas/solver_parameters/dwave/dialectic_search.py +31 -0
  80. luna_sdk/schemas/solver_parameters/dwave/kerberos.py +71 -0
  81. luna_sdk/schemas/solver_parameters/dwave/leap_hybrid_bqm.py +19 -0
  82. luna_sdk/schemas/solver_parameters/dwave/leap_hybrid_cqm.py +22 -0
  83. luna_sdk/schemas/solver_parameters/dwave/parallel_tempering.py +30 -0
  84. luna_sdk/schemas/solver_parameters/dwave/parallel_tempering_qpu.py +37 -0
  85. luna_sdk/schemas/solver_parameters/dwave/population_annealing.py +25 -0
  86. luna_sdk/schemas/solver_parameters/dwave/population_annealing_qpu.py +35 -0
  87. luna_sdk/schemas/solver_parameters/dwave/qaga.py +56 -0
  88. luna_sdk/schemas/solver_parameters/dwave/qbsolv_like_qpu.py +19 -0
  89. luna_sdk/schemas/solver_parameters/dwave/qbsolv_like_simulated_annealing.py +22 -0
  90. luna_sdk/schemas/solver_parameters/dwave/qbsolv_like_tabu_search.py +21 -0
  91. luna_sdk/schemas/solver_parameters/dwave/quantum_annealing.py +20 -0
  92. luna_sdk/schemas/solver_parameters/dwave/repeated_reverse_quantum_annealing.py +82 -0
  93. luna_sdk/schemas/solver_parameters/dwave/repeated_reverse_simulated_annealing.py +89 -0
  94. luna_sdk/schemas/solver_parameters/dwave/saga.py +61 -0
  95. luna_sdk/schemas/solver_parameters/dwave/simulated_annealing.py +74 -0
  96. luna_sdk/schemas/solver_parameters/dwave/tabu_search.py +72 -0
  97. luna_sdk/schemas/solver_parameters/fujitsu/__init__.py +20 -0
  98. luna_sdk/schemas/solver_parameters/fujitsu/base.py +47 -0
  99. luna_sdk/schemas/solver_parameters/fujitsu/digital_annealer_cpu.py +129 -0
  100. luna_sdk/schemas/solver_parameters/fujitsu/digital_annealer_v2.py +149 -0
  101. luna_sdk/schemas/solver_parameters/fujitsu/digital_annealer_v3.py +150 -0
  102. luna_sdk/schemas/solver_parameters/fujitsu/partial_config.py +177 -0
  103. luna_sdk/schemas/solver_parameters/ibm/__init__.py +4 -0
  104. luna_sdk/schemas/solver_parameters/ibm/qaoa.py +64 -0
  105. luna_sdk/schemas/solver_parameters/ibm/standard_parameters.py +27 -0
  106. luna_sdk/schemas/solver_parameters/ibm/vqe.py +49 -0
  107. luna_sdk/schemas/solver_parameters/qctrl/__init__.py +1 -0
  108. luna_sdk/schemas/solver_parameters/qctrl/qaoa.py +47 -0
  109. luna_sdk/schemas/transformations/__init__.py +2 -0
  110. luna_sdk/schemas/transformations/bqm.py +33 -0
  111. luna_sdk/schemas/transformations/matrix.py +12 -0
  112. luna_sdk/schemas/use_cases/__init__.py +54 -0
  113. luna_sdk/schemas/use_cases/arbitrage_edge_based.py +49 -0
  114. luna_sdk/schemas/use_cases/arbitrage_node_based.py +54 -0
  115. luna_sdk/schemas/use_cases/base.py +5 -0
  116. luna_sdk/schemas/use_cases/binary_integer_linear_programming.py +53 -0
  117. luna_sdk/schemas/use_cases/binary_paint_shop_problem.py +36 -0
  118. luna_sdk/schemas/use_cases/credit_scoring_feature_selection.py +39 -0
  119. luna_sdk/schemas/use_cases/dynamic_portfolio_optimization.py +63 -0
  120. luna_sdk/schemas/use_cases/exact_cover.py +50 -0
  121. luna_sdk/schemas/use_cases/flight_gate_assignment.py +78 -0
  122. luna_sdk/schemas/use_cases/graph_coloring.py +41 -0
  123. luna_sdk/schemas/use_cases/graph_isomorphism.py +53 -0
  124. luna_sdk/schemas/use_cases/graph_partitioning.py +45 -0
  125. luna_sdk/schemas/use_cases/hamiltonian_cycle.py +48 -0
  126. luna_sdk/schemas/use_cases/induced_subgraph_isomorphism.py +49 -0
  127. luna_sdk/schemas/use_cases/job_shop_scheduling.py +43 -0
  128. luna_sdk/schemas/use_cases/k_medoids_clustering.py +48 -0
  129. luna_sdk/schemas/use_cases/knapsack_integer_weights.py +55 -0
  130. luna_sdk/schemas/use_cases/linear_regression.py +59 -0
  131. luna_sdk/schemas/use_cases/lmwcs.py +80 -0
  132. luna_sdk/schemas/use_cases/longest_path.py +49 -0
  133. luna_sdk/schemas/use_cases/market_graph_clustering.py +60 -0
  134. luna_sdk/schemas/use_cases/max2sat.py +51 -0
  135. luna_sdk/schemas/use_cases/max3sat.py +52 -0
  136. luna_sdk/schemas/use_cases/max_clique.py +59 -0
  137. luna_sdk/schemas/use_cases/max_cut.py +47 -0
  138. luna_sdk/schemas/use_cases/max_independent_set.py +36 -0
  139. luna_sdk/schemas/use_cases/minimal_maximal_matching.py +53 -0
  140. luna_sdk/schemas/use_cases/minimal_spanning_tree.py +87 -0
  141. luna_sdk/schemas/use_cases/minimum_vertex_cover.py +44 -0
  142. luna_sdk/schemas/use_cases/number_partitioning.py +31 -0
  143. luna_sdk/schemas/use_cases/portfolio_optimization.py +45 -0
  144. luna_sdk/schemas/use_cases/portfolio_optimization_ib_tv.py +62 -0
  145. luna_sdk/schemas/use_cases/quadratic_assignment.py +48 -0
  146. luna_sdk/schemas/use_cases/quadratic_knapsack.py +47 -0
  147. luna_sdk/schemas/use_cases/satellite_scheduling.py +72 -0
  148. luna_sdk/schemas/use_cases/sensor_placement.py +57 -0
  149. luna_sdk/schemas/use_cases/set_cover.py +55 -0
  150. luna_sdk/schemas/use_cases/set_packing.py +53 -0
  151. luna_sdk/schemas/use_cases/set_partitioning.py +51 -0
  152. luna_sdk/schemas/use_cases/subgraph_isomorphism.py +56 -0
  153. luna_sdk/schemas/use_cases/subset_sum.py +36 -0
  154. luna_sdk/schemas/use_cases/support_vector_machine.py +63 -0
  155. luna_sdk/schemas/use_cases/traffic_flow.py +34 -0
  156. luna_sdk/schemas/use_cases/travelling_salesman_problem.py +52 -0
  157. luna_sdk/schemas/use_cases/type_aliases.py +11 -0
  158. luna_sdk/schemas/use_cases/weighted_max_cut.py +36 -0
  159. luna_sdk/utils/__init__.py +0 -0
  160. luna_sdk/utils/qpu_tokens.py +52 -0
@@ -0,0 +1,47 @@
1
+ from typing import Literal, Optional, Tuple, Union
2
+
3
+ from pydantic import BaseModel, ConfigDict, Field
4
+
5
+ from luna_sdk.schemas.solver_parameters.fujitsu.partial_config import PartialConfig
6
+
7
+
8
+ class CommonParams(BaseModel):
9
+ auto_tuning: Literal[
10
+ "NOTHING",
11
+ "SCALING",
12
+ "AUTO_SCALING",
13
+ "SAMPLING",
14
+ "AUTO_SCALING_AND_SAMPLING",
15
+ "SCALING_AND_SAMPLING",
16
+ ] = "NOTHING"
17
+ scaling_factor: Union[int, float] = 1.0
18
+ scaling_bit_precision: int = 64
19
+ guidance_config: Optional[PartialConfig] = None
20
+ random_seed: Optional[int] = Field(default=None, ge=0, le=9_999)
21
+ timeseries_max_bits: Optional[int] = None
22
+ solver_max_bits: int = 2**13
23
+
24
+ model_config = ConfigDict(arbitrary_types_allowed=True)
25
+
26
+
27
+ class V2Params(BaseModel):
28
+ optimization_method: Literal["annealing", "parallel_tempering"] = "annealing"
29
+ temperature_start: float = Field(default=1_000.0, ge=0.0, le=1e20)
30
+ temperature_end: float = Field(default=1.0, ge=0.0, le=1e20)
31
+ temperature_mode: int = 0
32
+ temperature_interval: int = Field(default=100, ge=1, le=int(1e20))
33
+ offset_increase_rate: float = Field(default=5.0, ge=0.0, le=1e20)
34
+ solution_mode: Literal["QUICK", "COMPLETE"] = "COMPLETE"
35
+ flip_probabilities: Tuple[float, float] = 0.99, 0.01
36
+ annealing_steps: Tuple[float, float] = 0.0, 0.5
37
+ sampling_runs: int = 100
38
+
39
+
40
+ class ConnectionParams(BaseModel):
41
+ annealer_protocol: Literal["http", "https"] = "https"
42
+ annealer_address: str = "cloud.ts.fujitsu.com"
43
+ annealer_port: int = Field(default=443, ge=0, le=2**16)
44
+ annealer_path: str = "/da-s"
45
+ request_mode: Literal["stream", "simple", "gzip"] = "simple"
46
+ annealer_queue_size: int = 16
47
+ timeout: int = 1_800
@@ -0,0 +1,129 @@
1
+ from typing import Literal
2
+
3
+ from pydantic import Field
4
+
5
+ from luna_sdk.schemas.solver_parameters.fujitsu.base import CommonParams, V2Params
6
+
7
+
8
+ class DigitalAnnealerCPUParameters(CommonParams, V2Params):
9
+ """
10
+ From the [Fujitsu website](https://www.fujitsu.com/global/services/business-services/digital-annealer/):
11
+ Fujitsu's Digital Annealer provides an alternative to quantum computing
12
+ technology, which is at present both very expensive and difficult to run. Using a
13
+ digital circuit design inspired by quantum phenomena, the Digital Annealer focuses
14
+ on rapidly solving complex combinatorial optimization problems without the added
15
+ complications and costs typically associated with quantum computing methods.
16
+
17
+ Parameters
18
+ ----------
19
+ optimization_method: Literal['annealing', 'parallel_tempering']
20
+ Digital Annealer optimization algorithm.
21
+ temperature_start: float
22
+ Start temperature of the annealing process. Min: 0.0, Max: 1e20
23
+ temperature_end: float
24
+ End temperature of the annealing process. Min: 0.0, Max: 1e20
25
+ temperature_mode: int
26
+ Cooling curve mode for temperature decay.
27
+ 0, 'EXPONENTIAL': Reduce temperature by factor `1 - temperature_decay` every temperature_interval steps
28
+ 1, 'INVERSE': Reduce temperature by factor `1 - temperature_decay * temperature` every temperature_interval steps
29
+ 2, 'INVERSE_ROOT': Reduce temperature by factor `1 - temperature_decay * temperature` every temperature_interval steps.
30
+ temperature_interval: int
31
+ Number of iterations keeping temperature constant. Min: 1, Max: 1e20
32
+ offset_increase_rate: float
33
+ Increase of dynamic offset when no bit is selected. Set to 0.0 to switch off dynamic energy feature. Min: 0.0, Max: 1e20
34
+ solution_mode: Literal['QUICK', 'COMPLETE']
35
+ Defines how many solutions should be created. 'COMPLETE' returns all runs best configuration, 'QUICK' returns overall best configuration only.
36
+ flip_probabilities: Tuple[float, float]
37
+ Parameter for determining the start temperature. This parameter indicates the acceptance probability of an energy increase (worsening) in the annealing process at the calculated start temperature.
38
+ annealing_steps: Tuple[float, float]
39
+ `annealing_steps` stands for the portion of annealing steps, where `end_progress_probability` is reached.
40
+ sampling_runs: int
41
+ Sub-parameter used to define the energy deltas during the internal energy sampling procedure for annealing parameter estimation. `sampling_runs` is the number of random walkers started for energy deltas determination.
42
+ auto_tuning: Literal['NOTHING', 'SCALING', 'AUTO_SCALING', 'SAMPLING', 'AUTO_SCALING_AND_SAMPLING', 'SCALING_AND_SAMPLING']
43
+ Following methods for scaling `qubo` and determining temperatures are available:
44
+ AutoTuning.NOTHING: no action
45
+ AutoTuning.SCALING: `scaling_factor` is multiplied to `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
46
+ AutoTuning.AUTO_SCALING: A maximum scaling factor w.r.t. `scaling_bit_precision` is multiplied to `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
47
+ AutoTuning.SAMPLING: `temperature_start`, `temperature_end` and `offset_increase_rate` are automatically determined.
48
+ AutoTuning.AUTO_SCALING_AND_SAMPLING: Temperatures and scaling factor are automatically determined and applied.
49
+ scaling_factor: Union[int, float]
50
+ The scaling factor for `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
51
+ scaling_bit_precision: int
52
+ Maximum `scaling_bit_precision` for `qubo`. Used to define the scaling factor for `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
53
+ guidance_config: Optional[PartialConfig]
54
+ Specifies an initial value for each polynomial (problem) variable that is set to find an optimal solution. By specifying a value that is close to the optimal solution, improvement in the accuracy of the optimal solution can be expected. If you repeatedly use the specified initial values to solve the same polynomial (problem), the same optimal solution is obtained each time.
55
+ random_seed: Optional[int]
56
+ Seed for random numbers for the optimization call. Min: 0, Max: 9_999
57
+ timeseries_max_bits: Optional[int]
58
+ Maximum number of bits for timeseries.
59
+ solver_max_bits: int
60
+ Maximum number of bits on selected solver.
61
+ number_runs: int
62
+ Number of stochastically independent runs. Min: 1, Max: 128
63
+ number_replicas: int
64
+ Number of replicas in parallel tempering. Min: 5, Max: 128
65
+ number_iterations: int
66
+ Total number of iterations per run. Min: 1, Max: 100_000_000
67
+ pt_temperature_model: Literal['Linear', 'Exponential', 'Hukushima']
68
+ Temperature model for furnace temperature distribution for parallel tempering process.
69
+ pt_replica_exchange_model: Literal['Neighbours', 'Far jump']
70
+ Select replica exchange model for parallel tempering process.
71
+ optimization_method: Literal['annealing', 'parallel_tempering']
72
+ Digital Annealer optimization algorithm.
73
+ temperature_start: float
74
+ Start temperature of the annealing process. Min: 0.0, Max: 1e20
75
+ temperature_end: float
76
+ End temperature of the annealing process. Min: 0.0, Max: 1e20
77
+ temperature_mode: int
78
+ Cooling curve mode for temperature decay.
79
+ 0, 'EXPONENTIAL': Reduce temperature by factor `1 - temperature_decay` every temperature_interval steps
80
+ 1, 'INVERSE': Reduce temperature by factor `1 - temperature_decay * temperature` every temperature_interval steps
81
+ 2, 'INVERSE_ROOT': Reduce temperature by factor `1 - temperature_decay * temperature` every temperature_interval steps.
82
+ temperature_interval: int
83
+ Number of iterations keeping temperature constant. Min: 1, Max: 1e20
84
+ offset_increase_rate: float
85
+ Increase of dynamic offset when no bit is selected. Set to 0.0 to switch off dynamic energy feature. Min: 0.0, Max: 1e20
86
+ solution_mode: Literal['QUICK', 'COMPLETE']
87
+ Defines how many solutions should be created. 'COMPLETE' returns all runs best configuration, 'QUICK' returns overall best configuration only.
88
+ flip_probabilities: Tuple[float, float]
89
+ Parameter for determining the start temperature. This parameter indicates the acceptance probability of an energy increase (worsening) in the annealing process at the calculated start temperature.
90
+ annealing_steps: Tuple[float, float]
91
+ `annealing_steps` stands for the portion of annealing steps, where `end_progress_probability` is reached.
92
+ sampling_runs: int
93
+ Sub-parameter used to define the energy deltas during the internal energy sampling procedure for annealing parameter estimation. `sampling_runs` is the number of random walkers started for energy deltas determination.
94
+ auto_tuning: Literal['NOTHING', 'SCALING', 'AUTO_SCALING', 'SAMPLING', 'AUTO_SCALING_AND_SAMPLING', 'SCALING_AND_SAMPLING']
95
+ Following methods for scaling `qubo` and determining temperatures are available:
96
+ AutoTuning.NOTHING: no action
97
+ AutoTuning.SCALING: `scaling_factor` is multiplied to `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
98
+ AutoTuning.AUTO_SCALING: A maximum scaling factor w.r.t. `scaling_bit_precision` is multiplied to `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
99
+ AutoTuning.SAMPLING: `temperature_start`, `temperature_end` and `offset_increase_rate` are automatically determined.
100
+ AutoTuning.AUTO_SCALING_AND_SAMPLING: Temperatures and scaling factor are automatically determined and applied.
101
+ scaling_factor: Union[int, float]
102
+ The scaling factor for `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
103
+ scaling_bit_precision: int
104
+ Maximum `scaling_bit_precision` for `qubo`. Used to define the scaling factor for `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
105
+ guidance_config: Optional[PartialConfig]
106
+ Specifies an initial value for each polynomial (problem) variable that is set to find an optimal solution. By specifying a value that is close to the optimal solution, improvement in the accuracy of the optimal solution can be expected. If you repeatedly use the specified initial values to solve the same polynomial (problem), the same optimal solution is obtained each time.
107
+ random_seed: Optional[int]
108
+ Seed for random numbers for the optimization call. Min: 0, Max: 9_999
109
+ timeseries_max_bits: Optional[int]
110
+ Maximum number of bits for timeseries.
111
+ solver_max_bits: int
112
+ Maximum number of bits on selected solver.
113
+ number_runs: int
114
+ Number of stochastically independent runs. Min: 1, Max: 128
115
+ number_replicas: int
116
+ Number of replicas in parallel tempering. Min: 5, Max: 128
117
+ number_iterations: int
118
+ Total number of iterations per run. Min: 1, Max: 100_000_000
119
+ pt_temperature_model: Literal['Linear', 'Exponential', 'Hukushima']
120
+ Temperature model for furnace temperature distribution for parallel tempering process.
121
+ pt_replica_exchange_model: Literal['Neighbours', 'Far jump']
122
+ Select replica exchange model for parallel tempering process.
123
+ """
124
+
125
+ number_runs: int = Field(default=2, ge=1, le=128)
126
+ number_replicas: int = Field(default=5, ge=5, le=128)
127
+ number_iterations: int = Field(default=1_000, ge=1, le=100_000_000)
128
+ pt_temperature_model: Literal["Linear", "Exponential", "Hukushima"] = "Exponential"
129
+ pt_replica_exchange_model: Literal["Neighbours", "Far jump"] = "Neighbours"
@@ -0,0 +1,149 @@
1
+ from pydantic import Field
2
+
3
+ from luna_sdk.schemas.solver_parameters.fujitsu.base import (
4
+ CommonParams,
5
+ ConnectionParams,
6
+ V2Params,
7
+ )
8
+
9
+
10
+ class DigitalAnnealerV2Parameters(CommonParams, V2Params, ConnectionParams):
11
+ """
12
+ From the [Fujitsu website](https://www.fujitsu.com/global/services/business-services/digital-annealer/):
13
+ Fujitsu's Digital Annealer provides an alternative to quantum computing
14
+ technology, which is at present both very expensive and difficult to run. Using a
15
+ digital circuit design inspired by quantum phenomena, the Digital Annealer focuses
16
+ on rapidly solving complex combinatorial optimization problems without the added
17
+ complications and costs typically associated with quantum computing methods.
18
+
19
+ Parameters
20
+ ----------
21
+ annealer_protocol: Literal['http', 'https']
22
+ Protocol for Digital Annealer REST access: 'http' or 'https'.
23
+ annealer_address: str
24
+ IP address of the host machine of Digital Annealer.
25
+ annealer_port: int
26
+ Port of Digital Annealer service on the host machine. Min: 0, Max: 2**16
27
+ annealer_path: str
28
+ Path prefix used as common root for all REST productions.
29
+ request_mode: Literal['stream', 'simple', 'gzip']
30
+ Defines how the request should be sent.
31
+ annealer_queue_size: int
32
+ Size of Digital Annealer queue for selected service.
33
+ timeout: int
34
+ Timeout for a single http(s)-request in seconds.
35
+ optimization_method: Literal['annealing', 'parallel_tempering']
36
+ Digital Annealer optimization algorithm.
37
+ temperature_start: float
38
+ Start temperature of the annealing process. Min: 0.0, Max: 1e20
39
+ temperature_end: float
40
+ End temperature of the annealing process. Min: 0.0, Max: 1e20
41
+ temperature_mode: int
42
+ Cooling curve mode for temperature decay.
43
+ 0, 'EXPONENTIAL': Reduce temperature by factor `1 - temperature_decay` every temperature_interval steps
44
+ 1, 'INVERSE': Reduce temperature by factor `1 - temperature_decay * temperature` every temperature_interval steps
45
+ 2, 'INVERSE_ROOT': Reduce temperature by factor `1 - temperature_decay * temperature` every temperature_interval steps.
46
+ temperature_interval: int
47
+ Number of iterations keeping temperature constant. Min: 1, Max: 1e20
48
+ offset_increase_rate: float
49
+ Increase of dynamic offset when no bit is selected. Set to 0.0 to switch off dynamic energy feature. Min: 0.0, Max: 1e20
50
+ solution_mode: Literal['QUICK', 'COMPLETE']
51
+ Defines how many solutions should be created. 'COMPLETE' returns all runs best configuration, 'QUICK' returns overall best configuration only.
52
+ flip_probabilities: Tuple[float, float]
53
+ Parameter for determining the start temperature. This parameter indicates the acceptance probability of an energy increase (worsening) in the annealing process at the calculated start temperature.
54
+ annealing_steps: Tuple[float, float]
55
+ `annealing_steps` stands for the portion of annealing steps, where `end_progress_probability` is reached.
56
+ sampling_runs: int
57
+ Sub-parameter used to define the energy deltas during the internal energy sampling procedure for annealing parameter estimation. `sampling_runs` is the number of random walkers started for energy deltas determination.
58
+ auto_tuning: Literal['NOTHING', 'SCALING', 'AUTO_SCALING', 'SAMPLING', 'AUTO_SCALING_AND_SAMPLING', 'SCALING_AND_SAMPLING']
59
+ Following methods for scaling `qubo` and determining temperatures are available:
60
+ AutoTuning.NOTHING: no action
61
+ AutoTuning.SCALING: `scaling_factor` is multiplied to `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
62
+ AutoTuning.AUTO_SCALING: A maximum scaling factor w.r.t. `scaling_bit_precision` is multiplied to `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
63
+ AutoTuning.SAMPLING: `temperature_start`, `temperature_end` and `offset_increase_rate` are automatically determined.
64
+ AutoTuning.AUTO_SCALING_AND_SAMPLING: Temperatures and scaling factor are automatically determined and applied.
65
+ scaling_factor: Union[int, float]
66
+ The scaling factor for `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
67
+ scaling_bit_precision: int
68
+ Maximum `scaling_bit_precision` for `qubo`. Used to define the scaling factor for `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
69
+ guidance_config: Optional[PartialConfig]
70
+ Specifies an initial value for each polynomial (problem) variable that is set to find an optimal solution. By specifying a value that is close to the optimal solution, improvement in the accuracy of the optimal solution can be expected. If you repeatedly use the specified initial values to solve the same polynomial (problem), the same optimal solution is obtained each time.
71
+ random_seed: Optional[int]
72
+ Seed for random numbers for the optimization call. Min: 0, Max: 9_999
73
+ timeseries_max_bits: Optional[int]
74
+ Maximum number of bits for timeseries.
75
+ solver_max_bits: int
76
+ Maximum number of bits on selected solver.
77
+ number_runs: int
78
+ Number of stochastically independent runs. Min: 16, Max: 128
79
+ number_replicas: int
80
+ Number of replicas in parallel tempering. Min: 26, Max: 128
81
+ number_iterations: int
82
+ Total number of iterations per run. Min: 1, Max: 2_000_000_000
83
+ annealer_protocol: Literal['http', 'https']
84
+ Protocol for Digital Annealer REST access: 'http' or 'https'.
85
+ annealer_address: str
86
+ IP address of the host machine of Digital Annealer.
87
+ annealer_port: int
88
+ Port of Digital Annealer service on the host machine. Min: 0, Max: 2**16
89
+ annealer_path: str
90
+ Path prefix used as common root for all REST productions.
91
+ request_mode: Literal['stream', 'simple', 'gzip']
92
+ Defines how the request should be sent.
93
+ annealer_queue_size: int
94
+ Size of Digital Annealer queue for selected service.
95
+ timeout: int
96
+ Timeout for a single http(s)-request in seconds.
97
+ optimization_method: Literal['annealing', 'parallel_tempering']
98
+ Digital Annealer optimization algorithm.
99
+ temperature_start: float
100
+ Start temperature of the annealing process. Min: 0.0, Max: 1e20
101
+ temperature_end: float
102
+ End temperature of the annealing process. Min: 0.0, Max: 1e20
103
+ temperature_mode: int
104
+ Cooling curve mode for temperature decay.
105
+ 0, 'EXPONENTIAL': Reduce temperature by factor `1 - temperature_decay` every temperature_interval steps
106
+ 1, 'INVERSE': Reduce temperature by factor `1 - temperature_decay * temperature` every temperature_interval steps
107
+ 2, 'INVERSE_ROOT': Reduce temperature by factor `1 - temperature_decay * temperature` every temperature_interval steps.
108
+ temperature_interval: int
109
+ Number of iterations keeping temperature constant. Min: 1, Max: 1e20
110
+ offset_increase_rate: float
111
+ Increase of dynamic offset when no bit is selected. Set to 0.0 to switch off dynamic energy feature. Min: 0.0, Max: 1e20
112
+ solution_mode: Literal['QUICK', 'COMPLETE']
113
+ Defines how many solutions should be created. 'COMPLETE' returns all runs best configuration, 'QUICK' returns overall best configuration only.
114
+ flip_probabilities: Tuple[float, float]
115
+ Parameter for determining the start temperature. This parameter indicates the acceptance probability of an energy increase (worsening) in the annealing process at the calculated start temperature.
116
+ annealing_steps: Tuple[float, float]
117
+ `annealing_steps` stands for the portion of annealing steps, where `end_progress_probability` is reached.
118
+ sampling_runs: int
119
+ Sub-parameter used to define the energy deltas during the internal energy sampling procedure for annealing parameter estimation. `sampling_runs` is the number of random walkers started for energy deltas determination.
120
+ auto_tuning: Literal['NOTHING', 'SCALING', 'AUTO_SCALING', 'SAMPLING', 'AUTO_SCALING_AND_SAMPLING', 'SCALING_AND_SAMPLING']
121
+ Following methods for scaling `qubo` and determining temperatures are available:
122
+ AutoTuning.NOTHING: no action
123
+ AutoTuning.SCALING: `scaling_factor` is multiplied to `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
124
+ AutoTuning.AUTO_SCALING: A maximum scaling factor w.r.t. `scaling_bit_precision` is multiplied to `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
125
+ AutoTuning.SAMPLING: `temperature_start`, `temperature_end` and `offset_increase_rate` are automatically determined.
126
+ AutoTuning.AUTO_SCALING_AND_SAMPLING: Temperatures and scaling factor are automatically determined and applied.
127
+ scaling_factor: Union[int, float]
128
+ The scaling factor for `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
129
+ scaling_bit_precision: int
130
+ Maximum `scaling_bit_precision` for `qubo`. Used to define the scaling factor for `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
131
+ guidance_config: Optional[PartialConfig]
132
+ Specifies an initial value for each polynomial (problem) variable that is set to find an optimal solution. By specifying a value that is close to the optimal solution, improvement in the accuracy of the optimal solution can be expected. If you repeatedly use the specified initial values to solve the same polynomial (problem), the same optimal solution is obtained each time.
133
+ random_seed: Optional[int]
134
+ Seed for random numbers for the optimization call. Min: 0, Max: 9_999
135
+ timeseries_max_bits: Optional[int]
136
+ Maximum number of bits for timeseries.
137
+ solver_max_bits: int
138
+ Maximum number of bits on selected solver.
139
+ number_runs: int
140
+ Number of stochastically independent runs. Min: 16, Max: 128
141
+ number_replicas: int
142
+ Number of replicas in parallel tempering. Min: 26, Max: 128
143
+ number_iterations: int
144
+ Total number of iterations per run. Min: 1, Max: 2_000_000_000
145
+ """
146
+
147
+ number_runs: int = Field(default=16, ge=16, le=128)
148
+ number_replicas: int = Field(default=26, ge=26, le=128)
149
+ number_iterations: int = Field(default=1_000_000, ge=1, le=2_000_000_000)
@@ -0,0 +1,150 @@
1
+ from typing import Optional
2
+
3
+ from pydantic import Field
4
+
5
+ from luna_sdk.schemas.solver_parameters.fujitsu.base import (
6
+ CommonParams,
7
+ ConnectionParams,
8
+ )
9
+
10
+
11
+ class DigitalAnnealerV3Parameters(CommonParams, ConnectionParams):
12
+ """
13
+ From the [Fujitsu website](https://www.fujitsu.com/global/services/business-services/digital-annealer/):
14
+ Fujitsu's Digital Annealer provides an alternative to quantum computing
15
+ technology, which is at present both very expensive and difficult to run. Using a
16
+ digital circuit design inspired by quantum phenomena, the Digital Annealer focuses
17
+ on rapidly solving complex combinatorial optimization problems without the added
18
+ complications and costs typically associated with quantum computing methods.
19
+
20
+ Parameters
21
+ ----------
22
+ annealer_protocol: Literal['http', 'https']
23
+ Protocol for Digital Annealer REST access: 'http' or 'https'.
24
+ annealer_address: str
25
+ IP address of the host machine of Digital Annealer.
26
+ annealer_port: int
27
+ Port of Digital Annealer service on the host machine. Min: 0, Max: 2**16
28
+ annealer_path: str
29
+ Path prefix used as common root for all REST productions.
30
+ request_mode: Literal['stream', 'simple', 'gzip']
31
+ Defines how the request should be sent.
32
+ annealer_queue_size: int
33
+ Size of Digital Annealer queue for selected service.
34
+ timeout: int
35
+ Timeout for a single http(s)-request in seconds.
36
+ auto_tuning: Literal['NOTHING', 'SCALING', 'AUTO_SCALING', 'SAMPLING', 'AUTO_SCALING_AND_SAMPLING', 'SCALING_AND_SAMPLING']
37
+ Following methods for scaling `qubo` and determining temperatures are available:
38
+ AutoTuning.NOTHING: no action
39
+ AutoTuning.SCALING: `scaling_factor` is multiplied to `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
40
+ AutoTuning.AUTO_SCALING: A maximum scaling factor w.r.t. `scaling_bit_precision` is multiplied to `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
41
+ AutoTuning.SAMPLING: `temperature_start`, `temperature_end` and `offset_increase_rate` are automatically determined.
42
+ AutoTuning.AUTO_SCALING_AND_SAMPLING: Temperatures and scaling factor are automatically determined and applied.
43
+ scaling_factor: Union[int, float]
44
+ The scaling factor for `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
45
+ scaling_bit_precision: int
46
+ Maximum `scaling_bit_precision` for `qubo`. Used to define the scaling factor for `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
47
+ guidance_config: Optional[PartialConfig]
48
+ Specifies an initial value for each polynomial (problem) variable that is set to find an optimal solution. By specifying a value that is close to the optimal solution, improvement in the accuracy of the optimal solution can be expected. If you repeatedly use the specified initial values to solve the same polynomial (problem), the same optimal solution is obtained each time.
49
+ random_seed: Optional[int]
50
+ Seed for random numbers for the optimization call. Min: 0, Max: 9_999
51
+ timeseries_max_bits: Optional[int]
52
+ Maximum number of bits for timeseries.
53
+ solver_max_bits: int
54
+ Maximum number of bits on selected solver.
55
+ time_limit_sec: Optional[int]
56
+ Maximum running time of DA in seconds. Specifies the upper limit of running time of DA. Min: 1, Max: 1_800
57
+ target_energy: Optional[int]
58
+ Threshold energy for fast exit. This may not work correctly if the specified value is larger than its max value or lower than its min value. Min: -99_999_999_999, Max: 99_999_999_999
59
+ num_group: int
60
+ Number of independent optimization processes. Increasing the number of independent optimization processes leads to better coverage of the search space. Note: Increasing this number requires to also increase `time_limit_sec` such that the search time for each process is sufficient. Min: 1, Max: 16
61
+ num_solution: int
62
+ Number of solutions maintained and updated by each optimization process. Min: 1, Max: 16
63
+ num_output_solution: int
64
+ Maximal number of the best solutions returned by each optimization. Total number of results is `num_solution` * `num_group`. Min: 1, Max: 1_024
65
+ gs_num_iteration_factor: int
66
+ Maximal number of iterations in one epoch of the global search in each optimization is `gs_num_iteration_factor` * number of bits. Min: 0, Max: 100
67
+ gs_num_iteration_cl: int
68
+ Maximal number of iterations without improvement in one epoch of the global search in each optimization before terminating and continuing with the next epoch. For problems with very deep local minima having a very low value is helpful. Min: 0, Max: 1_000_000
69
+ gs_penalty_auto_mode: int
70
+ Parameter to choose whether to automatically incrementally adapt `gs_penalty_coef` to the optimal value.
71
+ 0: Use `gs_penalty_coef` as the fixed factor to weight the penalty polynomial during optimization.
72
+ 1: Start with `gs_penalty_coef` as weight factor for penalty polynomial and automatically and incrementally increase this factor during optimization by multiplying `gs_penalty_inc_rate` / 100 repeatedly until `gs_max_penalty_coef` is reached or the penalty energy is zero.
73
+ gs_penalty_coef: int
74
+ Factor to weight the penalty polynomial. If `gs_penalty_auto_mode` is 0, this value does not change. If `gs_penalty_auto_mode` is 1, this initial weight factor is repeatedly increased by `gs_penalty_inc_rate` until `gs_max_penalty_coef` is reached or the penalty energy is zero. Min: 1, Max: 2**63 - 1
75
+ gs_penalty_inc_rate: int
76
+ Only used if `gs_penalty_auto_mode` is 1. In this case, the initial weight factor `gs_penalty_coef` for the penalty polynomial is repeatedly increased by multiplying `gs_penalty_inc_rate` / 100 until `gs_max_penalty_coef` is reached or the penalty energy is zero. Min: 100, Max: 200
77
+ gs_max_penalty_coef: int
78
+ Maximal value for the penalty coefficient. If `gs_penalty_auto_mode` is 0, this is the maximal value for `gs_penalty_coef`. If `gs_penalty_auto_mode` is 1, this is the maximal value to which `gs_penalty_coef` can be increased during the automatic adjustment. If `gs_max_penalty_coef` is set to 0, then the maximal penalty coefficient is 2^63 - 1. Min: 0, Max: 2**63 - 1
79
+ annealer_protocol: Literal['http', 'https']
80
+ Protocol for Digital Annealer REST access: 'http' or 'https'.
81
+ annealer_address: str
82
+ IP address of the host machine of Digital Annealer.
83
+ annealer_port: int
84
+ Port of Digital Annealer service on the host machine. Min: 0, Max: 2**16
85
+ annealer_path: str
86
+ Path prefix used as common root for all REST productions.
87
+ request_mode: Literal['stream', 'simple', 'gzip']
88
+ Defines how the request should be sent.
89
+ annealer_queue_size: int
90
+ Size of Digital Annealer queue for selected service.
91
+ timeout: int
92
+ Timeout for a single http(s)-request in seconds.
93
+ auto_tuning: Literal['NOTHING', 'SCALING', 'AUTO_SCALING', 'SAMPLING', 'AUTO_SCALING_AND_SAMPLING', 'SCALING_AND_SAMPLING']
94
+ Following methods for scaling `qubo` and determining temperatures are available:
95
+ AutoTuning.NOTHING: no action
96
+ AutoTuning.SCALING: `scaling_factor` is multiplied to `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
97
+ AutoTuning.AUTO_SCALING: A maximum scaling factor w.r.t. `scaling_bit_precision` is multiplied to `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
98
+ AutoTuning.SAMPLING: `temperature_start`, `temperature_end` and `offset_increase_rate` are automatically determined.
99
+ AutoTuning.AUTO_SCALING_AND_SAMPLING: Temperatures and scaling factor are automatically determined and applied.
100
+ scaling_factor: Union[int, float]
101
+ The scaling factor for `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
102
+ scaling_bit_precision: int
103
+ Maximum `scaling_bit_precision` for `qubo`. Used to define the scaling factor for `qubo`, `temperature_start`, `temperature_end` and `offset_increase_rate`.
104
+ guidance_config: Optional[PartialConfig]
105
+ Specifies an initial value for each polynomial (problem) variable that is set to find an optimal solution. By specifying a value that is close to the optimal solution, improvement in the accuracy of the optimal solution can be expected. If you repeatedly use the specified initial values to solve the same polynomial (problem), the same optimal solution is obtained each time.
106
+ random_seed: Optional[int]
107
+ Seed for random numbers for the optimization call. Min: 0, Max: 9_999
108
+ timeseries_max_bits: Optional[int]
109
+ Maximum number of bits for timeseries.
110
+ solver_max_bits: int
111
+ Maximum number of bits on selected solver.
112
+ time_limit_sec: Optional[int]
113
+ Maximum running time of DA in seconds. Specifies the upper limit of running time of DA. Min: 1, Max: 1_800
114
+ target_energy: Optional[int]
115
+ Threshold energy for fast exit. This may not work correctly if the specified value is larger than its max value or lower than its min value. Min: -99_999_999_999, Max: 99_999_999_999
116
+ num_group: int
117
+ Number of independent optimization processes. Increasing the number of independent optimization processes leads to better coverage of the search space. Note: Increasing this number requires to also increase `time_limit_sec` such that the search time for each process is sufficient. Min: 1, Max: 16
118
+ num_solution: int
119
+ Number of solutions maintained and updated by each optimization process. Min: 1, Max: 16
120
+ num_output_solution: int
121
+ Maximal number of the best solutions returned by each optimization. Total number of results is `num_solution` * `num_group`. Min: 1, Max: 1_024
122
+ gs_num_iteration_factor: int
123
+ Maximal number of iterations in one epoch of the global search in each optimization is `gs_num_iteration_factor` * number of bits. Min: 0, Max: 100
124
+ gs_num_iteration_cl: int
125
+ Maximal number of iterations without improvement in one epoch of the global search in each optimization before terminating and continuing with the next epoch. For problems with very deep local minima having a very low value is helpful. Min: 0, Max: 1_000_000
126
+ gs_penalty_auto_mode: int
127
+ Parameter to choose whether to automatically incrementally adapt `gs_penalty_coef` to the optimal value.
128
+ 0: Use `gs_penalty_coef` as the fixed factor to weight the penalty polynomial during optimization.
129
+ 1: Start with `gs_penalty_coef` as weight factor for penalty polynomial and automatically and incrementally increase this factor during optimization by multiplying `gs_penalty_inc_rate` / 100 repeatedly until `gs_max_penalty_coef` is reached or the penalty energy is zero.
130
+ gs_penalty_coef: int
131
+ Factor to weight the penalty polynomial. If `gs_penalty_auto_mode` is 0, this value does not change. If `gs_penalty_auto_mode` is 1, this initial weight factor is repeatedly increased by `gs_penalty_inc_rate` until `gs_max_penalty_coef` is reached or the penalty energy is zero. Min: 1, Max: 2**63 - 1
132
+ gs_penalty_inc_rate: int
133
+ Only used if `gs_penalty_auto_mode` is 1. In this case, the initial weight factor `gs_penalty_coef` for the penalty polynomial is repeatedly increased by multiplying `gs_penalty_inc_rate` / 100 until `gs_max_penalty_coef` is reached or the penalty energy is zero. Min: 100, Max: 200
134
+ gs_max_penalty_coef: int
135
+ Maximal value for the penalty coefficient. If `gs_penalty_auto_mode` is 0, this is the maximal value for `gs_penalty_coef`. If `gs_penalty_auto_mode` is 1, this is the maximal value to which `gs_penalty_coef` can be increased during the automatic adjustment. If `gs_max_penalty_coef` is set to 0, then the maximal penalty coefficient is 2^63 - 1. Min: 0, Max: 2**63 - 1
136
+ """
137
+
138
+ time_limit_sec: Optional[int] = Field(default=None, ge=1, le=1_800)
139
+ target_energy: Optional[int] = Field(
140
+ default=None, ge=-99_999_999_999, le=99_999_999_999
141
+ )
142
+ num_group: int = Field(default=1, ge=1, le=16)
143
+ num_solution: int = Field(default=16, ge=1, le=16)
144
+ num_output_solution: int = Field(default=5, ge=1, le=1_024)
145
+ gs_num_iteration_factor: int = Field(default=5, ge=0, le=100)
146
+ gs_num_iteration_cl: int = Field(default=800, ge=0, le=1_000_000)
147
+ gs_penalty_auto_mode: int = Field(default=1, ge=0, le=1)
148
+ gs_penalty_coef: int = Field(default=1, ge=1, le=2**63 - 1)
149
+ gs_penalty_inc_rate: int = Field(default=150, ge=100, le=200)
150
+ gs_max_penalty_coef: int = Field(default=0, ge=0, le=2**63 - 1)