Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/10/11 16:18:44 (13 years ago)
Author:
jhelm
Message:

#1329: Applied suggestions from codereview. Added unit-tests. Renamed encoding-project.

Location:
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3

    • Property svn:ignore
      •  

        old new  
        22bin
        33obj
         4HeuristicLab.Problems.Scheduling-3.3.csproj.user
  • branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Evaluators/MakespanEvaluator.cs

    r6293 r6406  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    25 using System.Text;
     22using HeuristicLab.Common;
    2623using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.ScheduleEncoding;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    28 using HeuristicLab.Common;
    29 using HeuristicLab.Data;
    30 using HeuristicLab.Optimization;
    31 using HeuristicLab.Parameters;
    32 using HeuristicLab.Encodings.SchedulingEncoding;
    3327
    34 namespace HeuristicLab.Problems.Scheduling.Evaluators {
     28namespace HeuristicLab.Problems.Scheduling {
    3529  [Item("Makespan Evaluator", "Represents an evaluator using the maximum makespan of a schedule.")]
    3630  [StorableClass]
     
    4539    }
    4640
    47     public MakespanEvaluator () : base () { }
     41    public MakespanEvaluator() : base() { }
    4842
    4943    protected override DoubleValue evaluate(Schedule schedule) {
    50       DoubleValue quality = new DoubleValue (0);
     44      DoubleValue quality = new DoubleValue(0);
    5145      foreach (Resource r in schedule.Resources) {
    5246        if (r.TotalDuration.Value > quality.Value) {
  • branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Evaluators/MeanTardinessEvaluator.cs

    r6364 r6406  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    25 using System.Text;
     22using HeuristicLab.Common;
    2623using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.ScheduleEncoding;
     26using HeuristicLab.Parameters;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    28 using HeuristicLab.Common;
    29 using HeuristicLab.Data;
    30 using HeuristicLab.Optimization;
    31 using HeuristicLab.Parameters;
    32 using HeuristicLab.Encodings.SchedulingEncoding;
    33 using HeuristicLab.Problems.Scheduling.Interfaces;
    3428
    35 namespace HeuristicLab.Problems.Scheduling.Evaluators {
     29namespace HeuristicLab.Problems.Scheduling {
    3630  [Item("Mean tardiness Evaluator", "Represents an evaluator using the mean tardiness of a schedule.")]
    3731  [StorableClass]
     
    5751    #endregion
    5852
    59     public MeanTardinessEvaluator() : base() {
     53    public MeanTardinessEvaluator()
     54      : base() {
    6055      Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Jobdata defining the precedence relationships and the duration of the tasks in this JSSP-Instance."));
    6156    }
  • branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Evaluators/SchedulingEvaluationAlgorithm.cs

    r6364 r6406  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    25 using System.Text;
     22using HeuristicLab.Common;
     23using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.ScheduleEncoding;
    2626using HeuristicLab.Operators;
     27using HeuristicLab.Parameters;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    28 using HeuristicLab.Core;
    29 using HeuristicLab.Common;
    30 using HeuristicLab.Optimization;
    31 using HeuristicLab.Data;
    32 using HeuristicLab.Parameters;
    33 using HeuristicLab.Encodings.SchedulingEncoding.Interfaces;
    34 using HeuristicLab.Encodings.SchedulingEncoding;
    3529
    36 namespace HeuristicLab.Problems.Scheduling.Evaluators {
     30namespace HeuristicLab.Problems.Scheduling {
    3731  [Item("Scheduling Evaluation Algorithm", "Represents a composition of a decoder and an evaluator for scheduling problems.")]
    3832  [StorableClass]
    39   public class SchedulingEvaluationAlgorithm : AlgorithmOperator, ISchedulingEvaluationAlgorithm {
     33  public class SchedulingEvaluationAlgorithm : AlgorithmOperator, IScheduleEvaluationAlgorithm {
    4034    [StorableConstructor]
    4135    protected SchedulingEvaluationAlgorithm(bool deserializing) : base(deserializing) { }
    4236    protected SchedulingEvaluationAlgorithm(SchedulingEvaluationAlgorithm original, Cloner cloner)
    4337      : base(original, cloner) {
    44         this.evaluator = cloner.Clone(original.evaluator);
     38      this.evaluator = cloner.Clone(original.evaluator);
    4539    }
    4640    public override IDeepCloneable Clone(Cloner cloner) {
     
    6054    }
    6155
    62     public void InitializeOperatorGraph<T>(SchedulingDecoder<T> decoder) where T: Item, ISchedulingEncoding{
     56    public void InitializeOperatorGraph<T>(ScheduleDecoder<T> decoder) where T : Item, IScheduleEncoding {
    6357      OperatorGraph.Operators.Clear();
    6458      OperatorGraph.InitialOperator = decoder;
     
    6862    public SchedulingEvaluationAlgorithm()
    6963      : base() {
    70         Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value aka fitness value of the solution."));
    71         evaluator = new Placeholder();
    72         evaluator.OperatorParameter.ActualName = "SolutionEvaluator";
     64      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value aka fitness value of the solution."));
     65      evaluator = new Placeholder();
     66      evaluator.OperatorParameter.ActualName = "SolutionEvaluator";
    7367    }
    7468
  • branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3/Evaluators/SchedulingEvaluator.cs

    r6364 r6406  
    2020#endregion
    2121
     22using HeuristicLab.Common;
     23using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.ScheduleEncoding;
     26using HeuristicLab.Operators;
     27using HeuristicLab.Parameters;
     28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2229
    2330
    24 using HeuristicLab.Core;
    25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Optimization;
    27 using HeuristicLab.Data;
    28 using HeuristicLab.Common;
    29 using HeuristicLab.Parameters;
    30 using System;
    31 using HeuristicLab.Operators;
    32 using HeuristicLab.Encodings.SchedulingEncoding.Interfaces;
    33 using HeuristicLab.Encodings.SchedulingEncoding;
    34 
    35 
    36 namespace HeuristicLab.Problems.Scheduling.Evaluators {
     31namespace HeuristicLab.Problems.Scheduling {
    3732  [Item("Scheduling Evaluator", "Represents a evaluator class for standard scheduling problems.")]
    3833  [StorableClass]
    39   public abstract class SchedulingEvaluator : SingleSuccessorOperator, ISchedulingEvaluator {
     34  public abstract class SchedulingEvaluator : SingleSuccessorOperator, IScheduleEvaluator {
    4035    [StorableConstructor]
    4136    protected SchedulingEvaluator(bool deserializing) : base(deserializing) { }
     
    4843    }
    4944    public ILookupParameter<DoubleValue> QualityParameter {
    50       get { 
     45      get {
    5146        if (Parameters.ContainsKey("Quality"))
    5247          return (ILookupParameter<DoubleValue>)Parameters["Quality"];
     
    5550      }
    5651    }
    57     public ILookupParameter<Schedule> DecodedSchedulingSolutionParameter {
    58       get { return (ILookupParameter<Schedule>)Parameters["DecodedSchedulingSolution"]; }
     52    public ILookupParameter<Schedule> ScheduleParameter {
     53      get { return (ILookupParameter<Schedule>)Parameters["Schedule"]; }
    5954    }
    6055
    61     public SchedulingEvaluator () : base () {
     56    public SchedulingEvaluator()
     57      : base() {
    6258      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value aka fitness value of the solution."));
    63       Parameters.Add(new LookupParameter<Schedule>("DecodedSchedulingSolution", "The decoded scheduling solution represented as generalized schedule."));
     59      Parameters.Add(new LookupParameter<Schedule>("Schedule", "The decoded scheduling solution represented as generalized schedule."));
    6460      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator."));
    6561    }
    6662
    6763    protected abstract DoubleValue evaluate(Schedule schedule);
    68    
     64
    6965    public override IOperation Apply() {
    70       Schedule decodedSchedulingSolution = DecodedSchedulingSolutionParameter.ActualValue;
    71       QualityParameter.ActualValue = evaluate(decodedSchedulingSolution);
     66      Schedule schedule = ScheduleParameter.ActualValue;
     67      QualityParameter.ActualValue = evaluate(schedule);
    7268      return base.Apply();
    7369    }
Note: See TracChangeset for help on using the changeset viewer.