ScipyMilpOptimizer#
- class ScipyMilpOptimizer(disp=False)[ソース]#
ベースクラス:
OptimizationAlgorithm
The MILP optimizer from Scipy wrapped as a Qiskit
OptimizationAlgorithm
.This class provides a wrapper for
scipy.milp
(https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.milp.html) to be used within the optimization module.Initializes the ScipyMILPOptimizer.
- パラメータ:
disp (bool) – Whether to print MILP output or not.
Attributes
- disp#
Returns the display setting.
- 戻り値:
Whether to print scipy.milp information or not.
Methods
- get_compatibility_msg(problem)[ソース]#
Checks whether a given problem can be solved with this optimizer.
Checks if the problem has only linear objective function and linear constraints. The
scipy.milp
supports only linear objective function and linear constraints.- パラメータ:
problem (QuadraticProgram) – The optimization problem to check compatibility.
- 戻り値:
An empty string (if compatible) or a string describing the incompatibility.
- 戻り値の型:
- is_compatible(problem)#
Checks whether a given problem can be solved with the optimizer implementing this method.
- パラメータ:
problem (QuadraticProgram) – The optimization problem to check compatibility.
- 戻り値:
Returns True if the problem is compatible, False otherwise.
- 戻り値の型:
- solve(problem)[ソース]#
Tries to solve the given problem using the optimizer.
Runs the optimizer to try to solve the optimization problem. If problem is not convex, this optimizer may raise an exception due to incompatibility, depending on the settings.
- パラメータ:
problem (QuadraticProgram) – The problem to be solved.
- 戻り値:
The result of the optimizer applied to the problem.
- 例外:
QiskitOptimizationError – If the problem is incompatible with the optimizer.
- 戻り値の型: