Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Jump to content

Intersection algorithm: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
add reflist
Wikify: Marzullo's algorithm
 
(13 intermediate revisions by 13 users not shown)
Line 1: Line 1:
{{short description|Algorithm for selecting the best sources for time estimation}}
The '''intersection algorithm''' is an [[agreement algorithm]] used to select sources for estimating accurate time from a number of [[noise|noisy]] time sources, it forms part of the modern [[Network Time Protocol]]. It is a modified form of [[Marzullo's algorithm]].<ref>{{cite web |url= http://tools.ietf.org/html/rfc1305#ref-DEC89 |title=RFC 1305 - Network Time Protocol (Version 3) Specification, Implementation and Analysis |first= |last= |work=tools.ietf.org |year=2013 [last update] |quote=Digital Time Service Functional Specification Version T.1.0.5. Digital Equipment Corporation, 1989. |accessdate=October 6, 2013}}</ref><ref>Digital Time Service Functional Specification Version T.1.0.5. Digital
The '''intersection algorithm''' is an agreement algorithm used to select sources for estimating accurate time from a number of [[noise|noisy]] time sources. It forms part of the modern [[Network Time Protocol]]. It is a modified form of [[Marzullo's algorithm]].<ref name=":0">{{cite journal |url= http://tools.ietf.org/html/rfc1305#ref-DEC89 |title=RFC 1305 - Network Time Protocol (Version 3) Specification, Implementation and Analysis |website=tools.ietf.org |year=2013 |doi=10.17487/RFC1305 |quote=Digital Time Service Functional Specification Version T.1.0.5. Digital Equipment Corporation, 1989. |accessdate=October 6, 2013|last1=Mills |first1=D. |doi-access=free }}</ref><ref>Digital Time Service Functional Specification Version T.1.0.5. Digital
Equipment Corporation, 1989.</ref>
Equipment Corporation, 1989.</ref>


While Marzullo's algorithm will return the smallest interval consistent with the largest number of sources, the returned interval does not necessarily include the center point (calculated offset) of all the sources in the intersection. The Intersection algorithm returns an interval that includes that returned by Marzullo's algorithm but may be larger since it will include the center points. This larger interval allows using additional statistical data to select a point within the interval, reducing the [[jitter]] in repeated execution.
While Marzullo's algorithm will return the smallest interval consistent with the largest number of sources, the <ref name=":0" />returned interval does not necessarily include the center point (calculated offset) of all the sources in the intersection. The intersection algorithm returns an interval that includes that returned by Marzullo's algorithm but may be larger since it will include the center points. This larger interval allows using additional statistical data to select a point within the interval, reducing the [[jitter]] in repeated execution.


==Method==
==Method==


Given ''M'' intervals of the form ''c''&nbsp;&plusmn;&nbsp;''r'' (which means [''c''&minus;''r'',''c''+''r'']), the algorithm seeks to find an interval with ''M''&minus;''f'' sources. The value ''f'' is referred to as the number of falsetickers, those sources which are in error (the actual value is outside the [[confidence band]]). The best estimate is that which assumes the least number of falsetickers, ''f''. The results will be considered valid if ''f''&nbsp;<&nbsp;''M''/2, otherwise the algorithm will return failure instead of an interval.
Given ''M'' intervals of the form ''c''&nbsp;±&nbsp;''r'' (which means [''c''&minus;''r'',''c''+''r'']), the algorithm seeks to find an interval with ''M''&minus;''f'' sources. The value ''f'' is referred to as the number of falsetickers, those sources which are in error (the actual value is outside the [[confidence band]]). The best estimate is that which assumes the fewest falsetickers, ''f''. The results will be considered valid if ''f''&nbsp;<&nbsp;''M''/2, otherwise the algorithm will return failure instead of an interval.


The intersection algorithm begins by creating a table of tuples <offset,type>. For each interval there are three entries: the lower endpoint, the midpoint and the upper endpoint, labelled with types &minus;1, 0 and +1 respectively. Thus the interval ''c''&nbsp;&plusmn;&nbsp;''r'' results in the entries <''c''&minus;''r'',&minus;1>, <''c'',0> and <''c''+''r'',+1>. These entries are then sorted by offset.
The intersection algorithm begins by creating a table of tuples <offset, type>. For each interval there are three entries: the lower endpoint, the midpoint and the upper endpoint, labelled with types &minus;1, 0 and +1 respectively. Thus the interval ''c''&nbsp;±&nbsp;''r'' results in the entries <''c''&minus;''r'',&minus;1>, <''c'',0> and <''c''+''r'',+1>. These entries are then sorted by offset.


Variables: This algorithm uses ''f'' as number of false tickers, ''endcount'' and ''midcount'' are integers. ''Lower'' and ''upper'' are values of offsets.
Variables: This algorithm uses ''f'' as number of false tickers, ''endcount'' and ''midcount'' are integers. ''Lower'' and ''upper'' are values of offsets.


<ol start="0">
0) [initialize best f] Start with ''f''=0, assuming all input intervals are valid. Each time no interval is found f will be incremented until either an interval is found or ''f''&nbsp;&ge;&nbsp;''M''/2.
<li> [initialize best f] Start with ''f''=0, assuming all input intervals are valid. Each time no interval is found f will be incremented until either an interval is found or ''f''&nbsp;&nbsp;''M''/2.</li>

1) [initialize] ''endcount''=0 and ''midcount''=0.
<li> [initialize] ''endcount''=0 and ''midcount''=0.</li>
<li> [find lower endpoint] Start at beginning of the list (lowest offset) consider each tuple in order. ''endcount''&nbsp;=&nbsp;''endcount''&minus;''type''. If ''endcount''&nbsp;&nbsp;''M''&minus;''f'' then ''lower''&nbsp;=&nbsp;''offset'' and goto step 3 because the (possible) lower endpoint has been found. If the ''type''&nbsp;=&nbsp;0 then ''midcount''&nbsp;=&nbsp;''midcount''+1. Repeat with next tuple. If reach end of list then goto step 6.</li>

<li> [tentative lower endpoint found, initialize to find upper endpoint] set ''endcount''=0. </li>
2) [find lower endpoint] Start at beginning of the list (lowest offset) consider each tuple in order. ''endcount''&nbsp;=&nbsp;''endcount''&minus;''type''. If ''endcount''&nbsp;&ge;&nbsp;''M''&minus;''f'' then ''lower''&nbsp;=&nbsp;''offset'' and goto step 3 because the (possible) lower endpoint has been found. If the ''type''&nbsp;=&nbsp;0 then ''midcount''&nbsp;=&nbsp;''midcount''+1. Repeat with next tuple. If reach end of list then goto step 6.
<li> [determine number of midpoints] Start from end of list and work towards lower offsets. ''endcount''&nbsp;=&nbsp;''endcount''+''type''. If ''endcount''&nbsp;&nbsp;''M''&minus;''f'' then ''upper''&nbsp;=&nbsp;''offset'', goto step 5. If ''type''&nbsp;=&nbsp;0 then ''midcount''&nbsp;=&nbsp;''midcount''+1. Repeat for next tuple. If reach end of list then goto step 6.</li>

<li> if ''lower''&nbsp;&nbsp;''upper'' and ''midcount''&nbsp;&nbsp;''f'' then return interval [''lowerendpoint'', ''upperendpoint''] as resulting confidence interval.</li>
3) [tentative lower endpoint found, initialize to find upper endpoint] set ''endcount''=0.
<li>[increment number of falsetickers] ''f''&nbsp;=&nbsp;''f''+1. If ''f''&nbsp;&nbsp;''M''/2 then terminate and return FAILED, otherwise goto step 1.</li>

