コード例 #1
0
        public void RunTest()
        {
            List<Competitor> competitors = Helpers.CompetitorListHelper.GetStandardCompetitors(8);

            Tournament tournament = new Tournament(new KoTS(), new NonRandomMs());
            tournament.Run(competitors);
        }
コード例 #2
0
        public void Run(List<Competitor> competitors, int numberOfIterations, bool isJumbleCompetitorSeeds)
        {
            // TODO: look at reducing memory usage by storing results after the run and destroying the actual tournament runs
            _competitors = competitors;
            _combinedTournamentTransformationMatrix = new Matrix(_competitors.Count, _competitors.Count);

            if (!isJumbleCompetitorSeeds)
            {
                var rank = 1;
                foreach (var competitor in _competitors)
                {
                    if (competitor.InitialRank == null)
                        competitor.InitialRank = rank++;
                }
            }

            // run the tournaments
            for (var i = 0; i < numberOfIterations; i++)
            {
                OnIterated(EventArgs.Empty);

                var tournament = new Tournament(_thisTournamentStrategy, _matchStrategy);

                var tournamentCompetitors = isJumbleCompetitorSeeds ? JumbleCompetitors(i, competitors) : competitors;

                tournament.Run(tournamentCompetitors);

                _tournamentMADs.Add(tournament.TournamentMAD);
                _tournamentMAD_Adjusteds.Add(tournament.TournamentMAD_Standardized);
                _tournamentMAD_Adjusted_WithOddCompetitorAdjustments.Add(tournament.TournamentMAD_Standardized_WithOddCompetitorAdjustment);
                _combinedTournamentTransformationMatrix += tournament.TournamentTransformationMatrix;

                if (!_isLowMemoryMode)
                    _tournaments.Add(tournament);
            }
        }