Пример #1
0
        static void Main(string[] args)
        {
            DataTable workPatterns = CsvReader.GetWorkPatterns();

            DateTime startDate = DateTime.Parse(workPatterns.Columns[5].ColumnName);
            DateTime endDate   = DateTime.Parse(workPatterns.Columns[workPatterns.Columns.Count - 2].ColumnName);
            double   totalDays = (endDate - startDate).TotalDays;

            Optimiser         optimiser   = new Optimiser();
            List <CrewMember> crewMembers = optimiser.GetCrewMembers(workPatterns);

            //Optimise(crewMembers, startDate, totalDays, optimiser);

            GenerateMasterFile(crewMembers, startDate, totalDays + 1);
        }
Пример #2
0
        private static void Optimise(List <CrewMember> crewMembers, DateTime startDate, double totalDays, Optimiser optimiser)
        {
            BuildRosterFile("MaxWorkDays_Final\\Optimised", crewMembers, startDate, totalDays);

            var         baseNames = crewMembers.Select(n => n.HomeBase).Distinct();
            List <Base> bases     = new List <Base>();

            foreach (var homeBase in baseNames)
            {
                bases.Add(new Base(homeBase, crewMembers));
            }
            BuildStatsFile("MaxWorkDays_Final\\Optimised Stats", bases);

            foreach (Base @base in bases)
            {
                BuildBaseDayFile($"MaxWorkDays_Final\\{@base.BaseName}AvailabilityByDay", @base);
            }

            for (int i = 0; i < bases.Count; i++)
            {
                optimiser.OptimiseByMinAvailability(bases[i]);
                bases[i].UpdateCrewRoster();
                BuildBaseDayFile($"BaseAndRank_Final\\{bases[i].BaseName}AvailabilityByDay", bases[i]);
            }

            BuildRosterFile("BaseAndRank_Final\\OptimisedBy", crewMembers, startDate, totalDays);
            BuildStatsFile("BaseAndRank_Final\\OptimisedByBaseAndRank Stats", bases);

            for (int i = 0; i < bases.Count; i++)
            {
                optimiser.ReduceBdoOnMinimumDays(bases[i]);
                bases[i].UpdateCrewRoster();
                BuildBaseDayFile($"Reduce_BDOs\\{bases[i].BaseName}AvailabilityByDay", bases[i]);
            }

            BuildRosterFile("Reduce_BDOs\\OptimisedBy", crewMembers, startDate, totalDays);
            BuildStatsFile("Reduce_BDOs\\OptimisedByBaseAndRank Stats", bases);
        }