montecarlo

sherpa.optmethods.optfcts.montecarlo(fcn, x0, xmin, xmax, ftol=1.1920928955078125e-07, maxfev=None, verbose=0, seed=74815, population_size=None, xprob=0.9, weighting_factor=0.8, numcores=1)[source] [edit on github]

Monte Carlo optimization method.

This is an implementation of the differential-evolution algorithm from Storn and Price (1997) 1. A population of fixed size - which contains n-dimensional vectors, where n is the number of free parameters - is randomly initialized. At each iteration, a new n-dimensional vector is generated by combining vectors from the pool of population, the resulting trial vector is selected if it lowers the objective function.

Parameters
  • fcn (function reference) – Returns the current statistic and per-bin statistic value when given the model parameters.

  • x0 (sequence of number) – The starting point, minimum, and maximum values for each parameter.

  • xmin (sequence of number) – The starting point, minimum, and maximum values for each parameter.

  • xmax (sequence of number) – The starting point, minimum, and maximum values for each parameter.

  • ftol (number) – The function tolerance to terminate the search for the minimum; the default is sqrt(DBL_EPSILON) ~ 1.19209289551e-07, where DBL_EPSILON is the smallest number x such that 1.0 != 1.0 + x.

  • maxfev (int or None) – The maximum number of function evaluations; the default value of None means to use 8192 * n, where n is the number of free parameters.

  • verbose (int) – The amount of information to print during the fit. The default is 0, which means no output.

  • seed (int) – The seed for the random number generator.

  • population_size (int or None) – The population of potential solutions is allowed to evolve to search for the minimum of the fit statistics. The trial solution is randomly chosen from a combination from the current population, and it is only accepted if it lowers the statistics. A value of None means to use a value 16 * n, where n is the number of free parameters.

  • xprob (num) – The crossover probability should be within the range [0.5,1.0]; default value is 0.9. A high value for the crossover probability should result in a faster convergence rate; conversely, a lower value should make the differential evolution method more robust.

  • weighting_factor (num) – The weighting factor should be within the range [0.5, 1.0]; default is 0.8. Differential evolution is more sensitive to the weighting_factor then the xprob parameter. A lower value for the weighting_factor, coupled with an increase in the population_size, gives a more robust search at the cost of efficiency.

  • numcores (int) – The number of CPU cores to use. The default is 1.

References

1

Storn, R. and Price, K. “Differential Evolution: A Simple and Efficient Adaptive Scheme for Global Optimization over Continuous Spaces.” J. Global Optimization 11, 341-359, 1997. http://www.icsi.berkeley.edu/~storn/code.html