Example #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");
            }
        }
 public MultiTimeslotSolver(int timelimit, Data data, ProblemFormulation formulation, CCTModel.MIPModelParameters mipModelParameters)
 {
     Timelimit               = timelimit;
     this.data               = data;
     this.formulation        = formulation;
     this.MIPmodelParameters = mipModelParameters;
 }
Example #3
0
        public void Relaxunavailability(string filename)
        {
            var algname = nameof(Relaxunavailability);
            var data    = Data.ReadXml(dataPath + filename, "120", "4");

            for (int i = 0; i < 1; i++)
            {
                //var formulation = ProblemFormulation.UD2NoOverbook;
                //Formulation.AvailabilityHardConstraint = false;
                //Formulation.OverbookingAllowed = 0.35;
                var ModelParameters = new CCTModel.MIPModelParameters()
                {
                    UseStageIandII        = false,
                    TuneGurobi            = true,
                    UseHallsConditions    = true,
                    UseRoomHallConditions = true,
                    Seed = seeds[i],
                };
                formulation.AvailabilityHardConstraint = false;
                var model = new CCTModel(data, formulation, ModelParameters);

                var stopwatch = Stopwatch.StartNew();

                model.Optimize(30);
                stopwatch.Stop();
                var objective = (int)Math.Round(model.Objective);
                var dataname  = System.IO.Path.GetFileNameWithoutExtension(filename);

                File.AppendAllText(@"c:\temp\heuristic.txt",
                                   $"{algname};{dataname};{DateTime.Now};{i};{objective};{(int) stopwatch.Elapsed.TotalSeconds};\n");
            }
        }
Example #4
0
        public void TestCurriculaConstraint()
        {
            var data = Data.ReadXml(dataPath + ITC_Comp05, "120", "4");
            // var formulation = ProblemFormulation.UD2;
            //Formulation.AvailabilityHardConstraint = false;
            //Formulation.OverbookingAllowed = 0.35;
            var ModelParameters = new CCTModel.MIPModelParameters()
            {
                UseStageIandII           = false,
                ConstraintPenalty        = 50,
                AbortSolverOnZeroPenalty = true,
            };
            var model = new CCTModel(data, formulation, ModelParameters);
            var watch = Stopwatch.StartNew();

            model.Optimize(30, 0.99);
            var obj = model.ObjSoftCons;

            while (watch.Elapsed.TotalSeconds < TimelimitStageI * 2)
            {
                model.SetQualConstraint(obj - 5);
                model.Optimize(120);
                obj = model.ObjSoftCons;
                Console.WriteLine($"Objective: {obj}");
            }
        }
Example #5
0
        public void TestSolveStageI(string filename)
        {
            var algname = nameof(TestSolveStageI);
            var data    = Data.ReadXml(dataPath + filename, "120", "4");

            for (int i = 0; i < ntests; i++)
            {
                //var formulation = ProblemFormulation.UD2NoOverbook;
                //Formulation.AvailabilityHardConstraint = false;
                //Formulation.OverbookingAllowed = 0.35;
                var ModelParameters = new CCTModel.MIPModelParameters()
                {
                    UseStageIandII        = false,
                    TuneGurobi            = true,
                    UseHallsConditions    = true,
                    UseRoomHallConditions = true,
                    Seed = seeds[i],
                };
                var model = new CCTModel(data, formulation, ModelParameters);

                model.Optimize(TimelimitStageI);
                var objective = (int)Math.Round(model.Objective);

                File.AppendAllText(@"c:\temp\heuristic.txt",
                                   $"{algname};{filename};{DateTime.Now.ToString()};{i};{objective}\n");
            }
        }
Example #6
0
 public Heuristics(int timelimit, Data data, ProblemFormulation formulation, CCTModel.MIPModelParameters mipModelParameters)
 {
     TimelimitStageI         = timelimit;
     this.data               = data;
     this.formulation        = formulation;
     this.MIPmodelParameters = mipModelParameters;
 }
