Commit 4341a47d823808e71a4d66eab4b87cbfcafee4ad

Authored by Josh Klontz
1 parent e226f069

break ties pessimistically

Showing 1 changed file with 6 additions and 1 deletions
openbr/core/eval.cpp
@@ -36,7 +36,12 @@ struct Comparison @@ -36,7 +36,12 @@ struct Comparison
36 Comparison() {} 36 Comparison() {}
37 Comparison(float _score, int _target, int _query, bool _genuine) 37 Comparison(float _score, int _target, int _query, bool _genuine)
38 : score(_score), target(_target), query(_query), genuine(_genuine) {} 38 : score(_score), target(_target), query(_query), genuine(_genuine) {}
39 - inline bool operator<(const Comparison &other) const { return score > other.score; } 39 +
  40 + inline bool operator<(const Comparison &other) const
  41 + {
  42 + if (score != other.score) return (score > other.score);
  43 + else return !genuine; // Tie-break favors pessimistic behavior of ranking impostors higher.
  44 + }
40 }; 45 };
41 46
42 #undef FAR // Windows preprecessor definition conflicts with variable name 47 #undef FAR // Windows preprecessor definition conflicts with variable name