Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Using NMinimize for finding global minima, one can choose the DifferentialEvolution method. You can find a (not so) detailed description in the link Constrained Optimization.

That being said, I would like to know if there is a simple way to implement the randomization of the value attributed to the option ScalingFactor. Such a feature should enhance the method:

It has been found recently that selecting F from the interval [0.5, 1.0] randomly for each generation or for each difference vector, a technique called dither, improves convergence behaviour significantly (Differential Evolution Homepage)

where the F mentioned in the quote corresponds to the value of ScalingFactor in Mathematica.

Probably, this is my lack of knowledge on the details of Mathematica showing up, but I don't know how to tell that in each step of NMinimize it should put RandomReal[{0.5,1.}] in the option ScalingFactor.

share|improve this question
I tried "ScalingFactor" :> RandomReal[{0.5, 1}] which appeared to fail. So did setting the option to a list of factors. So I gave up as it probably being impossible. – Michael E2 Feb 20 '14 at 11:43
Maybe I am talking nonsense, but is there any way to control each step of the process of the function NMinimize, so we can sort this random value for "ScalingFactor"each time? – fcpenha Feb 20 '14 at 18:51
@MichaelE2 , could you give some references or hints on how to control the steps of NMinimize and similar functions? Maybe I can't implement this specific problem that I proposed, but I feel I could learn a lot with this. – fcpenha Mar 11 '14 at 17:06
You can read about diff. evol. in tutorial/ConstrainedOptimizationGlobalNumerical -- you probably already have. That's about all I know about how to use it in Mma. What I tried were random guesses based on the description of the implementation in the tutorial. Occasionally I've gotten lucky and found an undocumented feature. Sorry I can't help further. – Michael E2 Mar 11 '14 at 17:21
@MichaelE2 Yes, I've read the documentation. Thank you a lot for the time spent on this subject. – fcpenha Mar 11 '14 at 21:05

1 Answer 1

What follows is, of course, a terrible hack... since NMinimize is implemented entirely in top-level Mathematica, its code allows inspection by spelunking tools. The relevant function is

NMinimize[1, x]; (* force autoloading *)



and the desired behavior can be achieved by replacing scale in

mutateout[j, vecs, Length[vars], crossprob, scale]

with RandomReal[{0.5, 1}] and reevaluating the definition.

This change will only be in effect for the current kernel session and until the NMinimize definitions are read-in again. For a more persistent monkey-patch, one could load NMinimize and set DownValues[Optimization`NMinimizeDump`CoreDE] in an init.m file.

share|improve this answer
Nice adjustment. I think it would be good if the DE implementation could be updated with some other mutators in the future. The classical rand/1 is not bad, but the best choice is, as always, problem-specific. Empirically, I found that MDE5 is a very good default choice for many problems. Dither also does not seem to improve rand/1/bin as dramatically as it does some other mutators. – Oleksandr R. Sep 27 at 1:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.