public override Schedule CreateScheduleFromEncoding(IScheduleEncoding encoding)
        {
            var solution = encoding as PWREncoding;

            if (solution == null)
            {
                throw new InvalidOperationException("Encoding is not of type PWREncoding");
            }

            var jobs = (ItemList <Job>)JobDataParameter.ActualValue.Clone();
            var resultingSchedule = new Schedule(jobs[0].Tasks.Count);

            foreach (int jobNr in solution.PermutationWithRepetition)
            {
                int i = 0;
                while (jobs[jobNr].Tasks[i].IsScheduled)
                {
                    i++;
                }
                Task   currentTask = jobs[jobNr].Tasks[i];
                double startTime   = GTAlgorithmUtils.ComputeEarliestStartTime(currentTask, resultingSchedule);
                currentTask.IsScheduled = true;
                resultingSchedule.ScheduleTask(currentTask.ResourceNr, startTime, currentTask.Duration, currentTask.JobNr);
            }
            return(resultingSchedule);
        }
Esempio n. 2
0
        public override Schedule CreateScheduleFromEncoding(IScheduleEncoding encoding)
        {
            var solution = encoding as PRVEncoding;

            if (solution == null)
            {
                throw new InvalidOperationException("Encoding is not of type PWREncoding");
            }

            var jobs = (ItemList <Job>)JobDataParameter.ActualValue.Clone();
            var resultingSchedule = new Schedule(jobs[0].Tasks.Count);

            //Reset scheduled tasks in result
            foreach (Job j in jobs)
            {
                foreach (Task t in j.Tasks)
                {
                    t.IsScheduled = false;
                }
            }

            //GT-Algorithm
            //STEP 0 - Compute a list of "earliest operations"
            ItemList <Task> earliestTasksList = GTAlgorithmUtils.GetEarliestNotScheduledTasks(jobs);

            //int currentDecisionIndex = 0;
            while (earliestTasksList.Count > 0)
            {
                //STEP 1 - Get earliest not scheduled operation with minimal earliest completing time
                Task minimal = GTAlgorithmUtils.GetTaskWithMinimalEC(earliestTasksList, resultingSchedule);

                //STEP 2 - Compute a conflict set of all operations that can be scheduled on the machine the previously selected operation runs on
                ItemList <Task> conflictSet = GTAlgorithmUtils.GetConflictSetForTask(minimal, earliestTasksList, jobs, resultingSchedule);

                //STEP 3 - Select an operation from the conflict set (various methods depending on how the algorithm should work..)
                //Task selectedTask = SelectTaskFromConflictSet(conflictSet, solution.PriorityRulesVector [currentDecisionIndex++], solution.NrOfRules.Value);
                Task selectedTask = SelectTaskFromConflictSet(conflictSet, solution.PriorityRulesVector[minimal.JobNr], solution.NrOfRules.Value, resultingSchedule, jobs);

                //STEP 4 - Adding the selected operation to the current schedule
                selectedTask.IsScheduled = true;
                double startTime = GTAlgorithmUtils.ComputeEarliestStartTime(selectedTask, resultingSchedule);
                resultingSchedule.ScheduleTask(selectedTask.ResourceNr, startTime, selectedTask.Duration, selectedTask.JobNr);

                //STEP 5 - Back to STEP 1
                earliestTasksList = GTAlgorithmUtils.GetEarliestNotScheduledTasks(jobs);
            }

            return(resultingSchedule);
        }
Esempio n. 3
0
        //earliest start time
        private Task ESTRule(ItemList <Task> tasks, Schedule schedule)
        {
            Task   currentResult = RandomRule(tasks);
            double currentEST    = double.MaxValue;

            foreach (Task t in tasks)
            {
                double est = GTAlgorithmUtils.ComputeEarliestStartTime(t, schedule);
                if (est < currentEST)
                {
                    currentEST    = est;
                    currentResult = t;
                }
            }
            return(currentResult);
        }
Esempio n. 4
0
        public Schedule CreateScheduleFromEncoding(JSMEncoding solution, ItemList <Job> jobData)
        {
            ItemList <Permutation> jobSequenceMatrix = solution.JobSequenceMatrix;

            var jobs = (ItemList <Job>)jobData.Clone();
            var resultingSchedule = new Schedule(jobs[0].Tasks.Count);

            //Reset scheduled tasks in result
            foreach (Job j in jobs)
            {
                foreach (Task t in j.Tasks)
                {
                    t.IsScheduled = false;
                }
            }

            //GT-Algorithm
            //STEP 0 - Compute a list of "earliest operations"
            ItemList <Task> earliestTasksList = GTAlgorithmUtils.GetEarliestNotScheduledTasks(jobs);

            while (earliestTasksList.Count > 0)
            {
                //STEP 1 - Get earliest not scheduled operation with minimal earliest completing time
                Task     minimal = GTAlgorithmUtils.GetTaskWithMinimalEC(earliestTasksList, resultingSchedule);
                int      conflictedResourceNr = minimal.ResourceNr;
                Resource conflictedResource   = resultingSchedule.Resources[conflictedResourceNr];

                //STEP 2 - Compute a conflict set of all operations that can be scheduled on the conflicted resource
                ItemList <Task> conflictSet = GTAlgorithmUtils.GetConflictSetForTask(minimal, earliestTasksList, jobs, resultingSchedule);

                //STEP 3 - Select a task from the conflict set
                int  progressOnResource = conflictedResource.Tasks.Count;
                Task selectedTask       = SelectTaskFromConflictSet(conflictedResourceNr, progressOnResource, conflictSet, jobSequenceMatrix);

                //STEP 4 - Add the selected task to the current schedule
                selectedTask.IsScheduled = true;
                double startTime = GTAlgorithmUtils.ComputeEarliestStartTime(selectedTask, resultingSchedule);
                resultingSchedule.ScheduleTask(selectedTask.ResourceNr, startTime, selectedTask.Duration, selectedTask.JobNr);

                //STEP 5 - Back to STEP 1
                earliestTasksList = GTAlgorithmUtils.GetEarliestNotScheduledTasks(jobs);
            }

            return(resultingSchedule);
        }