Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/11/15 12:53:43 (9 years ago)
Author:
pfleck
Message:

#2521

  • Replaced JSMDecodingErrorPolicy and JSMForcingStrategy with EnumValues.
  • Removed obsolete views for the scheduling enums.
Location:
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder
Files:
1 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder/JSMDecoder.cs

    r13443 r13449  
    2525using HeuristicLab.Common;
    2626using HeuristicLab.Core;
     27using HeuristicLab.Data;
    2728using HeuristicLab.Encodings.PermutationEncoding;
    2829using HeuristicLab.Parameters;
     
    3536  public class JSMDecoder : ScheduleDecoder {
    3637
    37     public IValueParameter<JSMDecodingErrorPolicy> DecodingErrorPolicyParameter {
    38       get { return (IValueParameter<JSMDecodingErrorPolicy>)Parameters["DecodingErrorPolicy"]; }
     38    public IFixedValueParameter<EnumValue<JSMDecodingErrorPolicy>> DecodingErrorPolicyParameter {
     39      get { return (IFixedValueParameter<EnumValue<JSMDecodingErrorPolicy>>)Parameters["DecodingErrorPolicy"]; }
    3940    }
    40     public IValueParameter<JSMForcingStrategy> ForcingStrategyParameter {
    41       get { return (IValueParameter<JSMForcingStrategy>)Parameters["ForcingStrategy"]; }
     41    public IFixedValueParameter<EnumValue<JSMForcingStrategy>> ForcingStrategyParameter {
     42      get { return (IFixedValueParameter<EnumValue<JSMForcingStrategy>>)Parameters["ForcingStrategy"]; }
    4243    }
    4344
    44     private JSMDecodingErrorPolicyTypes DecodingErrorPolicy {
     45    private JSMDecodingErrorPolicy DecodingErrorPolicy {
    4546      get { return DecodingErrorPolicyParameter.Value.Value; }
    4647    }
    4748
    48     private JSMForcingStrategyTypes ForcingStrategy {
     49    private JSMForcingStrategy ForcingStrategy {
    4950      get { return ForcingStrategyParameter.Value.Value; }
    5051    }
     
    5960    public JSMDecoder()
    6061      : base() {
    61       Parameters.Add(new ValueParameter<JSMDecodingErrorPolicy>("DecodingErrorPolicy", "Specify the policy that should be used to handle decoding errors.", new JSMDecodingErrorPolicy(JSMDecodingErrorPolicyTypes.RandomPolicy)));
    62       Parameters.Add(new ValueParameter<JSMForcingStrategy>("ForcingStrategy", "Specifies a forcing strategy.", new JSMForcingStrategy(JSMForcingStrategyTypes.SwapForcing)));
     62      Parameters.Add(new FixedValueParameter<EnumValue<JSMDecodingErrorPolicy>>("DecodingErrorPolicy", "Specify the policy that should be used to handle decoding errors.", new EnumValue<JSMDecodingErrorPolicy>(JSMDecodingErrorPolicy.RandomPolicy)));
     63      Parameters.Add(new FixedValueParameter<EnumValue<JSMForcingStrategy>>("ForcingStrategy", "Specifies a forcing strategy.", new EnumValue<JSMForcingStrategy>(JSMForcingStrategy.SwapForcing)));
    6364    }
    6465
    65     private static Task SelectTaskFromConflictSet(JSMEncoding solution, JSMDecodingErrorPolicyTypes decodingErrorPolicy, JSMForcingStrategyTypes forcingStrategy, int conflictedResourceNr, int progressOnConflictedResource, ItemList<Task> conflictSet, IRandom random) {
     66    private static Task SelectTaskFromConflictSet(JSMEncoding solution, JSMDecodingErrorPolicy decodingErrorPolicy, JSMForcingStrategy forcingStrategy, int conflictedResourceNr, int progressOnConflictedResource, ItemList<Task> conflictSet, IRandom random) {
    6667      if (conflictSet.Count == 1)
    6768        return conflictSet[0];
     
    8990    }
    9091
    91     private static Task ApplyDecodingErrorPolicy(JSMDecodingErrorPolicyTypes decodingErrorPolicy, ItemList<Task> conflictSet, Permutation resource, int progress, IRandom random) {
    92       if (decodingErrorPolicy == JSMDecodingErrorPolicyTypes.RandomPolicy) {
     92    private static Task ApplyDecodingErrorPolicy(JSMDecodingErrorPolicy decodingErrorPolicy, ItemList<Task> conflictSet, Permutation resource, int progress, IRandom random) {
     93      if (decodingErrorPolicy == JSMDecodingErrorPolicy.RandomPolicy) {
    9394        //Random
    9495        return conflictSet[random.Next(conflictSet.Count - 1)];
     
    107108    }
    108109
    109     private static void ApplyForcingStrategy(JSMForcingStrategyTypes forcingStrategy, JSMEncoding solution, int conflictedResource, int newResolutionIndex, int progressOnResource, int newResolution) {
     110    private static void ApplyForcingStrategy(JSMForcingStrategy forcingStrategy, JSMEncoding solution, int conflictedResource, int newResolutionIndex, int progressOnResource, int newResolution) {
    110111      var jsm = solution.JobSequenceMatrix;
    111       if (forcingStrategy == JSMForcingStrategyTypes.SwapForcing) {
     112      if (forcingStrategy == JSMForcingStrategy.SwapForcing) {
    112113        //SwapForcing
    113114        jsm[conflictedResource][newResolutionIndex] = jsm[conflictedResource][progressOnResource];
    114115        jsm[conflictedResource][progressOnResource] = newResolution;
    115       } else if (forcingStrategy == JSMForcingStrategyTypes.ShiftForcing) {
     116      } else if (forcingStrategy == JSMForcingStrategy.ShiftForcing) {
    116117        //ShiftForcing
    117118        List<int> asList = jsm[conflictedResource].ToList<int>();
     
    135136    }
    136137
    137     public static Schedule DecodeSchedule(JSMEncoding solution, ItemList<Job> jobData, JSMDecodingErrorPolicyTypes decodingErrorPolicy, JSMForcingStrategyTypes forcingStrategy) {
     138    public static Schedule DecodeSchedule(JSMEncoding solution, ItemList<Job> jobData, JSMDecodingErrorPolicy decodingErrorPolicy, JSMForcingStrategy forcingStrategy) {
    138139      var random = new FastRandom(solution.RandomSeed);
    139140      var jobs = (ItemList<Job>)jobData.Clone();
  • branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder/JSMDecodingErrorPolicy.cs

    r13448 r13449  
    2121
    2222namespace HeuristicLab.Encodings.ScheduleEncoding {
    23   public enum JSMDecodingErrorPolicyTypes {
     23  public enum JSMDecodingErrorPolicy {
    2424    RandomPolicy,
    2525    GuidedPolicy
  • branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder/JSMForcingStrategy.cs

    r13448 r13449  
    2121
    2222namespace HeuristicLab.Encodings.ScheduleEncoding {
    23   public enum JSMForcingStrategyTypes {
     23  public enum JSMForcingStrategy {
    2424    ShiftForcing,
    2525    SwapForcing
Note: See TracChangeset for help on using the changeset viewer.