Example #7
0
        public void TestStageI(string filename)
        {
            var data        = Data.ReadXml(dataPath + filename, "120", "4");
            var formulation = ProblemFormulation.UD2NoOverbook;
            var mippar      = new CCTModel.MIPModelParameters()
            {
                UseStageIandII        = false,
                UseHallsConditions    = true,
                UseRoomHallConditions = true,
                TuneGurobi            = true,
                SaveBoundInformation  = true,
            };
            var model = new CCTModel(data, formulation, mippar);

            //model.WriteModel(@"c:\temp\model.lp");
            Console.WriteLine("Solving");
            model.Optimize(20);
            model.DisplayObjectives();
            var sol = new Solution(data, formulation);

            sol.SetAssignments(model.GetAssignments());
            // model.DisplaySoftConstraintViolations();
            //var sol = new Solution(data,Formulation);
            //sol.SetAssignments(model.GetAssignments());
            //Console.WriteLine(sol.AnalyzeSolution());
            //sol.Save(@"c:\temp\solution.ctt");
            //            File.AppendAllText(@"c:\temp\results.txt", $"30s;{filename};{model.Objective}\n");

            Console.WriteLine("MWD;CC;obj;bnd");
            Console.WriteLine(String.Join("\n", model.bounds.Select(t => $"{t.Item1};{t.Item2};{t.Item3};{t.Item4}")));

            Console.WriteLine(sol.AnalyzeSolution());
        }
Example #8
0
 public MultiObjectiveSolver(Data data, ProblemFormulation formulation, CCTModel.MIPModelParameters mipparameters)
 {
     Formulation         = formulation;
     _data               = data;
     MipParameters       = mipparameters;
     mipparameters.NSols = 100;
     _model              = new CCTModel(_data, Formulation, MipParameters);
 }
        public void Lexi_Cost_Soft([Values(
                                        ITC_Comp01,
                                        ITC_Comp05,
                                        ITC_Comp06,
                                        ITC_Comp08,
                                        ITC_Comp12,
                                        ITC_Comp11,
                                        ITC_Comp18,
                                        //more
                                        ITC_Comp02,
                                        ITC_Comp03,
                                        ITC_Comp04,
                                        ITC_Comp07

                                        )] string filename, [Values(false)] bool SpecificQual)
        {
            var algoname = nameof(Lexi_Cost_Soft) + $"_SpecQual_{SpecificQual}";
            //   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     = null,
                UseRoomsAsTypes       = true,
            };
            var solver = new MultiObjectiveSolver(data, _problemFormulation, mipModelParameters)
            {
                Timelimit = Timelimit,
                ExtraTimeOnCornerPointsMultiplier = 8,
                UseSpecificObjConstraints         = SpecificQual,
            };

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

            double minCost;
            int    maxSoftConsViol;
            int    minCostBound;

            solver.CalcLexMinCostMaxSoft(out minCost, out maxSoftConsViol, out minCostBound);
            Console.WriteLine($"MaxSoft: {maxSoftConsViol} MinCost: {minCost}");
        }
Example #10
0
        public QualityRecoveringOptimizer(Data data, Solution solutionBefore, ProblemFormulation formulation, CCTModel.MIPModelParameters mipModelParameters)
        {
            this.data               = data;
            this.formulation        = formulation;
            this.MIPmodelParameters = mipModelParameters;
            this.solutionBefore     = solutionBefore;

            model = new CCTModel(data, formulation, MIPmodelParameters);
            model.SetProximityOrigin(solutionBefore._assignments.ToList());
            model.SetMipHints(solutionBefore._assignments.ToList());
        }
Example #11
0
        public void PenaltiesScaledByCourseSizes(string filename)
        {
            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,
                ScalePenaltyWithCourseSize = true,
            };
            var model = new CCTModel(data, formulation, ModelParameters);

            model.Optimize(TimelimitStageI * 2);
            File.AppendAllText(@"c:\temp\heuristic.txt", $"{nameof(PenaltiesScaledByCourseSizes)};{filename};{model.Objective}\n");
        }
        //   [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 #13
