예제 #1
0
        public static List <BasketballPlayer> SetUpNBAPlayers(string filepath)
        {
            var players = FileBuilder.BuildNBAPlayers(filepath);

            players = players.Where(p => p.ProjectedCSV != null && p.PPGAvgCSV != null && p.PPGFloorCSV != null &&
                                    p.PPGMaxCSV != null && p.PointsPerMinuteCSV != null && p.TotalMinutesCSV != null).ToList();
            players.ForEach(p => {
                p.PPGAvg          = Convert.ToDouble(p.PPGAvg);
                p.PPGMax          = Convert.ToDouble(p.PPGMaxCSV);
                p.PPGFloor        = Convert.ToDouble(p.PPGFloorCSV);
                p.PreProjected    = Convert.ToDouble(p.ProjectedCSV);
                p.PointsPerMinute = Convert.ToDouble(p.PointsPerMinuteCSV);
                p.TotalMinutes    = Convert.ToDouble(p.TotalMinutesCSV);
            });
            return(players);
        }
        private void Optimize()
        {
            NFLCombinations  combinations = new NFLCombinations(Players, Config);
            List <NFLLineup> topLineups   = new List <NFLLineup>();
            int writeNumber = 0;
            int loopNum     = 0;

            while (true)
            {
                Console.WriteLine("\nGenerating Lineups...");
                for (int i = 0; i < LineupsToGenerate; i++)
                {
                    topLineups.Add(combinations.GetLineup());
                }

                topLineups = SortLineups(topLineups);

                FileBuilder.WriteTopNFLLineups(topLineups, Config);

                for (int i = 4; i >= 0; i--)
                {
                    Console.WriteLine(FileBuilder.BuildNFLLineupString(topLineups[i], i + 1));
                }

                writeNumber++;
                loopNum++;
                Console.WriteLine($"Duplicated Lineups: {DuplicatedLineups}");
                Console.WriteLine($"Writes till optimization: {Config.WTNR - writeNumber}");
                Console.WriteLine($"Lineups Generated: {loopNum}0 Million");

                if (writeNumber >= Config.WTNR)
                {
                    Console.WriteLine("Optimizing Lineups...");
                    combinations.OptimizeCombinations(topLineups);
                    writeNumber = 0;
                }
            }
        }
예제 #3
0
        public static List <FootballPlayer> SetUpNFLPlayers(string filepath)
        {
            var players = FileBuilder.BuildNFLPlayers(filepath);

            return(players);
        }