public static SchedulingProblem Create(SchedulingProblemType type, string inputData)
        {
            switch (type)
            {
            case SchedulingProblemType.FlowShop:
                return(new FlowShop.SchedulingProblem(inputData));

            case SchedulingProblemType.JobShop:
                return(new JobShop.SchedulingProblem(inputData));

            default:
                return(new OpenShop.SchedulingProblem(inputData));
            }
        }
        public void test_perform_cockroach_optimization_algorithm(string directory, string fileName, SchedulingProblemType schedulingProblemType, int maxIterations, int populationCount, int maxStep, int visual)
        {
            // Arrange
            var path        = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName + "/IntegrationTests/TestInstances/" + directory;
            var resultsPath = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName + "/IntegrationTests/TestResults/CO";

            // Act
            var inputData         = FileHelper.ReadFile(path, fileName);
            var schedulingProblem = SchedulingProblemFactory.Create(schedulingProblemType, inputData);
            var algorithm         = new CockroachAlgorithm(maxStep, visual, maxIterations, populationCount, schedulingProblem);

            var watch  = System.Diagnostics.Stopwatch.StartNew();
            var result = algorithm.Perform();

            watch.Stop();
            var executionTime = watch.Elapsed.ToString("hh\\:mm\\:ss");

            // Assert
            Assert.IsTrue(result.IsCorrect(schedulingProblem.Jobs));

            // Writing result to file
            FileHelper.WriteToFile(resultsPath + "/" + directory, fileName,
                                   $@"maxIterations: {maxIterations}, populationCount: {populationCount}, visual: {visual}, maxStep: {maxStep} timeSpan: {result.TimeSpan}, time: {executionTime}"
                                   );
        }
        public void test_creating_scheduling_problem_from_file_input_data(string directory, string fileName, SchedulingProblemType schedulingProblemType, int expectedJobsCount, int expectedMachinesCount)
        {
            // Arrange
            var path = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName + "/IntegrationTests/TestInstances/" + directory;

            // Act
            var inputData         = FileHelper.ReadFile(path, fileName);
            var schedulingProblem = SchedulingProblemFactory.Create(schedulingProblemType, inputData);

            // Assert
            Assert.AreEqual(expectedJobsCount, schedulingProblem.JobsCount);
            Assert.AreEqual(expectedJobsCount, schedulingProblem.Jobs.Count);
            Assert.AreEqual(expectedMachinesCount, schedulingProblem.MachinesCount);
        }