Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/08/12 13:31:18 (12 years ago)
Author:
abeham
Message:

#1329:

  • Added JSSPData class to problem instances
  • Added problem instance provider for some ORLIB JSSP instances (abz, ft, la01-20)
  • Adapted JSSP to load and export jssp problems
  • Adapted JSSP problem view to derive from ProblemView
  • Added static methods to MakespanEvaluator and MeanTardinessEvaluator
  • Fixed a bug in PRVUniformOnePositionManipulator
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  
    2020#endregion
    2121
     22using System.Linq;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    4142    public MakespanEvaluator() : base() { }
    4243
    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));
    5150    }
    5251
  • trunk/sources/HeuristicLab.Problems.Scheduling/3.3/Evaluators/MeanTardinessEvaluator.cs

    r8603 r8882  
    2020#endregion
    2121
     22using System;
     23using System.Linq;
    2224using HeuristicLab.Common;
    2325using HeuristicLab.Core;
     
    3133  [StorableClass]
    3234  public class MeanTardinessEvaluator : SchedulingEvaluator, IJSSPOperator {
     35
    3336    [StorableConstructor]
    3437    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) { }
    3839    public override IDeepCloneable Clone(Cloner cloner) {
    3940      return new MeanTardinessEvaluator(this, cloner);
     
    4546    }
    4647    #endregion
    47     #region Properties
    48     public ItemList<Job> JobData {
    49       get { return JobDataParameter.ActualValue; }
    50     }
    51     #endregion
    5248
    5349    public MeanTardinessEvaluator()
     
    5652    }
    5753
    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();
    6658    }
    6759
    68     public override IOperation Apply() {
    69       return base.Apply();
     60    protected override DoubleValue Evaluate(Schedule schedule) {
     61      return new DoubleValue(GetMeanTardiness(schedule, JobDataParameter.ActualValue));
    7062    }
    7163  }
  • trunk/sources/HeuristicLab.Problems.Scheduling/3.3/Evaluators/SchedulingEvaluator.cs

    r8603 r8882  
    6161    }
    6262
    63     protected abstract DoubleValue evaluate(Schedule schedule);
     63    protected abstract DoubleValue Evaluate(Schedule schedule);
    6464
    6565    public override IOperation Apply() {
    6666      Schedule schedule = ScheduleParameter.ActualValue;
    67       QualityParameter.ActualValue = evaluate(schedule);
     67      QualityParameter.ActualValue = Evaluate(schedule);
    6868      return base.Apply();
    6969    }
Note: See TracChangeset for help on using the changeset viewer.