0
        //   [TestCaseSource(nameof(TestMultiObjTestBed))]
        public void MultiObj3index([Values(
                                        ITC_Comp02)] string filename)
        {
            var algoname = nameof(MultiObj3index) + "3idx";

            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 = false, //notice
                //UseStageIandII = false,
                UseStageIandII        = true,
                UseHallsConditions    = true,
                UseRoomHallConditions = true,
                ConstraintPenalty     = null,
                UseRoomsAsTypes       = true,
            };
            var solver = new MultiObjectiveSolver(data, ProblemFormulation.UD2, mipModelParameters)
            {
                Timelimit        = 60,
                EpsilonOnQuality = false,
                ExtraTimeOnCornerPointsMultiplier = 1,
            };

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

            var pareto = solver.RunExhaustiveMethod();

            WriteSol(@"c:\temp\multiobjective\", filename, data, _problemFormulation, algoname, DateTime.Now.ToString(), pareto);
        }
Example #14
0
        public void TestSolveStageIandII(string filename)
        {
            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,
            };
            var model = new CCTModel(data, formulation, ModelParameters);

            model.Optimize(TimelimitStageI);

            //todo make test. use fixing as in multi

            File.AppendAllText(@"c:\temp\heuristic.txt", $"{nameof(TestSolveStageI)};{filename};{model.Objective}\n");
        }
Example #15
0
        public void MaximizeRoomUtilization(string filename)
        {
            var data = Data.ReadXml(dataPath + filename, "120", "4");

            Console.WriteLine($"Dataset: {data.Name}");
            Console.WriteLine($"Courses: {data.Courses.Count} Lectures: {data.Courses.Sum(c => c.Lectures)}");



            //DisplayRoomStats("original",data.Rooms.ToDictionary(r => r, r => 1), data);

            //  var newrooms = CreateRooms(data);
            var newrooms = CreateRoomsFixedSize(data, 25, 1);

            data.SetRoomList(newrooms);


            Console.WriteLine("\nLectures:\n");
            Console.WriteLine("size,hours");

            foreach (var coursesizes in data.Courses.GroupBy(c => c.NumberOfStudents).OrderBy(c => c.Key))
            {
                Console.WriteLine($"{coursesizes.Key},{coursesizes.Sum(s => s.Lectures)}");
            }

            var formulation = ProblemFormulation.MinimizeRoomCost;
            var par         = new CCTModel.MIPModelParameters()
            {
                UseStageIandII        = false,
                UseHallsConditions    = true,
                UseRoomHallConditions = true,
                TuneGurobi            = false,
                UseRoomsAsTypes       = true,
            };
            var model = new CCTModel(data, formulation, par);

            model.Optimize();
            DisplayRoomStats("optimized", model.GetUsedRooms(), data);
        }
Example #16
0
        public void TestLocalBranchingConstraint(bool usecurr, int N)
        {
            var data = Data.ReadXml(dataPath + ITC_Comp05, "120", "4");
            //var formulation = ProblemFormulation.UD2;
            //Formulation.AvailabilityHardConstraint = false;
            //Formulation.OverbookingAllowed = 0.35;
            var modelParameters = new CCTModel.MIPModelParameters()
            {
                UseStageIandII = false
            };
            var model = new CCTModel(data, formulation, modelParameters);

            model.Optimize(30 * 3, 0.99);
            model.SetProxConstraint(N);
            var watch = Stopwatch.StartNew();

            while (watch.Elapsed.TotalSeconds < TimelimitStageI)
            {
                model.SetProximityOrigin(usecurr);
                model.Optimize(15);
            }
        }
Example #17
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");
            }
        }
        //   [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);
        }
