Each element in the FlexiLayout has an important parameter called MaxHypothesesCount. The user can use this parameter to limit the number of hypotheses which the program may use when looking for the subsequent element. By default, this parameter is set to 5 for simple elements, and to 1 for Group elements. That means that if the program finds 15 hypotheses for a given element, it will select the best five, leaving the other 10 chains of hypotheses incomplete. Group elements, as a rule, are detected more reliably than simple elements. Therefore, the best hypothesis for a Group elements usually turns out to be the correct one.
In most cases the program has several incomplete chains of hypotheses and, consequently, several possible search directions. The program looks for the best hypothesis using the classic “wide search” algorithm. This algorithm means that the program always tries to complete the chain which has the best quality at the moment, irrespective of its length.
Suppose we have a FlexiLayout which describes 30 elements for which two chains of hypotheses have been created: a chain of 29 elements which has an estimated quality of 0.89 and a chain of 2 elements which has an estimated quality of 0.92. The program will attempt to complete the smaller chain, which is better in terms of quality, until such time when the qualities of all its extensions become worse than the first chain.
In the case of a Group element, the program uses so-called quality optimization. When the program finds an ideal complete chain of hypotheses for a given Group element (that is, the quality of this chain is 1), it ignores all the other variants. The total number of hypotheses for each element is limited to 10,000.
The number of hypotheses created for an element may exceed the number set in the MaxHypothesesCount. In this case, only the user-defined number of the best hypotheses will make it into the tree of hypotheses.