예제 #1
0
        public void RRHeurStageI(string filename)
        {
            for (int i = 0; i < ntests; i++)
            {
                var algname = nameof(RRHeurStageI) + "20extra";
                //  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 + 20, data, formulation, ModelParameters);
                var sol        = heuristics.Run();
                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");
            }
        }
예제 #2
0
        public void TestSolveStageIRoomRelaxedAndFixed(string filename)
        {
            for (int i = 0; i < ntests; i++)
            {
                var algname = nameof(TestSolveStageIRoomRelaxedAndFixed) + "roomrelaxontimeslot";
                //  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.Run();
                Console.WriteLine(sol.AnalyzeSolution());

                //sol = heuristics.SolveStageII();
                //Console.WriteLine(sol.AnalyzeSolution());

                //var model = RoomRelaxAndTight(data, ModelParameters);


                var objective = (int)Math.Round(sol.Objective);
                File.AppendAllText(@"c:\temp\heuristic.txt",
                                   $"{algname};{filename};{DateTime.Now.ToString()};{i};{objective}\n");
            }
        }