예제 #1
0
        public void Test_PermutateV4_Runv3_PermutateOnSixSubject()
        {
            int expectedCount = 616872;
            var input         = new List <Slot>();

            input.AddRange(TestData.GetSlotsByName(TestData.Subjects.Hydrology));
            input.AddRange(TestData.GetSlotsByName(TestData.Subjects.StructuralAnalysisII));
            input.AddRange(TestData.GetSlotsByName(TestData.Subjects.HighwayAndTransportation));
            input.AddRange(TestData.GetSlotsByName(TestData.Subjects.FluidMechanicsII));
            input.AddRange(TestData.GetSlotsByName(TestData.Subjects.IntroductionToBuildingServices));
            var timer_ofRunV3  = Stopwatch.StartNew();
            var result_ofRunV3 = Permutator.Run_v3(input.ToArray());

            timer_ofRunV3.Stop();
            Console.WriteLine("RunV3 result : ");
            Console.WriteLine("Combination count : " + result_ofRunV3.Count);
            Console.WriteLine("Elapsed time : " + timer_ofRunV3.Elapsed.TotalMilliseconds + " ms");

            var timer_ofRunV2  = Stopwatch.StartNew();
            var result_ofRunV2 = Permutator.Run_v2_WithConsideringWeekNumber(input.ToArray());

            timer_ofRunV2.Stop();
            Console.WriteLine("RunV2 result : ");
            Console.WriteLine("Combination count : " + result_ofRunV2.Count);
            Console.WriteLine("Elapsed time : " + timer_ofRunV2.Elapsed.TotalMilliseconds + " ms");


            Assert.Pass();
        }
예제 #2
0
        public void GenerateTimetables(SlotList slotList)
        {
            var result = Permutator.Run_v2_WithConsideringWeekNumber(slotList.ToArray());

            _timetableList = new TimetableList(result);
            NotifyObserver();
        }
예제 #3
0
        public void Test_ClashFinder_GetTimetableState_1()
        {
            var chosenSubject = TestData.Subjects.HubunganEtnik;
            var input         =
                Permutator.Run_v2_WithConsideringWeekNumber(TestData.GetSlotsByName(chosenSubject)
                                                            .ToArray());
            var result = ClashFinder.GetSubjectState(input);

            foreach (int dayState in result)
            {
                Assert.IsTrue(dayState == 0);
            }
        }
예제 #4
0
        public void SandboxTest_3()
        {
            var input  = TestData.GetSlotsByName(TestData.Subjects.Hydrology);
            var input2 = TestData.GetSlotsByName(TestData.Subjects.FluidMechanicsII);
            var input3 = TestData.GetSlotsByName(TestData.Subjects.StructuralAnalysisII);
            var input4 = TestData.GetSlotsByName(TestData.Subjects.HighwayAndTransportation);
            var input5 = TestData.GetSlotsByName(TestData.Subjects.IntroductionToBuildingServices);

            int result1 = Permutator.Run_v2_WithConsideringWeekNumber(input.ToArray()).Count;
            int result2 = Permutator.Run_v2_WithConsideringWeekNumber(input2.ToArray()).Count;
            int result3 = Permutator.Run_v2_WithConsideringWeekNumber(input3.ToArray()).Count;
            int result4 = Permutator.Run_v2_WithConsideringWeekNumber(input4.ToArray()).Count;
            int result5 = Permutator.Run_v2_WithConsideringWeekNumber(input5.ToArray()).Count;

            Console.WriteLine("Total combination is " + result1 * result2 * result3 * result4 * result5);
        }
예제 #5
0
        public void Test_StateTable_1()
        {
            var stateTable = new StateTable_v1();
            var data       = new List <Slot>();

            data.AddRange(GetSlotsByName(Subjects.Hydrology));
            data.AddRange(GetSlotsByName(Subjects.IntroductionToBuildingServices));
            data.AddRange(GetSlotsByName(Subjects.HighwayAndTransportation));
            data.AddRange(GetSlotsByName(Subjects.StructuralAnalysisII));

            var result = Permutator.Run_v2_WithConsideringWeekNumber(data.ToArray())[0];

            for (int i = 0; i < result.Count; i++)
            {
                stateTable.Add(new IndexedSlot(result[i]));
            }
            Console.WriteLine(stateTable.ToString());
            Assert.Pass();
        }
예제 #6
0
        public void Test_ClashFinder_GetTimetableState_2()
        {
            var chosenSubject = TestData.Subjects.ArtCraftAndDesign;
            var input         =
                Permutator.Run_v2_WithConsideringWeekNumber(TestData.GetSlotsByName(chosenSubject)
                                                            .ToArray());
            var result = ClashFinder.GetSubjectState(input);

            for (int i = 0; i < Day.NumberOfDaysPerWeek; i++)
            {
                if (i == 0)    //Monday
                {
                    Assert.IsTrue(result[i] == Convert.ToInt32("00000000000000111100000000000000", 2));
                }
                else
                {
                    Assert.IsTrue(result[i] == 0);
                }
            }
        }
예제 #7
0
        public void Test_ClashFinder_GetTimetableState_3()
        {
            var chosenSubject = TestData.Subjects.AdvancedStructuralSteelDesign;
            var input         =
                Permutator.Run_v2_WithConsideringWeekNumber(TestData.GetSlotsByName(chosenSubject)
                                                            .ToArray());
            var result = ClashFinder.GetSubjectState(input);

            for (int i = 0; i < Day.NumberOfDaysPerWeek; i++)
            {
                if (i == 0)   //Monday
                {
                    Assert.IsTrue(result[i] == Convert.ToInt32("00000000000000111100000000000000", 2));
                }
                else if (i == 1)   //Tuesday
                {
                    Assert.AreEqual(Convert.ToInt32("00110000000000000000000000000000".Reverse(), 2), result[i]);
                }
                else   //others
                {
                    Assert.IsTrue(result[i] == 0);
                }
            }
        }