Example #19
0
        //[TestCaseSource(nameof(TestDatasetsITC2007))]
        public void QualityRecovering([Values(
                                           QualityRecoveringOptimizer.DisruptionTypes.CurriculumFourCoursesInsert,
                                           QualityRecoveringOptimizer.DisruptionTypes.RandomRoomRandomdayRemoved,
                                           QualityRecoveringOptimizer.DisruptionTypes.OneTimeslotUnavailable,
                                           QualityRecoveringOptimizer.DisruptionTypes.OneAssignmentUnavailbility
                                           )] QualityRecoveringOptimizer.DisruptionTypes disruption, [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(1)] int seed)
        {
            var disruptionname = disruption;

            // if (ConsoleToFile)
            //     SetConsoleOutputToFile(@"c:\temp\minimumpertubation\\logs\\" + filename + "\\" + disruptionname + ".log");
            seed = GetRealSeed(filename, seed);
            var data = Data.ReadXml(dataPath + filename, "120", "4");

            var name            = Path.GetFileNameWithoutExtension(filename);
            var modelParameters = new CCTModel.MIPModelParameters()
            {
                UseStageIandII = true,
            };

            var solutionBefore = new Solution(data, formulation);

            solutionBefore.Read(dataPath + @"ITC2007\sol\" + name + "-UD2" + ".sol");
            Console.WriteLine(solutionBefore.AnalyzeSolution());

            var minimumPertubation = new QualityRecoveringOptimizer(data, solutionBefore, formulation, modelParameters)
            {
                Timelimit               = 60 * 60 * 10,
                ExtraPerubations        = 100,
                MaxTotalPertubations    = 20,
                SolPerPertubation       = 1,
                PerturbationObjectEqual = true,
            };
            string entitiesdisrupted;
            var    affected = minimumPertubation.Disrupt(disruption, seed, out entitiesdisrupted);


            RunPertubationTest(seed, minimumPertubation, solutionBefore, disruptionname.ToString(), name, affected, entitiesdisrupted);
        }
        public void Lex_soft_cost_withTimeslot(string filename)
        {
            var algname = nameof(Lex_soft_cost_withTimeslot);
            //  formulation.AvailabilityHardConstraint = false;
            var data     = Data.ReadXml(dataPath + filename, "120", "4");
            var newrooms = CreateRoomsFixedSize(data, 25, 5);

            data.SetRoomList(newrooms);

            var par = new CCTModel.MIPModelParameters()
            {
                UseStageIandII        = false,
                UseHallsConditions    = true,
                UseRoomHallConditions = true,
                TuneGurobi            = false,
                UseRoomsAsTypes       = false,
            };
            var costmodel = new CCTModel(data, ProblemFormulation.MinimizeRoomCost, par);

            costmodel.Optimize();


            data.SetRoomList(costmodel.GetUsedRooms().Where(kv => kv.Value > 0).Select(kv => kv.Key).ToList());


            //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,
            };
            var model = new CCTModel(data, _problemFormulation, ModelParameters);

            model.Optimize(300);
            var userooms = model.GetUsedRooms();

            Console.WriteLine($"Used rooms: {userooms.Sum(kv => kv.Value)} over {userooms.Count} ");

            // model.PenalizeRoomUsedMoreThanOnce(100);
            model.PenalizeRoomUsedMoreThanOnce(1, true);
            model.SetObjective(0, 0, 0.001);
            model.SetProximityOrigin();
            model.SetQualConstraint(model.ObjSoftCons);
            // model.SetProxConstraint(20);
            model.Fixsol(true);
            model.Optimize();
            model.Fixsol(false);


            model.Optimize(900);
            model.DisplayObjectives();
            var sol = new Solution(data, ProblemFormulation.MinimizeRoomCost);

            sol.SetAssignments(model.GetAssignments());
            Console.WriteLine(sol.AnalyzeSolution());

            File.AppendAllText(@"c:\temp\heuristic.txt", $"{algname};{filename};{model.ObjSoftCons}\n");
        }
        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);
        }
        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);
        }
