- Timestamp:
- 06/06/11 11:23:43 (13 years ago)
- Location:
- branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Decoders
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Decoders/JSMDecoder.cs
r6293 r6364 36 36 37 37 namespace HeuristicLab.Problems.Scheduling.Decoders { 38 [Item("Job Sequenc ing Matrix Decoder", "Applies the GifflerThompson algorithm to create an active schedule from a JobSequencingMatrix.")]38 [Item("Job Sequence Matrix Decoder", "Applies the GifflerThompson algorithm to create an active schedule from a JobSequence Matrix.")] 39 39 [StorableClass] 40 40 public class JSMDecoder : SchedulingDecoder<JSMEncoding>, IStochasticOperator, IJSSPOperator { … … 76 76 : base() { 77 77 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 78 Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the JSSP- Instance."));78 Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the Schedulingproblem - Instance.")); 79 79 } 80 80 -
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Decoders/PRVDecoder.cs
r6293 r6364 197 197 } 198 198 199 private ItemList<Task> GetEarliestNotScheduledTasks() { 200 ItemList<Task> result = new ItemList<Task>(); 201 foreach (Job j in jobs) { 202 foreach (Task t in j.Tasks) { 203 if (!t.IsScheduled.Value) { 204 result.Add(t); 205 break; 206 } 207 } 208 } 209 return result; 210 } 211 private Task GetTaskWithMinimalEC(ItemList<Task> earliestTasksList) { 212 double minEct = double.MaxValue; 213 Task result = null; 214 foreach (Task t in earliestTasksList) { 215 double ect = GTAlgorithmUtils.ComputeEarliestCompletionTime(t, resultingSchedule); 216 if (ect < minEct) { 217 result = t; 218 minEct = ect; 219 } 220 } 221 return result; 222 } 223 private ItemList<Task> GetConflictSetForTask(Task conflictedTask, ItemList<Task> earliestTasksList) { 224 ItemList<Task> result = new ItemList<Task>(); 225 double conflictedCompletionTime = GTAlgorithmUtils.ComputeEarliestCompletionTime(conflictedTask, resultingSchedule); 226 foreach (Task t in earliestTasksList) { 227 if (t.ResourceNr.Value == conflictedTask.ResourceNr.Value) { 228 if (GTAlgorithmUtils.ComputeEarliestStartTime(t, resultingSchedule) < conflictedCompletionTime) 229 result.Add(t); 230 } 231 } 232 return result; 233 } 199 200 234 201 private Task SelectTaskFromConflictSet(ItemList<Task> conflictSet, int ruleIndex, int nrOfRules) { 235 202 if (conflictSet.Count == 1) 236 203 return conflictSet[0]; 237 204 238 205 ruleIndex = ruleIndex % nrOfRules; 239 206 switch (ruleIndex) { … … 249 216 case 9: return RandomRule(conflictSet); 250 217 default: return RandomRule(conflictSet); 251 } 218 } 252 219 } 253 220 … … 265 232 //GT-Algorithm 266 233 //STEP 0 - Compute a list of "earliest operations" 267 ItemList<Task> earliestTasksList = G etEarliestNotScheduledTasks();268 int currentDecisionIndex = 0;234 ItemList<Task> earliestTasksList = GTAlgorithmUtils.GetEarliestNotScheduledTasks(jobs); 235 //int currentDecisionIndex = 0; 269 236 while (earliestTasksList.Count > 0) { 270 237 //STEP 1 - Get earliest not scheduled operation with minimal earliest completing time 271 Task minimal = G etTaskWithMinimalEC(earliestTasksList);238 Task minimal = GTAlgorithmUtils.GetTaskWithMinimalEC(earliestTasksList, resultingSchedule); 272 239 273 240 //STEP 2 - Compute a conflict set of all operations that can be scheduled on the machine the previously selected operation runs on 274 ItemList<Task> conflictSet = G etConflictSetForTask(minimal, earliestTasksList);241 ItemList<Task> conflictSet = GTAlgorithmUtils.GetConflictSetForTask(minimal, earliestTasksList, jobs, resultingSchedule); 275 242 276 243 //STEP 3 - Select an operation from the conflict set (various methods depending on how the algorithm should work..) 277 Task selectedTask = SelectTaskFromConflictSet(conflictSet, solution.PriorityRulesVector [currentDecisionIndex++], solution.NrOfRules.Value); 244 //Task selectedTask = SelectTaskFromConflictSet(conflictSet, solution.PriorityRulesVector [currentDecisionIndex++], solution.NrOfRules.Value); 245 Task selectedTask = SelectTaskFromConflictSet(conflictSet, solution.PriorityRulesVector[minimal.JobNr.Value], solution.NrOfRules.Value); 278 246 279 247 //STEP 4 - Adding the selected operation to the current schedule … … 283 251 284 252 //STEP 5 - Back to STEP 1 285 earliestTasksList = G etEarliestNotScheduledTasks();253 earliestTasksList = GTAlgorithmUtils.GetEarliestNotScheduledTasks(jobs); 286 254 } 287 255
Note: See TracChangeset
for help on using the changeset viewer.