- Timestamp:
- 11/08/12 13:31:18 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.Scheduling/3.3/Evaluators
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Scheduling/3.3/Evaluators/MakespanEvaluator.cs
r8603 r8882 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 41 42 public MakespanEvaluator() : base() { } 42 43 43 protected override DoubleValue evaluate(Schedule schedule) { 44 DoubleValue quality = new DoubleValue(0); 45 foreach (Resource r in schedule.Resources) { 46 if (r.TotalDuration > quality.Value) { 47 quality.Value = r.TotalDuration; 48 } 49 } 50 return quality; 44 public static double GetMakespan(Schedule schedule) { 45 return schedule.Resources.Select(r => r.TotalDuration).Max(); 46 } 47 48 protected override DoubleValue Evaluate(Schedule schedule) { 49 return new DoubleValue(GetMakespan(schedule)); 51 50 } 52 51 -
trunk/sources/HeuristicLab.Problems.Scheduling/3.3/Evaluators/MeanTardinessEvaluator.cs
r8603 r8882 20 20 #endregion 21 21 22 using System; 23 using System.Linq; 22 24 using HeuristicLab.Common; 23 25 using HeuristicLab.Core; … … 31 33 [StorableClass] 32 34 public class MeanTardinessEvaluator : SchedulingEvaluator, IJSSPOperator { 35 33 36 [StorableConstructor] 34 37 protected MeanTardinessEvaluator(bool deserializing) : base(deserializing) { } 35 protected MeanTardinessEvaluator(MeanTardinessEvaluator original, Cloner cloner) 36 : base(original, cloner) { 37 } 38 protected MeanTardinessEvaluator(MeanTardinessEvaluator original, Cloner cloner) : base(original, cloner) { } 38 39 public override IDeepCloneable Clone(Cloner cloner) { 39 40 return new MeanTardinessEvaluator(this, cloner); … … 45 46 } 46 47 #endregion 47 #region Properties48 public ItemList<Job> JobData {49 get { return JobDataParameter.ActualValue; }50 }51 #endregion52 48 53 49 public MeanTardinessEvaluator() … … 56 52 } 57 53 58 protected override DoubleValue evaluate(Schedule schedule) { 59 double totalTardiness = 0; 60 foreach (Resource r in schedule.Resources) { 61 double tardiness = r.Tasks[r.Tasks.Count - 1].EndTime - JobData[r.Tasks[r.Tasks.Count - 1].JobNr].DueDate; 62 if (tardiness > 0) 63 totalTardiness += tardiness; 64 } 65 return new DoubleValue(totalTardiness / schedule.Resources.Count); 54 public static double GetMeanTardiness(Schedule schedule, ItemList<Job> jobData) { 55 return schedule.Resources 56 .Select(r => Math.Max(0, r.Tasks.Last().EndTime - jobData[r.Tasks.Last().JobNr].DueDate)) 57 .Average(); 66 58 } 67 59 68 p ublic override IOperation Apply() {69 return base.Apply();60 protected override DoubleValue Evaluate(Schedule schedule) { 61 return new DoubleValue(GetMeanTardiness(schedule, JobDataParameter.ActualValue)); 70 62 } 71 63 } -
trunk/sources/HeuristicLab.Problems.Scheduling/3.3/Evaluators/SchedulingEvaluator.cs
r8603 r8882 61 61 } 62 62 63 protected abstract DoubleValue evaluate(Schedule schedule);63 protected abstract DoubleValue Evaluate(Schedule schedule); 64 64 65 65 public override IOperation Apply() { 66 66 Schedule schedule = ScheduleParameter.ActualValue; 67 QualityParameter.ActualValue = evaluate(schedule);67 QualityParameter.ActualValue = Evaluate(schedule); 68 68 return base.Apply(); 69 69 }
Note: See TracChangeset
for help on using the changeset viewer.