I've been working on something for P2P and I got stuck with a formula for group leadership chance.
I have a few factors:
batteryPercentage (variable, integer, from 0 to 100)
numRoundsSinceLastLeadership (variable, integer, describes the number of times since I was a leader)
timeSinceLastLeadership (variable, integer, number of milliseconds since I was a leader)
preferredLeadershipCycle (constant, integer, 5 minutes in millisseconds, 3 * 10^5)
randomFactor (variable, integer, a random number from 0 to 100)
And I'm stuck for a few hours on how I can join all these variables to achieve a percentage (0 - 100) of the chance of the device being a leader in the next round.
Can someone help me to find some content to learn or help me to achieve a formula for this?
Thanks a lot!
If there is a leader per group then the devices have to communicate in some way to make sure that there isn't a way for multiple devices to declare themselves leader.
A general way to do this, though again probably not the optimal/acceptable way if there are more conditions/preferences, would be to just make some score add up all the scores from devices that could be leader and make a probability out of that. If $p_i$ is the probability of device $i$ being leader and $s_i$ is the score of the $i^{th}$ device, $\lambda$ is a constant defined to ensure that all scores are greater than 0, $l_{ji}$ is the measure of the $i^{th}$ device, finally let $w_j$ be some weighting factor for the $j^{th}$ metric: $$ s_i = \lambda+\sum_j w_j l_{ji}$$ $$ p_i = \frac{s_i}{\sum_i s_i}$$
For simplicity in this problem I think $\lambda = 1$ and $w_j = 1$ works since you have no negative metrics.
Another approach if you want to form multiple groups: $$ p_i = \frac{s_i}{\max(s)}$$
Where max(s) is the maximum achievable score.