예제 #1
0
        public void LargeCoursesFirstHeuristic(string filename)
        {
            for (int i = 0; i < 1; i++)
            {
                var algname = nameof(UnavailHeurStageI);
                //  formulation.AvailabilityHardConstraint = false;
                var data = Data.ReadXml(dataPath + filename, "120", "4");

                //var formulation = ProblemFormulation.UD2NoOverbook;
                // formulation.AvailabilityHardConstraint = false;
                //   formulation.OverbookingAllowed = 0.35;
                var ModelParameters = new CCTModel.MIPModelParameters()
                {
                    UseStageIandII        = false,
                    TuneGurobi            = true,
                    UseHallsConditions    = true,
                    UseRoomHallConditions = true,
                    // UseRoomsAsTypes = true,
                    UseRoomsAsTypes = false,
                    //  RoomBoundForEachTimeSlot = true,
                    Seed = seeds[i],
                };

                var heuristics = new Heuristics(TimelimitStageI, data, formulation, ModelParameters);
                var sol        = heuristics.RunLargeCoursesFirst();
                Console.WriteLine(sol.AnalyzeSolution());
                var objective = (int)Math.Round(sol.Objective);

                var dataname = System.IO.Path.GetFileNameWithoutExtension(filename);

                File.AppendAllText(@"c:\temp\heuristic.txt",
                                   $"{algname};{dataname};{DateTime.Now};{i};{objective};{heuristics.totalseconds};{heuristics.roomtightseconds}\n");
            }
        }