3

This is about developing a distributed consensus.

Let's assume we have N nodes
( N1, N2, ..., Nn ),
each of the nodes has a different value
( A1, A2, ..., An ).
These nodes can communicate with each other, and replace their value if it's bigger then the other node's value.

For example if I'm N1 when I communicate with N2 and I find A2 < A1, then I will replace my value with A2

I need to find the least number of exchanges so that more than half of the nodes ( > n / 2 ) hold the smallest possible value.

An exchange is a single communication between two nodes that results may result in a change in one of the two involved node's value, if and only if the other one has different and smaller value.

user3666197
  • 1
  • 6
  • 50
  • 92
raindust
  • 45
  • 4
  • While the problem may have come from distributed computing, it seems like this problem can easily be expressed as a traditional algorithm question on an array of numbers— there’s no limited knowledge or coordination between multiple agents. Do the ‘agents’ know when their value has changed, or should the algorithm work, without modifications, on any initial permutation of values? – kcsquared Mar 15 '22 at 11:52
  • With all due respect @kcsquared the O/P has not asked to design any actual algorithmic implementation of the above postulated distributed-system behaviour, but rather asked, what is a guaranteed ( minimal ) duration, during which such a defined consensus CANNOT be reached yet - independently of how such practical implementation will work. I.e. all (except a Quantum processing, where [TIME]-domain complexity is always O(1) ) real-systems ( no matter how built ) will have at least below derived time, during which it is guaranteed, no such ( exchange-propagated ) consensus may evolve - Q.E.D. – user3666197 Mar 15 '22 at 12:25
  • @user3666197 You're right that OP didn't ask for an implementation. My point was, the OP's question seems to be in exactly the same spirit as [lower bounds on number of comparisons for finding the minimum](https://en.wikipedia.org/wiki/Selection_algorithm#Lower_bounds). Except that here, they want compare-exchanges instead of comparisons, and they also want the minimum to be set for `> n/2` other positions. There aren't any mentioned constraints on communication or knowledge, so the fact that this is 'distributed computing' instead of a single machine doesn't affect the problem at all. – kcsquared Mar 15 '22 at 13:05
  • Let's agree on the order of priorities - O/P has formulated a problem above. Solving the asked problem is fair. Adding other inspiration is possible too, if these help find solution or find some useful analogy, right? @kcsquared reformulation above is flawed - strictly dominant majority is reach right at n / 2 propagations of the minimum value (not after *">n/2 other positions"* get a least value - an off-by-one error in formulation ). Also be assured that none has so far attacked a conjecture about single-machine being equal to many-machines distributed-computing, so no need to defend, is it? – user3666197 Mar 15 '22 at 13:44
  • Deleted originals here - https://web.archive.org/web/20220315123324/https://stackoverflow.com/questions/71478983/how-to-calculate-a-minimum-exchange-time-among-multiple-nodes – user3666197 Mar 15 '22 at 13:45
  • 1
    Thanks for your comments I just generalized an actual existing question to let it be more discussable (you know distributed system may involve too many codes to explain it), if that makes you confused I'm sorry. The real requirement is, by given number of nodes and given duration to make a consensus deterministic (that means more than half of the nodes agree a value), I what to estimate the minimum heartbeat count If each node received a proposal from his individual client and propagated to other nodes – raindust Mar 16 '22 at 01:38

1 Answers1

0

Given the postulated properties, one of which is values An were postulated to be initially different, the solution is derived from how large the requested strictly dominant majority MAJ actually is, thus setting the minimum (optimistic case supremum) of amount of exchanges .xg!-operations needed, which sets the [TIME]-domain complexity inductively alike this :


 n  == 2
 MAJ ~ 2        _(1)_----->----(2).xg! _1_
 xg! = 1                          


                        (3)
                        / \
                       /   \
                      /     \
                     /       \
                    /         \
 n  == 3           /           \
 MAJ ~ 2        _(1)_----->----(2).xg! _1_
 xg! = 1
 
                   
          .xg!_1_(4)-----------(3)
                  |.         .  |
                  |  .     .    |
                  |    . .      |
                  ^    . .      |
                  |  .     .    |
 n  == 4          |.         ,  |
 MAJ ~ 3        _(1)_----->----(2).xg! _1_
 xg! = 2
 
 ________________________________________________________
 n  ==  5 |  6 |  7 |  8 |  9| 10 | 11 | ... |     n
 MAJ ~  3 |  4 |  4 |  5 |  5|  6 |  6 | ... | 1 + n // 2
 xg! =  2 |  3 |  3 |  4 |  4|  5 |  5 | ... |     n // 2
user3666197
  • 1
  • 6
  • 50
  • 92
  • Just to clarify, what is the 'optimistic-case' performance of an algorithm? It looks like this analysis is equivalent to 'if we knew which node had the minimum value, how many changes of value would it take to change `ceiling((n+1)/2)-1` other values', which is almost tautologically `ceiling((n+1)/2)-1` – kcsquared Mar 15 '22 at 12:49
  • You may have noticed already, that the 'optimistic-case' is my text was not related to a *"performance of an **algorithm**"*, as has been explained above, because there was no real algorithm mentioned at all (except the Quantum case, where all these thoughts will principally loose theirs meaning even prior to any other thoughts or meta-analyses), thus no such performance ( of not specified algo ) could be brought into any meaningful discussion, could it? The original phrase was optimistic-case supremum and was related to a fact, that there could be infinitely more steps, but not less than this – user3666197 Mar 15 '22 at 13:59
  • Which is EXACTLY what has been asked in *"... **least number of exchanges** so that **more than half** of the nodes ( > n / 2 ) hold the smallest possible value"* for, wasn't it? Q.E.D. – user3666197 Mar 15 '22 at 14:05
  • 1
    Great answer! My additional deduction is If more than half of the nodes propagate their values one time, we can be sure (the 'optimistic-case' ignoring the uncertainty about the distributed system) that these nodes can reach a consensus(that means more than half of the nodes agree with the minimum value)? – raindust Mar 16 '22 at 01:58
  • Another question is this is the bidirectional exchange case, right? If we assume one node can only replace his value if some others send to him (the heartbeat information can only affect the target node), is the result exactly "2 * `xg!`"? – raindust Mar 16 '22 at 02:15
  • Similarly, StackOverflow discourages from creeping the original problem formulation & convinces askers to rather reward the best Answer(s) provided to the original post (a.k.a. O/P ) & next invite knowledge sponsors to any next, newly formulated question, that has been inspired or has independently sprung out of box. This is how StackOverflow works. ***That's fair, isn't it?*** – user3666197 Mar 16 '22 at 10:50
  • 1
    I see, it's useful rules for question reading and searching :) – raindust Mar 17 '22 at 00:41