Example #23
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 #24
0
        public void TopSolutionsAnalysis(string filename)
        {
            var name = Path.GetFileNameWithoutExtension(filename);

            var data             = Data.ReadXml(dataPath + filename, "120", "4");
            var formulation      = ProblemFormulation.UD2NoOverbook;
            var courestime       = new Dictionary <Course, Dictionary <TimeSlot, int> >();
            var penaltyforcourse = new Dictionary <Course, int>();

            foreach (var course in data.Courses)
            {
                courestime.Add(course, new Dictionary <TimeSlot, int>());
                foreach (var timeSlot in data.TimeSlots)
                {
                    courestime[course].Add(timeSlot, 0);
                }
                penaltyforcourse[course] = 0;
            }


            var bestsol = new List <Assignment>();
            var penMWD  = new List <int>();
            var penCC   = new List <int>();

            for (var i = 0; i < 10; i++)
            {
                var sol = new Solution(data, formulation);
                sol.Read(dataPath + @"ITC2007\sol\" + name + "-UD2-" + i + ".sol");
                sol.AnalyzeSolution();
                foreach (var assignment in sol._assignments)
                {
                    courestime[assignment.Course][assignment.TimeSlot]++;
                }

                foreach (var course in data.Courses)
                {
                    penaltyforcourse[course] += sol.PenaltyForCourse[course];
                }
                penMWD.Add((int)sol.MinimumWorkingDays);
                penCC.Add((int)sol.CurriculumCompactness);

                if (i == 0)
                {
                    bestsol = sol._assignments.ToList();
                }
            }

            const int minhint = 7;
            var       maxhint = 7;
            var       noise   = 0.5;

            const bool fixhints = true;

            var random = new Random(62);

            foreach (var course in data.Courses)
            {
                foreach (var ts in data.TimeSlots)
                {
                    //     if (random.Next(10) < courestime[course][ts]) courestime[course][ts] = 1;
                    //    else courestime[course][ts] = 0;

                    if (courestime[course][ts] < minhint)
                    {
                        courestime[course][ts] = 0;
                    }
                    if (courestime[course][ts] > maxhint)
                    {
                        courestime[course][ts] = 0;
                    }
                    //result should be made to double.
                    // if(courestime[course][ts] > 0) courestime[course][ts] +=  random.Next(-3,3);
                    //courestime[course][ts] *= 1 + (int) Math.Round(noise*(2*random.NextDouble()-1));
                }
            }

            var hints    = courestime.SelectMany(c => c.Value.Where(cv => cv.Value > 0).Select(cv => Tuple.Create(c.Key, cv.Key, cv.Value))).ToList();
            var currtime = new Dictionary <Curriculum, Dictionary <TimeSlot, int> >();

            foreach (var curr in data.Curricula)
            {
                currtime.Add(curr, new Dictionary <TimeSlot, int>());
                foreach (var timeSlot in data.TimeSlots)
                {
                    currtime[curr].Add(timeSlot, courestime.Where(c => curr.Courses.Contains(c.Key)).Sum(kv => kv.Value[timeSlot]));
                }
            }
            var chints = currtime.SelectMany(c => c.Value.Select(cv => Tuple.Create(c.Key, cv.Key, cv.Value))).ToList();


            Console.WriteLine($"Timeslots: {data.TimeSlots.Count}");
            Console.WriteLine($"MWD: avg: {penMWD.Average()} - {string.Join(", ", penMWD)} ");
            Console.WriteLine($"CC: avg: {penCC.Average()} - {string.Join(", ", penCC)} ");
            foreach (var course in data.Courses.OrderByDescending(c => penaltyforcourse[c]))
            {
                Console.WriteLine($"\nCourse: {course}\n" +
                                  $"Size: {course.NumberOfStudents}\n" +
                                  $"Lectures: {course.Lectures}\n" +
                                  $"MWD: {course.MinimumWorkingDays}\n" +
                                  $"TSAvaialble:{data.TimeSlots.Count - course.UnavailableTimeSlots.Count}\n" +
                                  $"Unavail: {string.Join(",", course.UnavailableTimeSlots)}\n" +
                                  $"TotalPenalty: {penaltyforcourse[course]}");
                foreach (var valuePair in courestime[course].Where(kv => kv.Value > 0).OrderByDescending(kv => kv.Value))
                {
                    Console.WriteLine(valuePair.Key + ": " + valuePair.Value);
                }
            }

            Console.WriteLine("\n\nBy prio: ");
            foreach (var hint in hints.Where(h => h.Item3 > 0).OrderByDescending(h => h.Item3))
            {
                Console.WriteLine(hint.Item1.ID + "_" + hint.Item2 + ": " + hint.Item3);
            }

            Console.WriteLine("\n\nHistogram: ");
            Console.WriteLine("total lectures: " + data.Courses.Sum(c => c.Lectures));
            for (var i = 1; i <= 10; i++)
            {
                Console.WriteLine($"{i}\t{hints.Count(h => h.Item3 == i)}");
            }

            Console.WriteLine("Unavailabilites\tSame");
            foreach (var course in data.Courses)
            {
                Console.WriteLine($"{course.UnavailableTimeSlots.Count}\t{(double) courestime[course].Sum(t => t.Value)/course.Lectures : 0.00}");
            }
            Console.WriteLine("Penal\tSame");
            foreach (var course in data.Courses)
            {
                Console.WriteLine($"{penaltyforcourse[course]}\t{(double) courestime[course].Sum(t => t.Value)/course.Lectures : 0.00}");
            }
            Console.WriteLine("Size\tSame");
            foreach (var course in data.Courses)
            {
                Console.WriteLine($"{course.NumberOfStudents}\t{(double) courestime[course].Sum(t => t.Value)/course.Lectures : 0.00}");
            }
            // return;
            //Console.WriteLine("\n\nCurriculumPatterns");

            //foreach (var hint in chints.Where(h => h.Item3 > 0).OrderByDescending(h => h.Item3))
            //{
            //    Console.WriteLine(hint.Item1.ID + "_" + hint.Item2 + ": " + hint.Item3);
            //}
            //Console.WriteLine("\n\nHistogram: ");
            //Console.WriteLine("total curr_lectures: " + data.Curricula.Sum(c => c.Lectures));
            //for (var i = 1; i <= 10; i++)
            //{
            //    Console.WriteLine($"{i}\t{chints.Count(h => h.Item3 == i)}");

            //}


            var ModelParameters = new CCTModel.MIPModelParameters()
            {
                UseStageIandII        = false,
                TuneGurobi            = true,
                UseHallsConditions    = true,
                UseRoomHallConditions = true,
                //  Seed = seeds[i],
            };

            var model = new CCTModel(data, formulation, ModelParameters);

            // model.SetMipHints(chints);
            Console.WriteLine($"Adding {hints.Count} hints. Total letures: {data.Courses.Sum(c => c.Lectures)} ({(double) hints.Count / data.Courses.Sum(c => c.Lectures) :0.00%})");
            model.SetMipHints(hints, fixhints);
            // model.MipStart(bestsol);
            var r = model.Optimize(300);
            // model.Optimize(60*60*3);

            var ass      = model.GetAssignments();
            var finalsol = new Solution(data, formulation);

            finalsol.SetAssignments(ass);
            finalsol.Save(@"C:\temp\finalsolStageI_" + name + ".sol");
            var ModelParameters2 = new CCTModel.MIPModelParameters()
            {
                UseStageIandII        = true,
                TuneGurobi            = true,
                UseHallsConditions    = true,
                UseRoomHallConditions = true,
                //  Seed = seeds[i],
            };

            var model2 = new CCTModel(data, formulation, ModelParameters2);

            model2.SetAndFixSolution(ass);
            model2.Optimize(300);
            ass = model2.GetAssignments();
            finalsol.SetAssignments(ass);
            finalsol.Save(@"C:\temp\finalsolStageII_" + name + ".sol");
        }
Example #25
0
        //   [TestCase(ITC_Comp05,1)]

        /*
         * [TestCase(ITC_Comp05, 2)]
         * [TestCase(ITC_Comp05, 3)]
         * [TestCase(ITC_Comp05, 4)]
         * [TestCase(ITC_Comp05, 5)]
         * [TestCase(ITC_Comp05, 6)]
         * [TestCase(ITC_Comp05, 7)]
         * [TestCase(ITC_Comp05, 8)]
         * [TestCase(ITC_Comp05, 11)]
         * [TestCase(ITC_Comp05, 12)]
         * [TestCase(ITC_Comp05, 13)]
         * [TestCase(ITC_Comp05, 14)]
         * [TestCase(ITC_Comp05, 15)]
         * [TestCase(ITC_Comp05, 16)]
         * [TestCase(ITC_Comp05, 17)]
         */
        public void CCfirstHeuristic30s(string filename, int seed) //
        {
            //  var seed = 0;
            for (int ia = 1; ia < 5; ia++)
            {
                seed = ia;

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

                var problemFormulation = ProblemFormulation.UD2NoOverbook;
                problemFormulation.MinimumWorkingDaysWeight = 0;
                //    problemFormulation.CurriculumCompactnessWeight = 0;
                var par = new CCTModel.MIPModelParameters()
                {
                    TuneGurobi            = true,
                    UseStageIandII        = false,
                    UseHallsConditions    = true,
                    UseRoomHallConditions = true,
                    UseRoomsAsTypes       = false,
                    Seed = seed,
                };
                var model = new CCTModel(data, problemFormulation, par);
                model.SetObjective(1, 0, 0);
                model.Optimize(TimelimitStageI);
                model.DisplayObjectives();
                var result = new Dictionary <double, double>();
                //maybe find better proximity that reflects currciulumcompactness better.
                //Check which curriculum that can be moved without introducting penalties.
                model.SetProximityOrigin(true);
                problemFormulation.MinimumWorkingDaysWeight = 5;
                for (var i = 15; i <= 15; i++)
                {
//                model.SetObjective(0, 0, i);
                    model.SetProxConstraint(i);
                    model.AddMinimumWorkingDaysCost();
                    // model.FixCurricula(true);
                    model.Optimize();
                    model.DisplayObjectives();
                    model.SetObjective(1, 0, 0);
                    model.Fixsol(true);
                    model.Optimize();
                    model.Fixsol(false);
                    model.DisplayObjectives();
                    result[i] = model.Objective;
                }

                Console.WriteLine("Results:");
                Console.WriteLine("i;obj");
                foreach (var r in result)
                {
                    Console.WriteLine($"{r.Key};{r.Value}");
                }

                var best = result.Min(r => r.Value);

                File.AppendAllText(@"c:\temp\heuristic.txt", $"{nameof(CCfirstHeuristic30s)};{filename};{best}\n");
                //  model.FixCurricula(false);

                // maybe also save multiple minimum curriculum solutions
            }
        }
Example #26
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);
        }
