QBSolvLikeTabuSearch¶
QBSolv Like Tabu Search breaks down the problem and solves the parts individually using a classic solver that uses Tabu Search. This particular implementation uses hybrid.TabuSubproblemSampler as a sampler for the subproblems to achieve a QBSolv like behaviour.
Note
This solver is only available for commercial and academic licenses.
Compatible Backends¶
The QBSolvLikeTabuSearch
algorithm supports the following backends:
By default, QBSolvLikeTabuSearch
uses the DWave
backend.
Initialization¶
The following section outlines the default configurations of QBSolvLikeTabuSearch
. You can also specify other compatible backends for the algorithm. When backend=None
is specified, the default backend will be initialized automatically. In this case, if the backend requires a token, it will be taken from the environment variables.
from luna_quantum.solve.parameters.algorithms import QBSolvLikeTabuSearch
from luna_quantum.solve.parameters.algorithms.base_params import TabuSearchBaseParams
algorithm = QBSolvLikeTabuSearch(
backend=None,
decomposer_size=50,
rolling=True,
rolling_history=0.15,
max_iter=100,
max_time=5,
convergence=3,
target=None,
rtol=1e-05,
atol=1e-08,
tabu_search_params=TabuSearchBaseParams(
num_reads=None,
tenure=None,
timeout=100
)
)
Parameter Details
For a complete overview of available parameters and their usage, see the QBSolvLikeTabuSearch API Reference.
Usage¶
from luna_quantum import LunaSolve
LunaSolve.authenticate("<YOUR_LUNA_API_KEY>")
# Define your model and algorithm
model = ...
algorithm = ...
solve_job = algorithm.run(model, name="my-solve-job")
API Reference¶
Bases: QBSolvLikeMixin
, LunaAlgorithm[DWave]
QbSolvLikeTabuSearch Parameters.
QBSolv Like Tabu Search breaks down the problem and solves the parts individually using a classic solver that uses Tabu Search. This particular implementation uses hybrid.TabuSubproblemSampler (https://docs.ocean.dwavesys.com/projects/hybrid/en/stable/reference/samplers.html#tabusubproblemsampler) as a sampler for the subproblems to achieve a QBSolv like behaviour.
This class combines parameters from two sources: - QBSolvLikeMixin: Provides parameters for the QBSolv-like decomposition approach - tabu_search_params: Nested parameter object for Tabu Search configuration
Attributes:
Name | Type | Description |
---|---|---|
decomposer_size |
int
|
Size for the decomposer, which determines the maximum subproblem size to be handled in each iteration. Larger values may produce better solutions but increase computational complexity exponentially. Default is 50, which balances solution quality with reasonable runtime. |
rolling |
bool
|
Whether to use rolling window decomposition for the solver. When enabled, this allows for overlapping subproblems with shared variables, which can improve solution quality by better handling interactions across subproblem boundaries. Default is True. |
rolling_history |
float
|
Rolling history factor controlling how much of previous subproblem solutions are considered when solving subsequent subproblems. Higher values incorporate more historical information but may slow convergence to new solutions. Default is 0.15 (15% retention). |
max_iter |
int | None
|
Maximum number of iterations (decomposition and solving cycles) to perform. Higher values allow for more thorough optimization but increase runtime. Default is 100. |
max_time |
int
|
Time in seconds after which the algorithm will stop, regardless of convergence status. Provides a hard time limit for time-constrained applications. Default is 5. |
convergence |
int
|
Number of iterations with unchanged output to terminate algorithm. Higher values ensure more stable solutions but may increase computation time unnecessarily if the algorithm has already found the best solution. Default is 3. |
target |
float | None
|
Energy level that the algorithm tries to reach. If this target energy is achieved, the algorithm will terminate early. Default is None, meaning the algorithm will run until other stopping criteria are met. |
rtol |
float
|
Relative tolerance for convergence. Used when comparing energy values between iterations to determine if significant improvement has occurred. Default uses DEFAULT_RTOL. |
atol |
float
|
Absolute tolerance for convergence. Used alongside rtol when comparing energy values to determine if the algorithm has converged. Default uses DEFAULT_ATOL. |
tabu_search_params |
TabuSearchBaseParams
|
Nested configuration for Tabu Search algorithm parameters. Controls the behavior of the Tabu Search used to solve each subproblem, including parameters like tabu tenure, number of restarts, and timeout conditions. See TabuSearchParams class for details of contained parameters. |
backend
class-attribute
instance-attribute
¶
model_config
class-attribute
instance-attribute
¶
tabu_search_params
class-attribute
instance-attribute
¶
get_compatible_backends
classmethod
¶
get_compatible_backends() -> tuple[type[DWave], ...]
Check at runtime if the used backend is compatible with the solver.
Returns:
Type | Description |
---|---|
tuple[type[IBackend], ...]
|
True if the backend is compatible with the solver, False otherwise. |
get_default_backend
classmethod
¶
get_default_backend() -> DWave
Return the default backend implementation.
This property must be implemented by subclasses to provide the default backend instance to use when no specific backend is specified.
Returns:
Type | Description |
---|---|
IBackend
|
An instance of a class implementing the IBackend interface that serves as the default backend. |
run ¶
run(
model: Model | str,
name: str | None = None,
backend: BACKEND_TYPE | None = None,
client: LunaSolve | str | None = None,
*args: Any,
**kwargs: Any,
) -> SolveJob
Run the configured solver.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Model or str
|
The model to be optimized or solved. It could be an Model instance or a string identifier representing the model id. |
required |
name
|
str | None
|
If provided, the name of the job. Defaults to None. |
None
|
backend
|
BACKEND_TYPE | None
|
Backend to use for the solver. If not provided, the default backend is used. |
None
|
client
|
LunaSolve or str
|
The client interface used to interact with the backend services. If not provided, a default client will be used. |
None
|
*args
|
Any
|
Additional arguments that will be passed to the solver or client. |
()
|
**kwargs
|
Any
|
Additional keyword parameters for configuration or customization. |
{}
|
Returns:
Type | Description |
---|---|
SolveJob
|
The job object containing the information about the solve process. |