I am puzzled by the settings of a specific method for NMinimize
called DifferentialEvolution
, given for example here. The settings include both "SearchPoints"
, or the size of the population of evolving points, and "InitialPoints"
, or the initial population(?). What I don't quite understand is that "SearchPoints"
can be set to a value different from the number of specified "InitialPoints"
and NMinimize
will often happily proceed, and sometimes it won't.
What might be happening under the hood? If there are less "InitialPoints"
than there are "SearchPoints"
, will the population be filled up with random points to meet the specified number of "SearchPoints"
before evolution begins or does it proceed with a population that is in fact smaller than "SearchPoints"
? What about the opposite case?
Here is an example where we give much less "InitialPoints"
than there are "SearchPoints"
.
Clear[f, c, v, x1, x2, y1, y2, y3];
f = 2 x1 + 3 x2 + 3 y1/2 + 2 y2 - y3/2;
c = {x1^2 + y1 == 5/4, x2^(3/2) + 3 y2/2 == 3, x1 + y1 <= 8/5,
4 x2/3 + y2 <= 3, y3 <= y1 + y2, 0 <= x1 <= 10, 0 <= x2 <= 10,
0 <= y1 <= 1, 0 <= y2 <= 1,
0 <= y3 <= 1, {y1, y2, y3} \[Element] Integers};
v = {x1, x2, y1, y2, y3};
NMinimize[{f, c}, v, Method -> "DifferentialEvolution"]
(*{7.66718, {x1 -> 1.11803, x2 -> 1.31037, y1 -> 0, y2 -> 1, y3 -> 1}}*)
points = 5;
searchpoints = 50;
listpoints = {RandomReal[{0, 10}, points],
RandomReal[{0, 10}, points], RandomReal[{0, 1}, points],
RandomReal[{0, 1}, points],
RandomReal[{0, 1}, points]}\[Transpose];
NMinimize[{f, c}, v,
Method -> {"DifferentialEvolution", "SearchPoints" -> searchpoints,
"InitialPoints" -> listpoints}]
(*{7.66718, {x1 -> 1.11803, x2 -> 1.31037, y1 -> 0, y2 -> 1, y3 -> 1}}*)
If there are more "InitialPoints"
than there are "SearchPoints"
, NMinimize
sometimes works and sometimes doesn't, depending on the value of the random seed for instance.