The BruteForceMatcher tries all matchings, considering only transitions for scorings, not states. In case of a tangle, the tangle has the same number of red and green transitions as a non-tangle version. Since it ignores matchings with the same score as the current best matching, it depends on the order in which tangle vs non-tangle matchings are encountered, which one will be chosen. We could improve this by detecting if the scores are equal, which matching has less tangles, and considering that one better. Essentially, we first score/compare on number of red/green, and secondly on number of tangles.
The
BruteForceMatcher
tries all matchings, considering only transitions for scorings, not states. In case of a tangle, the tangle has the same number of red and green transitions as a non-tangle version. Since it ignores matchings with the same score as the current best matching, it depends on the order in which tangle vs non-tangle matchings are encountered, which one will be chosen. We could improve this by detecting if the scores are equal, which matching has less tangles, and considering that one better. Essentially, we first score/compare on number of red/green, and secondly on number of tangles.