</ol>
4) [determine number of midpoints] Start from end of list and work towards lower offsets. ''endcount''&nbsp;=&nbsp;''endcount''+''type''. If ''endcount''&nbsp;&ge;&nbsp;''M''&minus;''f'' then ''upper''&nbsp;=&nbsp;''offset'', goto step 5. If ''type''&nbsp;=&nbsp;0 then ''midcount''&nbsp;=&nbsp;''midcount''+1. Repeat for next tuple. If reach end of list then goto step 6.

5) if ''lower''&nbsp;&le;&nbsp;''upper'' and ''midcount''&nbsp;&le;&nbsp;''f'' then return interval [''lowerendpoint'',''upperendpoint''] as resulting confidence interval.

6) [increment number of falsetickers] ''f''&nbsp;=&nbsp;''f''+1. If ''f''&nbsp;&ge;&nbsp;''M''/2 then terminate and return FAILED, otherwise goto step 1.


==References ==
==References ==

Latest revision as of 09:35, 4 February 2024

The intersection algorithm is an agreement algorithm used to select sources for estimating accurate time from a number of noisy time sources. It forms part of the modern Network Time Protocol. It is a modified form of Marzullo's algorithm.[1][2]

While Marzullo's algorithm will return the smallest interval consistent with the largest number of sources, the [1]returned interval does not necessarily include the center point (calculated offset) of all the sources in the intersection. The intersection algorithm returns an interval that includes that returned by Marzullo's algorithm but may be larger since it will include the center points. This larger interval allows using additional statistical data to select a point within the interval, reducing the jitter in repeated execution.

