- Timestamp:
- 06/24/11 14:23:19 (14 years ago)
- Location:
- branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding
- Files:
-
- 10 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Resource.cs
r6412 r6475 75 75 return sb.ToString(); 76 76 } 77 78 79 public override bool Equals(object obj) { 80 if (obj.GetType() == typeof(Resource)) 81 return AreEqual(this, obj as Resource); 82 else 83 return false; 84 } 85 86 private static bool AreEqual(Resource res1, Resource res2) { 87 if (res1.Tasks.Count != res2.Tasks.Count) 88 return false; 89 for (int i = 0; i < res1.Tasks.Count; i++) { 90 if (!res1.Tasks[i].Equals(res2.Tasks[i])) 91 return false; 92 } 93 94 return true; 95 } 77 96 } 78 97 } -
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Schedule.cs
r6412 r6475 31 31 [Item("Schedule", "Represents the general solution for scheduling problems.")] 32 32 [StorableClass] 33 public class Schedule : NamedItem {33 public class Schedule : NamedItem, IScheduleEncoding { 34 34 #region Properties 35 35 [Storable] … … 79 79 lastScheduledTaskOfJob = new Dictionary<int, ScheduledTask>(); 80 80 } 81 81 82 82 83 … … 159 160 return quality; 160 161 } 162 163 public override bool Equals(object obj) { 164 if (obj.GetType() == typeof(Schedule)) 165 return AreEqual(this, obj as Schedule); 166 else 167 return false; 168 } 169 170 private static bool AreEqual(Schedule schedule1, Schedule schedule2) { 171 if (schedule1.Resources.Count != schedule2.Resources.Count) 172 return false; 173 for (int i = 0; i < schedule1.Resources.Count; i++) { 174 if (!schedule1.Resources[i].Equals(schedule2.Resources[i])) 175 return false; 176 } 177 178 return true; 179 } 180 161 181 } 162 182 } -
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/ScheduledTask.cs
r6414 r6475 71 71 return sb.ToString(); 72 72 } 73 74 75 public override bool Equals(object obj) { 76 if (obj.GetType() == typeof(ScheduledTask)) 77 return AreEqual(this, obj as ScheduledTask); 78 else 79 return false; 80 } 81 82 public static bool AreEqual(ScheduledTask task1, ScheduledTask task2) { 83 return (task1.Duration == task2.Duration && 84 task1.JobNr == task2.JobNr && 85 task1.ResourceNr == task2.ResourceNr && 86 task1.StartTime == task2.StartTime && 87 task1.EndTime == task2.EndTime); 88 } 73 89 } 74 90 }
Note: See TracChangeset
for help on using the changeset viewer.