Exemple #1
0
        public static SchedulingTask[] SeedData(out int amountOfTasks, out int amountOfMachines, string path)
        {
            SchedulingTask[] tasks;

            using (StreamReader sr = new StreamReader(path))
            {
                string   line  = sr.ReadLine();
                string[] signs = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);

                amountOfTasks    = int.Parse(signs[0]);
                amountOfMachines = int.Parse(signs[1]);

                tasks = new SchedulingTask[amountOfTasks];

                for (int i = 0; i < amountOfTasks; i++)
                {
                    line  = sr.ReadLine();
                    signs = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    int[] numbers = new int[signs.Length];

                    for (int j = 0; j < signs.Length; j++)
                    {
                        numbers[j] = int.Parse(signs[j]);
                    }
                    tasks[i] = new SchedulingTask(amountOfMachines, numbers);
                }
            }
            return(tasks);
        }
Exemple #2
0
        public static IEnumerable <SchedulingTask> JohnsonsThree(List <SchedulingTask> tasks)
        {
            List <SchedulingTask> tasks2 = new List <SchedulingTask>();

            for (int i = 0; i < tasks.Count; i++)
            {
                SchedulingTask task = new SchedulingTask(2, tasks[i].TimeOnMachine[0] + tasks[i].TimeOnMachine[1],
                                                         tasks[i].TimeOnMachine[1] + tasks[i].TimeOnMachine[2]);
                task.JohnsonIndex = i;
                tasks2.Add(task);
            }

            foreach (var t in JohnsonsTwo(tasks2))
            {
                yield return(tasks[t.JohnsonIndex]);
            }
        }