Method

[edit]

Given M intervals of the form c ± r (which means [cr,c+r]), the algorithm seeks to find an interval with Mf sources. The value f is referred to as the number of falsetickers, those sources which are in error (the actual value is outside the confidence band). The best estimate is that which assumes the fewest falsetickers, f. The results will be considered valid if f < M/2, otherwise the algorithm will return failure instead of an interval.

The intersection algorithm begins by creating a table of tuples <offset, type>. For each interval there are three entries: the lower endpoint, the midpoint and the upper endpoint, labelled with types −1, 0 and +1 respectively. Thus the interval c ± r results in the entries <cr,−1>, <c,0> and <c+r,+1>. These entries are then sorted by offset.

Variables: This algorithm uses f as number of false tickers, endcount and midcount are integers. Lower and upper are values of offsets.

  1. [initialize best f] Start with f=0, assuming all input intervals are valid. Each time no interval is found f will be incremented until either an interval is found or f ≥ M/2.
  2. [initialize] endcount=0 and midcount=0.
  3. [find lower endpoint] Start at beginning of the list (lowest offset) consider each tuple in order. endcount = endcounttype. If endcount ≥ Mf then lower = offset and goto step 3 because the (possible) lower endpoint has been found. If the type = 0 then midcount = midcount+1. Repeat with next tuple. If reach end of list then goto step 6.
  4. [tentative lower endpoint found, initialize to find upper endpoint] set endcount=0.
  5. [determine number of midpoints] Start from end of list and work towards lower offsets. endcount = endcount+type. If endcount ≥ Mf then upper = offset, goto step 5. If type = 0 then midcount = midcount+1. Repeat for next tuple. If reach end of list then goto step 6.
  6. if lower ≤ upper and midcount ≤ f then return interval [lowerendpoint, upperendpoint] as resulting confidence interval.
  7. [increment number of falsetickers] f = f+1. If f ≥ M/2 then terminate and return FAILED, otherwise goto step 1.

References

[edit]
  1. ^ a b Mills, D. (2013). "RFC 1305 - Network Time Protocol (Version 3) Specification, Implementation and Analysis". tools.ietf.org. doi:10.17487/RFC1305. Retrieved October 6, 2013. Digital Time Service Functional Specification Version T.1.0.5. Digital Equipment Corporation, 1989.
  2. ^ Digital Time Service Functional Specification Version T.1.0.5. Digital Equipment Corporation, 1989.