quast_decisiontree.algorithms.classical.scipy_optimizers
quast_decisiontree.algorithms.classical.scipy_optimizers
Scipy-native optimizers for variational algorithms.
These replace the qiskit_algorithms.optimizers dependency with a thin wrapper around scipy.optimize.minimize, exposing the same .minimize(fun, x0) -> result.x interface expected by HybridAlgorithm and the OptimizerBuilder system.
ScipyOptimizer
Thin wrapper around scipy.optimize.minimize.
Provides the .minimize(fun, x0, bounds=None) interface expected by VariationalAlgorithm and QrispQAOA.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
Scipy method name (e.g. 'COBYLA', 'Powell', 'Nelder-Mead'). |
required |
options
|
dict[str, Any] | None
|
Dict of options passed to scipy.optimize.minimize. |
None
|
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
method
instance-attribute
method = method
options
instance-attribute
options = options or {}
__init__
__init__(method, options=None)
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
34 35 36 | |
minimize
minimize(fun, x0, jac=None, bounds=None)
Minimize a scalar function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fun
|
Callable
|
Objective function f(x) -> float. |
required |
x0
|
ndarray
|
Initial parameter vector. |
required |
jac
|
Callable | None
|
Optional gradient function. |
None
|
bounds
|
Any | None
|
Optional parameter bounds. |
None
|
Returns:
| Type | Description |
|---|---|
OptimizeResult
|
scipy.optimize.OptimizeResult with .x, .fun, .nfev, etc. |
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
__repr__
__repr__()
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
65 66 | |
CobylaScipy
Bases: ScipyOptimizer
COBYLA optimizer.
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
69 70 71 72 73 | |
__init__
__init__(maxiter=128)
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
72 73 | |
PowellScipy
Bases: ScipyOptimizer
Powell optimizer.
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
76 77 78 79 80 | |
__init__
__init__(maxfev=1024)
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
79 80 | |
NelderMeadScipy
Bases: ScipyOptimizer
Nelder-Mead (simplex) optimizer.
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
83 84 85 86 87 | |
__init__
__init__(maxfev=1024)
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
86 87 | |
LBFGSBScipy
Bases: ScipyOptimizer
L-BFGS-B optimizer (gradient-based, supports bounds).
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
90 91 92 93 94 | |
__init__
__init__(maxiter=128)
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
93 94 | |
adapt_optimizer
adapt_optimizer(optimizer)
Adapt an optimizer to the scipy custom minimizer interface.
Handles
- None or str: returned as-is (scipy method name).
- ScipyOptimizer: wrapped to match fun(x) signature.
- Object with .minimize(fun, x0): wrapped to return OptimizeResult.
Returns:
| Type | Description |
|---|---|
|
A scipy-compatible optimizer (str, callable, or None). |
Source code in src/quast_decisiontree/algorithms/classical/scipy_optimizers.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |