- Timestamp:
- 06/14/11 14:53:14 (13 years ago)
- Location:
- branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Decoders
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Decoders/GTAlgorithmUtils.cs
r6406 r6412 31 31 foreach (Job j in jobData) { 32 32 foreach (Task t in j.Tasks) { 33 if (!t.IsScheduled .Value) {33 if (!t.IsScheduled) { 34 34 result.Add(t); 35 35 break; … … 56 56 result.Add(conflictedTask); 57 57 foreach (Task t in earliestTasksList) { 58 if (t.ResourceNr .Value == conflictedTask.ResourceNr.Value) {58 if (t.ResourceNr == conflictedTask.ResourceNr) { 59 59 if (ComputeEarliestStartTime(t, schedule) < conflictedCompletionTime) 60 60 result.Add(t); … … 65 65 66 66 public static double ComputeEarliestStartTime(Task t, Schedule schedule) { 67 ScheduledTask previousTask = schedule.GetLastScheduledTaskForJobNr(t.JobNr .Value);68 Resource affectedResource = schedule.Resources[t.ResourceNr .Value];69 double lastMachineEndTime = affectedResource.TotalDuration .Value;67 ScheduledTask previousTask = schedule.GetLastScheduledTaskForJobNr(t.JobNr); 68 Resource affectedResource = schedule.Resources[t.ResourceNr]; 69 double lastMachineEndTime = affectedResource.TotalDuration; 70 70 double previousJobTaskEndTime = 0; 71 71 if (previousTask != null) 72 previousJobTaskEndTime = previousTask.EndTime .Value;72 previousJobTaskEndTime = previousTask.EndTime; 73 73 74 74 return Math.Max(previousJobTaskEndTime, lastMachineEndTime); 75 75 } 76 76 public static double ComputeEarliestCompletionTime(Task t, Schedule schedule) { 77 return ComputeEarliestStartTime(t, schedule) + t.Duration .Value;77 return ComputeEarliestStartTime(t, schedule) + t.Duration; 78 78 } 79 79 } -
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Decoders/JSMDecoder.cs
r6406 r6412 86 86 //scan conflictSet for given solutionCandidate, and return if found 87 87 foreach (Task t in conflictSet) { 88 if (t.JobNr .Value== solutionCandidateJobNr)88 if (t.JobNr == solutionCandidateJobNr) 89 89 return t; 90 90 } … … 94 94 int newResolutionIndex = 0; 95 95 96 while (newResolutionIndex < jsm[conflictedResourceNr].Length && jsm[conflictedResourceNr][newResolutionIndex] != result.JobNr .Value)96 while (newResolutionIndex < jsm[conflictedResourceNr].Length && jsm[conflictedResourceNr][newResolutionIndex] != result.JobNr) 97 97 newResolutionIndex++; 98 ApplyForcingStrategy(jsm, conflictedResourceNr, newResolutionIndex, progressOnConflictedResource, result.JobNr .Value);98 ApplyForcingStrategy(jsm, conflictedResourceNr, newResolutionIndex, progressOnConflictedResource, result.JobNr); 99 99 100 100 return result; … … 108 108 for (int i = progress; i < resource.Length; i++) { 109 109 int j = 0; 110 while (j < conflictSet.Count && conflictSet[j].JobNr .Value!= resource[i])110 while (j < conflictSet.Count && conflictSet[j].JobNr != resource[i]) 111 111 j++; 112 112 … … 145 145 foreach (Job j in jobs) { 146 146 foreach (Task t in j.Tasks) { 147 t.IsScheduled .Value= false;147 t.IsScheduled = false; 148 148 } 149 149 } … … 155 155 //STEP 1 - Get earliest not scheduled operation with minimal earliest completing time 156 156 Task minimal = GTAlgorithmUtils.GetTaskWithMinimalEC(earliestTasksList, resultingSchedule); 157 int conflictedResourceNr = minimal.ResourceNr .Value;157 int conflictedResourceNr = minimal.ResourceNr; 158 158 Resource conflictedResource = resultingSchedule.Resources[conflictedResourceNr]; 159 159 … … 166 166 167 167 //STEP 4 - Add the selected task to the current schedule 168 selectedTask.IsScheduled .Value= true;168 selectedTask.IsScheduled = true; 169 169 double startTime = GTAlgorithmUtils.ComputeEarliestStartTime(selectedTask, resultingSchedule); 170 resultingSchedule.ScheduleTask(selectedTask.ResourceNr .Value, startTime, selectedTask.Duration.Value, selectedTask.JobNr.Value);170 resultingSchedule.ScheduleTask(selectedTask.ResourceNr, startTime, selectedTask.Duration, selectedTask.JobNr); 171 171 172 172 //STEP 5 - Back to STEP 1 -
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Decoders/PRVDecoder.cs
r6406 r6412 72 72 Task currentResult = RandomRule(tasks); 73 73 foreach (Task t in tasks) { 74 if (t.Duration .Value < currentResult.Duration.Value)74 if (t.Duration < currentResult.Duration) 75 75 currentResult = t; 76 76 } … … 82 82 Task currentResult = RandomRule(tasks); 83 83 foreach (Task t in tasks) { 84 if (t.Duration .Value > currentResult.Duration.Value)84 if (t.Duration > currentResult.Duration) 85 85 currentResult = t; 86 86 } … … 94 94 foreach (Task t in tasks) { 95 95 double remainingProcessingTime = 0; 96 foreach (Task jt in jobs[t.JobNr .Value].Tasks) {97 if (!jt.IsScheduled .Value)98 remainingProcessingTime += jt.Duration .Value;96 foreach (Task jt in jobs[t.JobNr].Tasks) { 97 if (!jt.IsScheduled) 98 remainingProcessingTime += jt.Duration; 99 99 } 100 100 if (remainingProcessingTime > currentLargestRemainingProcessingTime) { … … 112 112 foreach (Task t in tasks) { 113 113 double remainingProcessingTime = 0; 114 foreach (Task jt in jobs[t.JobNr .Value].Tasks) {115 if (!jt.IsScheduled .Value)116 remainingProcessingTime += jt.Duration .Value;114 foreach (Task jt in jobs[t.JobNr].Tasks) { 115 if (!jt.IsScheduled) 116 remainingProcessingTime += jt.Duration; 117 117 } 118 118 if (remainingProcessingTime < currentSmallestRemainingProcessingTime) { … … 130 130 foreach (Task t in tasks) { 131 131 int nrOfRemainingTasks = 0; 132 foreach (Task jt in jobs[t.JobNr .Value].Tasks) {133 if (!jt.IsScheduled .Value)132 foreach (Task jt in jobs[t.JobNr].Tasks) { 133 if (!jt.IsScheduled) 134 134 nrOfRemainingTasks++; 135 135 } … … 148 148 foreach (Task t in tasks) { 149 149 int nrOfRemainingTasks = 0; 150 foreach (Task jt in jobs[t.JobNr .Value].Tasks) {151 if (!jt.IsScheduled .Value)150 foreach (Task jt in jobs[t.JobNr].Tasks) { 151 if (!jt.IsScheduled) 152 152 nrOfRemainingTasks++; 153 153 } … … 218 218 foreach (Job j in jobs) { 219 219 foreach (Task t in j.Tasks) { 220 t.IsScheduled .Value= false;220 t.IsScheduled = false; 221 221 } 222 222 } … … 235 235 //STEP 3 - Select an operation from the conflict set (various methods depending on how the algorithm should work..) 236 236 //Task selectedTask = SelectTaskFromConflictSet(conflictSet, solution.PriorityRulesVector [currentDecisionIndex++], solution.NrOfRules.Value); 237 Task selectedTask = SelectTaskFromConflictSet(conflictSet, solution.PriorityRulesVector[minimal.JobNr .Value], solution.NrOfRules.Value);237 Task selectedTask = SelectTaskFromConflictSet(conflictSet, solution.PriorityRulesVector[minimal.JobNr], solution.NrOfRules.Value); 238 238 239 239 //STEP 4 - Adding the selected operation to the current schedule 240 selectedTask.IsScheduled .Value= true;240 selectedTask.IsScheduled = true; 241 241 double startTime = GTAlgorithmUtils.ComputeEarliestStartTime(selectedTask, resultingSchedule); 242 resultingSchedule.ScheduleTask(selectedTask.ResourceNr .Value, startTime, selectedTask.Duration.Value, selectedTask.JobNr.Value);242 resultingSchedule.ScheduleTask(selectedTask.ResourceNr, startTime, selectedTask.Duration, selectedTask.JobNr); 243 243 244 244 //STEP 5 - Back to STEP 1 -
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Decoders/PWRDecoder.cs
r6406 r6412 60 60 foreach (int jobNr in solution.PermutationWithRepetition) { 61 61 int i = 0; 62 while (jobs[jobNr].Tasks[i].IsScheduled .Value) i++;62 while (jobs[jobNr].Tasks[i].IsScheduled) i++; 63 63 Task currentTask = jobs[jobNr].Tasks[i]; 64 64 double startTime = GTAlgorithmUtils.ComputeEarliestStartTime(currentTask, resultingSchedule); 65 currentTask.IsScheduled .Value= true;66 resultingSchedule.ScheduleTask(currentTask.ResourceNr .Value, startTime, currentTask.Duration.Value, currentTask.JobNr.Value);65 currentTask.IsScheduled = true; 66 resultingSchedule.ScheduleTask(currentTask.ResourceNr, startTime, currentTask.Duration, currentTask.JobNr); 67 67 } 68 68 return resultingSchedule;
Note: See TracChangeset
for help on using the changeset viewer.