OptimizeResult
OptimizeResult
¶
Bases: object
A class to store the results/progress of an optimization algorithm.
Similar to the OptimizeResult
class from scipy.optimize
,
but with a few additional fields and parameters.
Attributes:
Name | Type | Description |
---|---|---|
message |
A message about the optimization result |
|
stop_iteration |
A flag to indicate whether the optimization algorithm has stopped iterating |
|
success |
A flag to indicate whether the optimization algorithm has succeeded |
|
fun |
The current objective function value |
|
nit |
The current number of iterations |
|
error_on_termination |
A flag to indicate whether the optimization algorithm stopped due to an error. |
Source code in viprs/utils/OptimizeResult.py
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
converged
property
¶
Returns:
Type | Description |
---|---|
The flag indicating whether the optimization algorithm has converged. |
iterations
property
¶
Returns:
Type | Description |
---|---|
The current number of iterations. |
objective
property
¶
Returns:
Type | Description |
---|---|
The current value for the objective function. |
oscillation_counter
property
¶
Returns:
Type | Description |
---|---|
The number of oscillations in the objective function value. |
valid_optim_result
property
¶
Returns:
Type | Description |
---|---|
Boolean flag indicating whether the optimization result is valid in the sense tht it either successfully converged OR it stopped iterating without an error (due to e.g. reaching maximum number of iterations). |
reset()
¶
Reset the stored values to their initial state.
Source code in viprs/utils/OptimizeResult.py
update(fun, stop_iteration=False, success=False, message=None, increment=True)
¶
Update the stored values with new values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fun
|
The new objective function value |
required | |
stop_iteration
|
A flag to indicate whether the optimization algorithm has stopped iterating |
False
|
|
success
|
A flag to indicate whether the optimization algorithm has succeeded |
False
|
|
message
|
A detailed message about the optimization result. |
None
|
|
increment
|
A flag to indicate whether to increment the number of iterations. |
True
|