Example #27
0
        //[TestCaseSource(nameof(TestDatasetsITC2007))]
        public void MinimumPertubationsAssignments([Values(
                                                        ITC_Comp01, ITC_Comp05, ITC_Comp10, ITC_Comp12, ITC_Comp14, 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(1)] int seed)
        {
            var data = Data.ReadXml(dataPath + filename, "120", "4");

            var name            = Path.GetFileNameWithoutExtension(filename);
            var modelParameters = new CCTModel.MIPModelParameters()
            {
                UseStageIandII = true,
            };

            var solutionBefore = new Solution(data, formulation);

            solutionBefore.Read(dataPath + @"ITC2007\sol\" + name + "-UD2" + ".sol");
            solutionBefore.AnalyzeSolution();

            for (var n = 0; n < 100; n++)
            {
                if (n > solutionBefore._assignments.Count)
                {
                    break;
                }

                var disruptionname = nameof(MinimumPertubationsAssignments) + n;


                var minimumPertubation = new QualityRecoveringOptimizer(data, solutionBefore, formulation, modelParameters)
                {
                    Timelimit         = 60 * 60,
                    ExtraPerubations  = 0,
                    SolPerPertubation = 1
                };


                var affected = minimumPertubation.DisruptAssignmentUnavailable(seed, n);

                RunPertubationTest(seed, minimumPertubation, solutionBefore, disruptionname, name, affected, "");
            }
        }