Changeset 13449


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

#2521

  • Replaced JSMDecodingErrorPolicy and JSMForcingStrategy with EnumValues.
  • Removed obsolete views for the scheduling enums.
Location:
branches/ProblemRefactoring
Files:
4 deleted
4 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/HeuristicLab.Encodings.ScheduleEncoding-3.3.csproj

    r13443 r13449  
    118118    <Compile Include="JobSequenceMatrix\Decoder\JSMDecoder.cs" />
    119119    <Compile Include="JobSequenceMatrix\Decoder\JSMDecodingErrorPolicy.cs" />
    120     <Compile Include="JobSequenceMatrix\Decoder\JSMDecodingErrorPolicyTypes.cs" />
    121120    <Compile Include="JobSequenceMatrix\Decoder\JSMForcingStrategy.cs" />
    122     <Compile Include="JobSequenceMatrix\Decoder\JSMForcingStrategyTypes.cs" />
    123121    <Compile Include="PriorityRulesVector\Decoder\PRVDecoder.cs" />
    124122    <Compile Include="PermutationWithRepetition\Decoder\PWRDecoder.cs" />
  • 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
  • branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling.Views/3.3/HeuristicLab.Problems.Scheduling.Views-3.3.csproj

    r11623 r13449  
    116116  </ItemGroup>
    117117  <ItemGroup>
    118     <Compile Include="JSMForcingStrategyView.cs">
    119       <SubType>UserControl</SubType>
    120     </Compile>
    121     <Compile Include="JSMForcingStrategyView.Designer.cs">
    122       <DependentUpon>JSMForcingStrategyView.cs</DependentUpon>
    123     </Compile>
    124     <Compile Include="JobShopSchedulingProblemView.cs">
    125       <SubType>UserControl</SubType>
    126     </Compile>
     118    <Compile Include="JobShopSchedulingProblemView.cs" />
    127119    <Compile Include="JobShopSchedulingProblemView.Designer.cs">
    128120      <DependentUpon>JobShopSchedulingProblemView.cs</DependentUpon>
    129     </Compile>
    130     <Compile Include="JSMDecodingErrorPolicyView.cs">
    131       <SubType>UserControl</SubType>
    132     </Compile>
    133     <Compile Include="JSMDecodingErrorPolicyView.Designer.cs">
    134       <DependentUpon>JSMDecodingErrorPolicyView.cs</DependentUpon>
    135121    </Compile>
    136122    <Compile Include="Plugin.cs" />
  • branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/JobShopSchedulingProblem new.cs

    r13443 r13449  
    289289          }
    290290        }
    291         BestKnownSolution = JSMDecoder.DecodeSchedule(enc, jobData, JSMDecodingErrorPolicyTypes.RandomPolicy, JSMForcingStrategyTypes.SwapForcing);
     291        BestKnownSolution = JSMDecoder.DecodeSchedule(enc, jobData, JSMDecodingErrorPolicy.RandomPolicy, JSMForcingStrategy.SwapForcing);
    292292        //if (ScheduleEvaluator is MeanTardinessEvaluator)
    293293        //  BestKnownQuality = MeanTardinessEvaluator.GetMeanTardiness(BestKnownSolution, jobData);
Note: See TracChangeset for help on using the changeset viewer.