Skip to main content

Timeline for Problem with RandomSearch option

Current License: CC BY-SA 4.0

14 events
when toggle format what by license comment
May 19, 2021 at 11:03 comment added Ulrich Neumann I am curious about the answer of MMA
May 18, 2021 at 15:23 vote accept user64494
May 18, 2021 at 15:23 comment added user64494 Your code answers my question so I should to accept it. However, the one doesn't work for bigger values of n. I'd like to suggest to MMA developers that the returned output is better than an incorrect one.
May 7, 2021 at 16:24 comment added user64494 For n=11 three incorrect results and one returned input.
May 7, 2021 at 15:00 comment added user64494 For n=12 the modified code produces incorrect results for Automatic and NelderMead and fails with RandomSearch. The output with DifferentialEvolution" is not satisfactory in view of p[10] -> 2.57056*10^-8, p[11] -> 6.35807*10^-8, p[12] -> 0.000164199(These probabilities should decrease.). Think of n>12.
May 7, 2021 at 14:46 history edited Ulrich Neumann CC BY-SA 4.0
added 543 characters in body
May 7, 2021 at 12:22 comment added user64494 The option WorkingPrecision -> 20 in the above code does not help.
May 7, 2021 at 12:06 comment added user64494 {1.38732, {p[1] -> 0.498584, p[2] -> 0.254054, p[3] -> 0.115688, p[4] -> 0.0619728, p[5] -> 0.0402178, p[6] -> 0.0118743, p[7] -> 0.00743202, p[8] -> 0.00763983, p[9] -> 0.00496901, p[10] -> 0.00123952, p[11] -> 0.000178143, p[12] -> -0.00385019}}. Pay your attention to the sign of p[12]. This is not it.
May 7, 2021 at 12:05 comment added user64494 n = 12; NMaximize[{-Sum[ p[k]*Log[RealAbs[p[k]]], {k, 1, n}], Sum[p[k], {k, 1, n}] == 1 && Sum[k*p[k], {k, 1, n}] == 2 && p[1] > 0 && p[2] > 0, p[3] > 0 && p[4] > 0 && p[5] > 0 && p[6] > 0 && p[7] > 0 && p[8] > 0 && p[9] > 0 && p[10] > 0 && p[11] > 0 && p[12] > 0}, Table[p[k], {k, 1, n}], Method -> "DifferentialEvolution"] performs
May 7, 2021 at 12:00 comment added user64494 The cure is not better than the disease. I am right, aren't I?
May 7, 2021 at 11:53 comment added Ulrich Neumann @user64494 My answer shows you a way how to make NMaximize work for RandomSearch and DifferentialEvolution options . That's what you asked for!
May 7, 2021 at 11:01 comment added user64494 {1.38529, {p[1] -> 0.497953, p[2] -> 0.250251, p[3] -> 0.125766, p[4] -> 0.0632046, p[5] -> 0.031764, p[6] -> 0.0159633, p[7] -> 0.00802249, p[8] -> 0.00403177, p[9] -> 0.0020262, p[10] -> 0.00101829}}, {1.38302, {p[1] -> 0.501038, p[2] -> 0.257196, p[3] -> 0.114503, p[4] -> 0.0613219, p[5] -> 0.0347692, p[6] -> 0.0149038, p[7] -> 0.00576647, p[8] -> 0.00478949, p[9] -> 0.00330252, p[10] -> 0.00241029}}}. and a lot of warnings.Pay your attention to the incorrect results of Automatic andHealderMead and a variance in the results.. This is not it.
May 7, 2021 at 10:58 comment added user64494 The output without Quit produces {{1.37947, {p[1] -> 0.486356, p[2] -> 0.260099, p[3] -> 0.131519, p[4] -> 0.0550347, p[5] -> 0.041031, p[6] -> 0.0128654, p[7] -> 0.0056115, p[8] -> 0.00788751, p[9] -> 0.00193489, p[10] -> -0.00233915}}, {1.37947, {p[1] -> 0.486356, p[2] -> 0.260099, p[3] -> 0.131519, p[4] -> 0.0550347, p[5] -> 0.041031, p[6] -> 0.0128654, p[7] -> 0.0056115, p[8] -> 0.00788751, p[9] -> 0.00193489, p[10] -> -0.00233915}},
May 7, 2021 at 10:40 history answered Ulrich Neumann CC BY-SA 4.0