API reference¶
minimize() runs the optimizer and returns a Result.
Minimize a function using an improved SCE-UA algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
callable
|
The objective function to be minimized.
|
required |
bounds
|
sequence of tuples
|
Bounds for variables, (min, max) pairs for each element in |
required |
args
|
tuple
|
Extra arguments passed to the objective function, defaults to |
()
|
n_complexes
|
int
|
Number of complexes, defaults to |
None
|
n_points_complex
|
int
|
Number of points in each complex. If |
None
|
alpha
|
float
|
Reflection coefficient, defaults to 1.0. |
1.0
|
beta
|
float
|
Contraction coefficient, defaults to 0.5. |
0.5
|
max_evals
|
int
|
Maximum number of function evaluations, defaults to 50000. It must be at
least the population size, |
50000
|
max_iter
|
int
|
Maximum number of iterations, defaults to 1000. |
1000
|
max_tolerant_iter
|
int
|
Maximum number of iterations in which neither the best objective value nor the population's median value beats its record, defaults to 30. Scaling the objective by a positive factor or shifting it leaves the stopping point unchanged, up to floating-point resolution. |
30
|
x_tolerance
|
float
|
Parameter convergence: the run stops once every parameter's range across the population is below this fraction of its bound range, defaults to 1e-4. On a smooth objective this test usually ends the run, and a parameter the objective ignores can keep it from firing. |
0.0001
|
seed
|
int
|
Random seed for reproducibility, defaults to |
None
|
pca_freq
|
int
|
Frequency of PCA recovery, defaults to 1, i.e., every iterations. |
1
|
pca_tol
|
float
|
Tolerance for PCA recovery, defaults to 1e-3.
This is the threshold for eigenvalues to be considered significant.
This threshold is used to apply PCA recovery based on the ratio of
eigenvalues to the maximum eigenvalue, i.e., |
0.001
|
x0
|
ndarray
|
Initial parameter sets to evaluate, each within |
None
|
max_workers
|
int
|
Number of workers for parallel execution, defaults to 1 (no parallelism).
This is passed to the |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
result |
Result
|
The optimization result with the following fields:
|
Result object for the optimization.
Attributes:
| Name | Type | Description |
|---|---|---|
x |
ndarray
|
Best parameters found. |
fun |
float
|
Best function value corresponding to the best parameters. |
nit |
int
|
Number of iterations. |
nfev |
int
|
Number of function evaluations. |
message |
str
|
Message describing the termination reason. |
success |
bool
|
Whether the optimization was successful; |
xv |
ndarray
|
All evaluated parameter sets. |
funv |
ndarray
|
Function values for all evaluated parameter sets. |