Changeset 13437 for branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Crossovers
- Timestamp:
- 12/06/15 15:33:25 (9 years ago)
- Location:
- branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Crossovers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Crossovers/DirectScheduleCrossover.cs
r12012 r13437 29 29 [StorableClass] 30 30 public abstract class DirectScheduleCrossover : ScheduleCrossover, IDirectScheduleOperator { 31 public ILookupParameter<ItemList<Job>> JobDataParameter { 32 get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; } 33 } 34 31 35 [StorableConstructor] 32 36 protected DirectScheduleCrossover(bool deserializing) : base(deserializing) { } … … 34 38 public DirectScheduleCrossover() 35 39 : base() { 36 ParentsParameter.ActualName = "Schedule";37 ChildParameter.ActualName = "Schedule";38 40 Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the JSSP - Instance.")); 39 }40 41 public ILookupParameter<ItemList<Job>> JobDataParameter {42 get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; }43 41 } 44 42 -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Crossovers/DirectScheduleGTCrossover.cs
r12012 r13437 64 64 Task minimal = GTAlgorithmUtils.GetTaskWithMinimalEC(earliestTasksList, child); 65 65 int conflictedResourceNr = minimal.ResourceNr; 66 Resource conflictedResource = child.Resources[conflictedResourceNr];67 66 68 67 //STEP 2 - Compute a conflict set of all operations that can be scheduled on the conflicted resource 69 ItemList<Task> conflictSet = GTAlgorithmUtils.GetConflictSetForTask(minimal, earliestTasksList, jobData,child);68 ItemList<Task> conflictSet = GTAlgorithmUtils.GetConflictSetForTask(minimal, earliestTasksList, child); 70 69 71 70 //STEP 3 - Select a task from the conflict set 72 int progressOnResource = conflictedResource.Tasks.Count;73 71 Task selectedTask = null; 74 72 if (random.NextDouble() < mutProp) { … … 77 75 } else { 78 76 //Crossover 79 selectedTask = SelectTaskFromConflictSet(conflictSet, ((random.Next(2) == 0) ? parent1 : parent2), conflictedResourceNr , progressOnResource);77 selectedTask = SelectTaskFromConflictSet(conflictSet, ((random.Next(2) == 0) ? parent1 : parent2), conflictedResourceNr); 80 78 } 81 79 … … 92 90 } 93 91 94 private static Task SelectTaskFromConflictSet(ItemList<Task> conflictSet, Schedule usedParent, int conflictedResourceNr , int progressOnResource) {92 private static Task SelectTaskFromConflictSet(ItemList<Task> conflictSet, Schedule usedParent, int conflictedResourceNr) { 95 93 //Apply Crossover 96 94 foreach (ScheduledTask st in usedParent.Resources[conflictedResourceNr].Tasks) {
Note: See TracChangeset
for help on using the changeset viewer.