//   [TestCaseSource(nameof(TestMultiObjTestBed))]
        public void WeightedSumTest([Values(
                                         ITC_Comp05,
                                         ITC_Comp18)] string filename)
        {
            var algoname = nameof(WeightedSumTest);

            if (ConsoleToFile)
            {
                SetConsoleOutputToFile(@"c:\temp\multiobjective\\logs\\" + filename + "\\" + algoname + ".log");
            }

            var data = Data.ReadXml(dataPath + filename, "120", "4");
            // var newrooms = CreateRooms(data);
            var newrooms = CreateRoomsFixedSize(data, 25, 1);

            data.SetRoomList(newrooms);

            var mipModelParameters = new CCTModel.MIPModelParameters()
            {
                TuneGurobi     = true,
                UseStageIandII = false,
                // UseStageIandII = true,
                UseRoomsAsTypes = true,
            };
            //var problemFormulation = ProblemFormulation.EverythingZero;
            //problemFormulation.BadTimeslotsWeight = 1;
            var solver = new MultiObjectiveSolver(data, _problemFormulation, mipModelParameters)
            {
                Timelimit = 120,//Timelimit,
                ExtraTimeOnCornerPointsMultiplier = 1,
                UseEpsilonMethod = false,
                Steps            = 3
            };

            Console.WriteLine("Algorithm: " + algoname);
            DisplayParameterObject(_problemFormulation);
            DisplayParameterObject(solver);
            DisplayParameterObject(solver.MipParameters);

            var pareto = solver.Run();

            WriteSol(@"c:\temp\multiobjective\", filename, data, _problemFormulation, algoname, DateTime.Now.ToString(), pareto);
        }
Example #2
0
        //   [TestCaseSource(nameof(TestMultiObjTestBed))]
        public void MultiObjSolveWeighted([Values(
                                               ITC_Comp01,
                                               ITC_Comp02,
                                               ITC_Comp03,
                                               ITC_Comp04,
                                               ITC_Comp05,
                                               ITC_Comp06,
                                               ITC_Comp07,
                                               ITC_Comp08,
                                               ITC_Comp09,
                                               ITC_Comp10,
                                               ITC_Comp11,
                                               ITC_Comp12,
                                               ITC_Comp13,
                                               ITC_Comp14,
                                               ITC_Comp15,
                                               ITC_Comp16,
                                               ITC_Comp17,
                                               ITC_Comp18,
                                               ITC_Comp19,
                                               ITC_Comp20,
                                               ITC_Comp21)] string filename,
                                          [Values(false)] bool classSizeWeightedPenalty)
        {
            var algoname = nameof(MultiObjSolveEpsilon) + $"Weighted_classsizepenalty_{classSizeWeightedPenalty}";

            if (ConsoleToFile)
            {
                SetConsoleOutputToFile(@"c:\temp\multiobjective\\logs\\" + filename + "\\" + algoname + ".log");
            }

            var data = Data.ReadXml(dataPath + filename, "120", "4");
            // var newrooms = CreateRooms(data);
            var newrooms = CreateRoomsFixedSize(data, 25, 1);

            data.SetRoomList(newrooms);

            var mipModelParameters = new CCTModel.MIPModelParameters()
            {
                TuneGurobi     = true,
                UseStageIandII = false,
                // UseStageIandII = true,
                UseHallsConditions         = true,
                UseRoomHallConditions      = true,
                ConstraintPenalty          = 50,
                UseRoomsAsTypes            = true,
                ScalePenaltyWithCourseSize = classSizeWeightedPenalty,
            };
            var solver = new MultiObjectiveSolver(data, _problemFormulation, mipModelParameters)
            {
                Timelimit        = Timelimit,
                UseEpsilonMethod = false,
                ExtraTimeOnCornerPointsMultiplier = 2,
                DoubleSweep = false,
            };

            Console.WriteLine("Algorithm: " + algoname);
            DisplayParameterObject(_problemFormulation);
            DisplayParameterObject(solver);
            DisplayParameterObject(solver.MipParameters);

            var pareto = solver.Run();

            WriteSol(@"c:\temp\multiobjective\", filename, data, _problemFormulation, algoname, DateTime.Now.ToString(), pareto);
        }
Example #3
0
        //   [TestCaseSource(nameof(TestMultiObjTestBed))]
        public void MultiObjSolveEpsilon([Values(
                                              ITC_Comp01,
                                              ITC_Comp02,
                                              ITC_Comp03,
                                              ITC_Comp04,
                                              ITC_Comp05,
                                              ITC_Comp06,
                                              ITC_Comp07,
                                              ITC_Comp08,
                                              ITC_Comp09,
                                              ITC_Comp10,
                                              ITC_Comp11,
                                              ITC_Comp12,
                                              ITC_Comp13,
                                              ITC_Comp14,
                                              ITC_Comp15,
                                              ITC_Comp16,
                                              ITC_Comp17,
                                              ITC_Comp18,
                                              ITC_Comp19,
                                              ITC_Comp20,
                                              ITC_Comp21
                                              )] string filename,
                                         [Values(false, true)] bool EpsilonOnQuality,
                                         [Values(false)] bool EpsilonRelaxing,
                                         [Values(false)] bool DoubleSweep)
        {
            var algoname = nameof(MultiObjSolveEpsilon) + $"EpsOnQual_{EpsilonOnQuality}_EpsRelax_{EpsilonRelaxing}_doublesweep_{DoubleSweep}";

            if (ConsoleToFile)
            {
                SetConsoleOutputToFile(@"c:\temp\multiobjective\\logs\\" + filename + "\\" + algoname + ".log");
            }

            var data = Data.ReadXml(dataPath + filename, "120", "4");
            // var newrooms = CreateRooms(data);
            var newrooms = CreateRoomsFixedSize(data, 25, 1);

            data.SetRoomList(newrooms);

            var mipModelParameters = new CCTModel.MIPModelParameters()
            {
                TuneGurobi     = true,
                UseStageIandII = false,
                // UseStageIandII = true,
                UseHallsConditions         = true,
                UseRoomHallConditions      = true,
                ConstraintPenalty          = 50,
                UseRoomsAsTypes            = true,
                ScalePenaltyWithCourseSize = false,
            };
            var solver = new MultiObjectiveSolver(data, _problemFormulation, mipModelParameters)
            {
                Timelimit        = (DoubleSweep ? Timelimit / 2 : Timelimit),
                EpsilonOnQuality = EpsilonOnQuality,
                EpsilonRelaxing  = EpsilonRelaxing,
                ExtraTimeOnCornerPointsMultiplier = 2,
                DoubleSweep = DoubleSweep,
                Steps       = 10, //TODO: only zero steps
            };

            Console.WriteLine("Algorithm: " + algoname);
            DisplayParameterObject(_problemFormulation);
            DisplayParameterObject(solver);
            DisplayParameterObject(solver.MipParameters);

            var pareto = solver.Run();

            WriteSol(@"c:\temp\multiobjective\", filename, data, _problemFormulation, algoname, DateTime.Now.ToString(), pareto);
        }
        public void MultiObjectiveRoomStabilityFixedTime(string filename)
        {
            var algoname = nameof(MultiObjectiveRoomStabilityFixedTime);

            if (ConsoleToFile)
            {
                SetConsoleOutputToFile(@"c:\temp\multiobjective\\logs\\" + filename + "\\" + algoname + ".log");
            }


            var data = Data.ReadXml(dataPath + filename, "120", "4");

            var newrooms = CreateRoomsFixedSize(data, 25, 3);

            data.SetRoomList(newrooms);

            var formulation = ProblemFormulation.MinimizeRoomCost;
            // formulation.OverbookingAllowed = 0.25;

            var startmodel = new CCTModel(data, formulation, new CCTModel.MIPModelParameters()
            {
                UseStageIandII        = false,
                TuneGurobi            = true,
                UseHallsConditions    = true,
                UseRoomHallConditions = true,
            });

            startmodel.Optimize(300);
            var fixedTimeSlotAssignments = startmodel.GetAssignments();

            var stageIsol = new Solution(data, formulation);

            stageIsol.SetAssignments(fixedTimeSlotAssignments);
            Console.WriteLine("Assignments of timeslots:");
            Console.WriteLine(stageIsol.AnalyzeSolution());

            //  var newrooms = CreateRooms(data,5);
            // var newrooms = CreateRoomsFixedSize(data, 20);fr


            var problemFormulation = ProblemFormulation.EverythingZero;

            problemFormulation.RoomStabilityWeight = 1;
            //problemFormulation.OverbookingAllowed = 1;
            var mipModelParameters = new CCTModel.MIPModelParameters()
            {
                TuneGurobi     = true,
                UseStageIandII = true,
                // UseStageIandII = true,
                UseHallsConditions    = false,
                UseRoomHallConditions = false,
                NSols             = 100,
                ConstraintPenalty = 50,
                UseRoomsAsTypes   = false,
            };
            var solver = new MultiObjectiveSolver(data, problemFormulation, mipModelParameters)
            {
                Timelimit                = Timelimit,
                MIPGap                   = 0.0,
                Steps                    = 10,
                LocalBranching           = 0,
                EpsilonOnQuality         = false,
                FixedTimeSlotAssignments = fixedTimeSlotAssignments
            };

            Console.WriteLine("Algorithm: " + algoname);
            DisplayParameterObject(problemFormulation);
            DisplayParameterObject(solver);
            DisplayParameterObject(solver.MipParameters);

            var pareto = solver.Run();

            WriteSol(@"c:\temp\multiobjective\", filename, data, problemFormulation, algoname, DateTime.Now.ToString(), pareto);
        }
        public void MultiObjOneObjetive([Values(
                                             ITC_Comp01,
                                             ITC_Comp02,
                                             ITC_Comp03,
                                             ITC_Comp04,
                                             ITC_Comp05,
                                             ITC_Comp06,
                                             ITC_Comp07,
                                             ITC_Comp08,
                                             ITC_Comp09,
                                             ITC_Comp10,
                                             ITC_Comp11,
                                             ITC_Comp12,
                                             ITC_Comp13,
                                             ITC_Comp14,
                                             ITC_Comp15,
                                             ITC_Comp16,
                                             ITC_Comp17,
                                             ITC_Comp18,
                                             ITC_Comp19,
                                             ITC_Comp20,
                                             ITC_Comp21
                                             )]
                                        string filename,
                                        [Values(ProblemFormulation.Objective.MinimumWorkingDaysWeight,
                                                ProblemFormulation.Objective.CurriculumCompactnessWeight,
                                                ProblemFormulation.Objective.BadTimeslots,
                                                ProblemFormulation.Objective.StudentMinMaxLoadWeight)]
                                        ProblemFormulation.Objective objective)
        {
            //ProblemFormulation.Objective objective = ProblemFormulation.Objective.BadTimeslots;

            var algoname = nameof(MultiObjOneObjetive) + "_" + Enum.GetName(objective.GetType(), objective);

            if (ConsoleToFile)
            {
                SetConsoleOutputToFile(@"c:\temp\multiobjective\\logs\\" + filename + "\\" + algoname + ".log");
            }

            var data = Data.ReadXml(dataPath + filename, "120", "4");
            //var newrooms = CreateRooms(data);
            var newrooms = CreateRoomsFixedSize(data, 25, 1);

            data.SetRoomList(newrooms);

            var problemFormulation = ProblemFormulation.EverythingZero;

            problemFormulation.SetWeight(objective, 1);
            //problemFormulation.AvailabilityHardConstraint = false;

            var mipModelParameters = new CCTModel.MIPModelParameters()
            {
                TuneGurobi     = true,
                UseStageIandII = false,
                // UseStageIandII = true,
                UseHallsConditions    = true,
                UseRoomHallConditions = true,
                //ConstraintPenalty = null, //1,
                ConstraintPenalty = 50,
                UseRoomsAsTypes   = true,
            };

            var solver = new MultiObjectiveSolver(data, problemFormulation, mipModelParameters)
            {
                Timelimit        = Timelimit,
                EpsilonOnQuality = true,
                EpsilonRelaxing  = false,
            };

            Console.WriteLine("Algorithm: " + algoname);
            DisplayParameterObject(problemFormulation);
            DisplayParameterObject(solver);
            DisplayParameterObject(solver.MipParameters);
            var pareto = solver.Run();

            WriteSol(@"c:\temp\multiobjective\", filename, data, problemFormulation, algoname, DateTime.Now.ToString(), pareto);
        }
        //   [TestCaseSource(nameof(TestMultiObjTestBed))]
        public void MultiCornerPointsTest([Values(

                                               /*  ITC_Comp01,
                                                * ITC_Comp05,
                                                * ITC_Comp06,
                                                * ITC_Comp08,
                                                * ITC_Comp12,
                                                *   ITC_Comp11,
                                                * ITC_Comp18
                                                */
                                               ITC_Comp01,
                                               ITC_Comp02,
                                               ITC_Comp03,
                                               ITC_Comp04,
                                               ITC_Comp05,
                                               ITC_Comp06,
                                               ITC_Comp07,
                                               ITC_Comp08,
                                               ITC_Comp09,
                                               ITC_Comp10,
                                               ITC_Comp11,
                                               ITC_Comp12,
                                               ITC_Comp13,
                                               ITC_Comp14,
                                               ITC_Comp15,
                                               ITC_Comp16,
                                               ITC_Comp17,
                                               ITC_Comp18,
                                               ITC_Comp19,
                                               ITC_Comp20,
                                               ITC_Comp21
                                               )] string filename,
                                          [Values(true)] bool EpsilonOnQuality,
                                          [Values(true)] bool SpecificQual)
        {
            var algoname = nameof(MultiCornerPointsTest) + $"EpsOnQual_{EpsilonOnQuality}_SpecQual_{SpecificQual}_4timeinstart";

            if (ConsoleToFile)
            {
                SetConsoleOutputToFile(@"c:\temp\multiobjective\\logs\\" + filename + "\\" + algoname + ".log");
            }

            var data = Data.ReadXml(dataPath + filename, "120", "4");
            // var newrooms = CreateRooms(data);
            var newrooms = CreateRoomsFixedSize(data, 25, 1);

            data.SetRoomList(newrooms);

            var mipModelParameters = new CCTModel.MIPModelParameters()
            {
                TuneGurobi     = true,
                UseStageIandII = false,
                // UseStageIandII = true,
                UseHallsConditions    = true,
                UseRoomHallConditions = true,
                ConstraintPenalty     = 50,
                UseRoomsAsTypes       = true,
            };
            var solver = new MultiObjectiveSolver(data, _problemFormulation, mipModelParameters)
            {
                Timelimit                         = Timelimit,
                Steps                             = 0,
                EpsilonOnQuality                  = EpsilonOnQuality,
                UseSpecificObjConstraints         = false,
                ExtraTimeOnCornerPointsMultiplier = 2,
            };

            Console.WriteLine("Algorithm: " + algoname);
            DisplayParameterObject(_problemFormulation);
            DisplayParameterObject(solver);
            DisplayParameterObject(solver.MipParameters);

            var pareto = solver.Run();

            WriteSol(@"c:\temp\multiobjective\", filename, data, _problemFormulation, algoname, DateTime.Now.ToString(), pareto);
        }