2.7 KiB
Optimization methods of multi-Debye fitting
Class Optimizer
supports global optimization algorithms (particle swarm, duall annealing, evolutionary algorithms) for finding an optimal set of relaxation times that minimise the error between the actual and the approximated electric permittivity and calculate optimised weights for the given relaxation times.
Code written here is mainly based on external libraries, like scipy
and pyswarm
.
Supported methods:
- hybrid Particle Swarm-Damped Least Squares
- hybrid Dual Annealing-Damped Least Squares
- hybrid Differential Evolution-Damped Least Squares
Methods
-
constructor - it is called in all childern classes.
It takes the following arguments:
maxiter
: maximum number of iterations for the optimizer,seed
: Seed for RandomState.
In constructor the attributes:
maxiter
,seed
,calc_weights
(used to fit weight, non-linear least squares (LS) method is used as a default) are set.
-
fit - it is inherited by all children classes. It calls the optimization function that tries to find an optimal set of relaxation times that minimise the error between the actual and the approximated electric permittivity and calculate optimised weights for the given relaxation times. It takes the following arguments:
func
: objective function to be optimized,lb
: the lower bounds of the design variable(s),ub
: the upper bounds of the design variable(s),funckwargs
: optional arguments takien by objective function.
-
cost_function - it is inherited by all children classes. It calculate cost function as the average error between the actual and the approximated electric permittivity (sum of real and imaginary part). It takes the following arguments:
x
: the logarithm with base 10 of relaxation times of the Debyes poles,rl
: real parts of chosen relaxation function for given frequency points,im
: imaginary parts of chosen relaxation function for given frequency points,freq
: the frequencies vector for defined grid.
-
calc_relaxation_times - it find an optimal set of relaxation times that minimise an objective function using appropriate optimization procedure. It takes the following arguments:
func
: objective function to be optimized,lb
: the lower bounds of the design variable(s),ub
: the upper bounds of the design variable(s),funckwargs
: optional arguments takien by objective function.
Each new class of optimizer should:
- define constructor with appropriate arguments,
- overload calc_relaxation_times method (and optional define calc_weights function in case of hybrid optimization procedure).