public override CompetitorRanks GenerateResult(int tournamentRunSequence, MatchStrategies.MatchStrategy matchStrategy, List<Competitor> competitors) { CompetitorPoints randomPoints = new CompetitorPoints(); foreach (Competitor competitor in competitors) { randomPoints.Add(competitor, _randomPointsGenerator.Next(1, 1000)); } return randomPoints.GetCompetitorRanks(); }
public void GetCompetitorRanksTest() { var points = new CompetitorPoints(); double pointValue = 1.0; var competitors = Helpers.CompetitorListHelper.GetStandardCompetitors(8); foreach (var competitor in competitors) { points.Add(competitor, pointValue++); } var ranks = points.GetCompetitorRanks(); Assert.AreEqual(1, ranks[competitors[7]]); Assert.AreEqual(2, ranks[competitors[6]]); Assert.AreEqual(competitors.Count, ranks[competitors[0]]); }
/// <summary> /// Computes the mean absolute difference between the expected and the observed tournament result. /// </summary> /// <param name="competitors"></param> /// <returns></returns> public double GetTournamentMAD(List<Competitor> competitors) { CompetitorPoints theoreticalRatings = new CompetitorPoints(); foreach (Competitor competitor in competitors) { theoreticalRatings.Add(competitor, competitor.TheoreticalRating); } CompetitorRanks theoreticalRanks = theoreticalRatings.GetCompetitorRanks(); // TODO: convert to using the StatisticsHelper or Iridium double[] competitorDiffs = theoreticalRanks .Select(x => Math.Abs((double)x.Value - (double)x.Key.TournamentRanks[RunSequence.Value])) .ToArray<double>(); return new Helpers.StatisticsHelper(competitorDiffs).Mean; }