From http://blog.csdn.net/shuangde800
Question Source: Click to open the link
Question
(From lrj Training Guide)
Mobile Phone Positioning in the cellular network is a basic problem. Assume that the cell network has learned that the mobile phone is in C1, C2 ,..., One of the regions of CN is the easiest way to search for mobile phones in these regions at the same time. However, this is a waste of bandwidth. Because the probability of the mobile phone in different regions can be known in the cellular network, one way to fold is to divide these areas into W groups and then access them in turn. For example, if you know that a mobile phone may be in five regions with a probability of 0.3, 0.05, 0.1, 0.3, and 0.25 respectively, W = 2, you can first access {C1, c2, C3}, and then access {C4, C5} at the same time. The mathematical expectation for the number of accessed regions is 3*(0.3 + 0.05 + 0.1) + (3 + 2) * (0.3 + 0.25) = 4.1. Another method is to access {C1, C4} at the same time and then {C2, C3, C5}. The mathematical expectation of the number of accessed regions is 2 × (0.3 + 0.3) + (3 + 2) × (0.05 + 0.1 + 0.25) = 3.2.
Ideas
It can be found from the formula that, in order to minimize the total expected value, the area with a higher probability should be placed in front of the access.
So first, sort all probabilities from large to small. When grouping, you can divide consecutive segments into one group.
F [I] [J] indicates the minimum expected value of the first I, which is divided into J groups.
F [I] [J] = min {f [k-1] [J] + I * sum [K ~ I], 1 <= k <= I}
Code