MATLAB library for global optimization of an arbitrary function by random mutations algorithm. Version 0.2.
https://arxiv.org/abs/1304.3703
Before using the library, please read the terms of use.
To use the library download and include the files to the search path.
Initialize the optimizer by calling rm_init
and use the function OptimizeRM
to perform optimization.
[global_best_f, global_best] = OptimizeRM(f, len)
returns minimum valueglobal_best_f
and minimum pointglobal_best
for the function handlerf
withlen
number of point parameters[___] = OptimizeRM(f, len, start_point)
specifies the initial pointstart_point
of search; by defaultstart_point
is an array of zeros[___] = OptimizeRM(f, len, start_point, scale)
specifies the mutations scale (mutations are being multiplied byscale
); by defaultscale = 1
Parameters of the algorithm are stored in the global variable rmparams
:
rmparams.display
- display output (default:1
)rmparams.n_pop
- size of the population (default:50
); linearly increases computation time, increases the probability of finding the global minimumrmparams.n_des
- number of descendants (default:10
); linearly increases computation time, increases the speed of convergence nearby the obtained minimumrmparams.maxmut
- maximum number of parameters being mutated (default:5
); should be greater than 2, depends on the function being optimized, but usually 5 works wellrmparams.n_stall
- number of iterations to stop the search when answer is less thanrmparams.eps
(default:10
)rmparams.eps
- optimization function tolerance (default:1e-6
)rmparams.p_min
- minimum scale power (default:-9
); decreases convergence speed, increases accuracy of local convergencermparams.p_max
- maximum scale power (default:1
)rmparams.b
- scale factor (default:10
)rmparams.local_search
- perform local optimization at the end of iterations withfminsearch
(default:0
)
Varying parameter is being changed by a factor m*rmparams.b^p
, where m
is uniformly distributed from -1
to 1
, p
is an integer uniformly distributed from rmparams.p_min
to rmparams.p_max
.
Calling rm_init
initializes rmparams
with default parameters values.
Variable rmparams
also stores debug information on iterations:
rmparams.best_f
- array of minimal values on each iterationrmparams.funEvals
- array of numbers of total evaluations off
from the start for each iterationrmparams.best_x
- cell array of minimal points on each iteration
The following MATLAB script evaluates the global maximum of the function .
rm_init; % Initialize optimizer parameters
rmparams.n_pop = 100; % Change population size
[result, result_p] = OptimizeRM(@(p)-TestFunc(p, 0.5), 100); % Evaluate minimum
function res = TestFunc(x, b) % Function to minimize
res = sum(abs(sin(x+b)));
end
This library is distributed under GNU General Public License v3.0.
For using the library in research work, please cite as:
[1] Chernyavskiy A. Yu., Calculation of quantum discord and entanglement measures using the random mutations optimization algorithm, arXiv:1304.3703 [quant-ph], 2013.
[2] Chernyavskiy A. Yu., Global optimization solver for MATLAB, URL: https://github.com/PQCLab/RandomMutations