Changeset 6412 for branches/Scheduling/HeuristicLab.Problems.Scheduling
- Timestamp:
- 06/14/11 14:53:14 (14 years ago)
- Location:
- branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3
- Files:
-
- 10 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; -
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Evaluators/MakespanEvaluator.cs
r6406 r6412 44 44 DoubleValue quality = new DoubleValue(0); 45 45 foreach (Resource r in schedule.Resources) { 46 if (r.TotalDuration .Value> quality.Value) {47 quality.Value = r.TotalDuration .Value;46 if (r.TotalDuration > quality.Value) { 47 quality.Value = r.TotalDuration; 48 48 } 49 49 } -
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Evaluators/MeanTardinessEvaluator.cs
r6406 r6412 59 59 double totalTardiness = 0; 60 60 foreach (Resource r in schedule.Resources) { 61 double tardiness = r.Tasks[r.Tasks.Count - 1].EndTime .Value - JobData[r.Tasks[r.Tasks.Count - 1].JobNr.Value].DueDate.Value;61 double tardiness = r.Tasks[r.Tasks.Count - 1].EndTime - JobData[r.Tasks[r.Tasks.Count - 1].JobNr].DueDate; 62 62 if (tardiness > 0) 63 63 totalTardiness += tardiness; -
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Job.cs
r6406 r6412 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Data;26 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 26 28 27 namespace HeuristicLab.Problems.Scheduling { 29 [Item("Job Class", "Represents a composition of tasks that require processing in a scheduling problem.")]28 [Item("Job", "Represents a composition of tasks that require processing in a scheduling problem.")] 30 29 [StorableClass] 31 30 public class Job : Item { 32 31 [Storable] 33 public DoubleValue DueDate { get; set; }32 public double DueDate { get; set; } 34 33 [Storable] 35 public IntValueIndex { get; set; }34 public int Index { get; set; } 36 35 [Storable] 37 36 public ItemList<Task> Tasks { get; set; } … … 41 40 protected Job(Job original, Cloner cloner) 42 41 : base(original, cloner) { 43 this.DueDate = cloner.Clone(original.DueDate);44 this.Index = cloner.Clone(original.Index);42 this.DueDate = original.DueDate; 43 this.Index = original.Index; 45 44 this.Tasks = cloner.Clone(original.Tasks); 46 45 } … … 48 47 return new Job(this, cloner); 49 48 } 50 public Job( IntValue index, DoubleValue dueDate)49 public Job(int index, double dueDate) 51 50 : base() { 52 51 Index = index; … … 54 53 55 54 if (dueDate != null) 56 DueDate = (DoubleValue)dueDate.Clone(); 57 else 58 DueDate = null; 55 DueDate = dueDate; 56 59 57 } 60 58 … … 66 64 } 67 65 if (DueDate != null) 68 sb.Append("{" + DueDate .Value+ "} ");66 sb.Append("{" + DueDate + "} "); 69 67 sb.Append("]"); 70 68 return sb.ToString(); … … 72 70 73 71 internal Task GetPreviousTask(Task t) { 74 if (t.TaskNr .Value== 0)72 if (t.TaskNr == 0) 75 73 return null; 76 74 else 77 return Tasks[t.TaskNr .Value- 1];75 return Tasks[t.TaskNr - 1]; 78 76 } 79 77 } -
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/JobShopSchedulingProblem.cs
r6406 r6412 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Drawing; 24 25 using System.IO; 25 26 using HeuristicLab.Common; … … 39 40 [Creatable("Problems")] 40 41 [StorableClass] 41 public sealed class JobShopSchedulingProblem : SchedulingProblem {42 public sealed class JobShopSchedulingProblem : SchedulingProblem, IStorableContent { 42 43 #region Parameter Properties 43 44 public ValueParameter<ItemList<Job>> JobDataParameter { … … 87 88 set { DueDatesParameter.Value = value; } 88 89 } 90 public override Image ItemImage { 91 get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; } 92 } 93 public string Filename { get; set; } 89 94 #endregion 90 95 … … 95 100 96 101 Parameters.Add(new ValueParameter<IntValue>("Jobs", "The number of jobs used in this JSSP instance.", new IntValue())); 97 Parameters.Add(new ValueParameter<IntValue>("Resources", "The number of resources used this JSSP instance.", new IntValue()));102 Parameters.Add(new ValueParameter<IntValue>("Resources", "The number of resources used in this JSSP instance.", new IntValue())); 98 103 Parameters.Add(new ValueParameter<BoolValue>("DueDates", "Determines whether the problem instance uses due dates or not.", new BoolValue())); 99 104 Parameters.Add(new ValueParameter<SchedulingEvaluator>("SolutionEvaluator", "The evaluator used to determine the quality of a solution.", new MakespanEvaluator())); … … 196 201 } 197 202 private Job CreateJobFromData(List<string> data, int jobCount) { 198 DoubleValue dueDate = null;203 double dueDate = 0; 199 204 int dataCount = data.Count; 200 205 if (DueDates.Value) { 201 dueDate = new DoubleValue(Double.Parse(data[data.Count - 1]));206 dueDate = Double.Parse(data[data.Count - 1]); 202 207 dataCount--; 203 208 } 204 Job j = new Job( new IntValue(jobCount), dueDate);209 Job j = new Job(jobCount, dueDate); 205 210 for (int i = 0; i < dataCount; i++) { 206 211 Task t = new Task(i / 2, Int32.Parse(data[i]), jobCount, Double.Parse(data[i + 1])); -
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Plugin.cs
r6406 r6412 23 23 24 24 namespace HeuristicLab.Problems.Scheduling { 25 [Plugin("HeuristicLab.Problems.Scheduling", "3.3.3.6 364")]25 [Plugin("HeuristicLab.Problems.Scheduling", "3.3.3.6406")] 26 26 [PluginFile("HeuristicLab.Problems.Scheduling-3.3.dll", PluginFileType.Assembly)] 27 27 public class HeuristicLabProblemsSchedulingPlugin : PluginBase { -
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Task.cs
r6406 r6412 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Data;26 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 26 … … 31 30 public class Task : Item { 32 31 [Storable] 33 public IntValueTaskNr { get; set; }32 public int TaskNr { get; set; } 34 33 [Storable] 35 public IntValueResourceNr { get; set; }34 public int ResourceNr { get; set; } 36 35 [Storable] 37 public IntValueJobNr { get; set; }36 public int JobNr { get; set; } 38 37 [Storable] 39 public DoubleValue Duration { get; set; }38 public double Duration { get; set; } 40 39 [Storable] 41 public BoolValueIsScheduled { get; set; }40 public bool IsScheduled { get; set; } 42 41 43 42 [StorableConstructor] … … 45 44 protected Task(Task original, Cloner cloner) 46 45 : base(original, cloner) { 47 this.ResourceNr = cloner.Clone(original.ResourceNr);48 this.JobNr = cloner.Clone(original.JobNr);49 this.Duration = cloner.Clone(original.Duration);50 this.TaskNr = cloner.Clone(original.TaskNr);51 this.IsScheduled = cloner.Clone(original.IsScheduled);46 this.ResourceNr = original.ResourceNr; 47 this.JobNr = original.JobNr; 48 this.Duration = original.Duration; 49 this.TaskNr = original.TaskNr; 50 this.IsScheduled = original.IsScheduled; 52 51 } 53 52 public override IDeepCloneable Clone(Cloner cloner) { … … 58 57 public Task(int taskNr, int resNr, int jobNr, double duration) 59 58 : base() { 60 Duration = new DoubleValue(duration);61 ResourceNr = new IntValue(resNr);62 JobNr = new IntValue(jobNr);63 TaskNr = new IntValue(taskNr);64 IsScheduled = new BoolValue(false);59 Duration = duration; 60 ResourceNr = resNr; 61 JobNr = jobNr; 62 TaskNr = taskNr; 63 IsScheduled = false; 65 64 } 66 65
Note: See TracChangeset
for help on using the changeset viewer.