public void TimeslotMulti([Values(0, 1)] int formulationtype, [Values(
                                                                           ITC_Comp01,
                                                                           ITC_Comp06,
                                                                           ITC_Comp08,
                                                                           ITC_Comp11,
                                                                           ITC_Comp18
                                                                           )] string filename)
        {
            ProblemFormulation formulation;
            var secondobj = "";

            if (formulationtype == 0)
            {
                formulation = ProblemFormulation.UD2NoOverbook;
                secondobj   = nameof(ProblemFormulation.UD2NoOverbook);
            }
            else
            {
                formulation = ProblemFormulation.MinimizeRoomCost;
                secondobj   = nameof(ProblemFormulation.MinimizeRoomCost);
            }


            var algoname = nameof(TimeslotMulti) + "_" + secondobj;

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

            CreateExtraTimeslotEachDay(data, 5);

            var solver = new MultiTimeslotSolver(60, data, formulation, new CCTModel.MIPModelParameters()
            {
                UseRoomsAsTypes = true,
                UseStageIandII  = false,
                TuneGurobi      = true,
                //TuneGurobi = false,
                SaveBoundInformation = false,
                //FocusOnlyOnBounds = true,
            });

            solver.formulationtype = formulationtype;
            var solutions = solver.Run();

            Console.WriteLine("timeslots;obj;LB;s");
            Console.WriteLine(String.Join("\n", solutions.Select(t => $"{t.Item1};{t.Item2};{t.Item3};{t.Item4}")));
        }
Esempio n. 2
0
        public void TimeslotMulti([Values(0, 1)] int formulationtype,
                                  [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)
        {
            ProblemFormulation formulation;
            var secondobj = "";

            if (formulationtype == 0)
            {
                formulation = ProblemFormulation.UD2NoOverbook;
                secondobj   = nameof(ProblemFormulation.UD2NoOverbook);
                //this should use std room.
            }
            else
            {
                formulation = ProblemFormulation.MinimizeRoomCost;
                secondobj   = nameof(ProblemFormulation.MinimizeRoomCost);
            }


            var algoname = nameof(TimeslotMulti) + "_" + secondobj + "_stdgurobi";

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


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

            if (formulationtype == 1)
            {
                var newrooms = CreateRoomsFixedSize(data, 25, 1);
                data.SetRoomList(newrooms);
            }

            CreateExtraTimeslotEachDay(data, 5);

            var solver = new MultiTimeslotSolver(Timelimit, data, formulation, new CCTModel.MIPModelParameters()
            {
                UseRoomsAsTypes = formulationtype == 0 ? false : true,
                UseStageIandII  = false,
                // TuneGurobi = true,
                TuneGurobi           = false,
                SaveBoundInformation = false,
                //FocusOnlyOnBounds = true,
            });

            solver.formulationtype = formulationtype;
            var solutions = solver.Run();

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

            Console.WriteLine("timeslots;obj;LB;s");
            Console.WriteLine(String.Join("\n", solutions.Select(t => $"{t.Item1};{t.Item2};{t.Item3};{t.Item4}")));
        }