qiskit_addon_opt_mapper.solvers.OptimizationSolver¶
- class OptimizationSolver[source]¶
Bases:
ABCAn abstract class for optimization solvers in the qiskit addon opt mapper.
- __init__()¶
Methods
__init__()get_compatibility_msg(problem)Checks whether a given problem can be solved with the optimizer implementing this method.
is_compatible(problem)Checks whether a given problem can be solved with the optimizer implementing this method.
solve(problem)Tries to solves the given problem using the optimizer.
- abstract get_compatibility_msg(problem)[source]¶
Checks whether a given problem can be solved with the optimizer implementing this method.
- Parameters:
problem (OptimizationProblem) – The optimization problem to check compatibility.
- Returns:
Returns the incompatibility message. If the message is empty no issues were found.
- Return type:
- is_compatible(problem)[source]¶
Checks whether a given problem can be solved with the optimizer implementing this method.
- Parameters:
problem (OptimizationProblem) – The optimization problem to check compatibility.
- Returns:
Returns True if the problem is compatible, False otherwise.
- Return type:
- abstract solve(problem)[source]¶
Tries to solves the given problem using the optimizer.
Runs the optimizer to try to solve the optimization problem.
- Parameters:
problem (OptimizationProblem) – The problem to be solved.
- Returns:
The result of the optimizer applied to the problem.
- Raises:
OptimizationError – If the problem is incompatible with the optimizer.
- Return type: