- Timestamp:
- 12/11/15 12:53:43 (9 years ago)
- Location:
- branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3
- Files:
-
- 2 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/HeuristicLab.Encodings.ScheduleEncoding-3.3.csproj
r13443 r13449 118 118 <Compile Include="JobSequenceMatrix\Decoder\JSMDecoder.cs" /> 119 119 <Compile Include="JobSequenceMatrix\Decoder\JSMDecodingErrorPolicy.cs" /> 120 <Compile Include="JobSequenceMatrix\Decoder\JSMDecodingErrorPolicyTypes.cs" />121 120 <Compile Include="JobSequenceMatrix\Decoder\JSMForcingStrategy.cs" /> 122 <Compile Include="JobSequenceMatrix\Decoder\JSMForcingStrategyTypes.cs" />123 121 <Compile Include="PriorityRulesVector\Decoder\PRVDecoder.cs" /> 124 122 <Compile Include="PermutationWithRepetition\Decoder\PWRDecoder.cs" /> -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder/JSMDecoder.cs
r13443 r13449 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Encodings.PermutationEncoding; 28 29 using HeuristicLab.Parameters; … … 35 36 public class JSMDecoder : ScheduleDecoder { 36 37 37 public I ValueParameter<JSMDecodingErrorPolicy> DecodingErrorPolicyParameter {38 get { return (I ValueParameter<JSMDecodingErrorPolicy>)Parameters["DecodingErrorPolicy"]; }38 public IFixedValueParameter<EnumValue<JSMDecodingErrorPolicy>> DecodingErrorPolicyParameter { 39 get { return (IFixedValueParameter<EnumValue<JSMDecodingErrorPolicy>>)Parameters["DecodingErrorPolicy"]; } 39 40 } 40 public I ValueParameter<JSMForcingStrategy> ForcingStrategyParameter {41 get { return (I ValueParameter<JSMForcingStrategy>)Parameters["ForcingStrategy"]; }41 public IFixedValueParameter<EnumValue<JSMForcingStrategy>> ForcingStrategyParameter { 42 get { return (IFixedValueParameter<EnumValue<JSMForcingStrategy>>)Parameters["ForcingStrategy"]; } 42 43 } 43 44 44 private JSMDecodingErrorPolicy TypesDecodingErrorPolicy {45 private JSMDecodingErrorPolicy DecodingErrorPolicy { 45 46 get { return DecodingErrorPolicyParameter.Value.Value; } 46 47 } 47 48 48 private JSMForcingStrategy TypesForcingStrategy {49 private JSMForcingStrategy ForcingStrategy { 49 50 get { return ForcingStrategyParameter.Value.Value; } 50 51 } … … 59 60 public JSMDecoder() 60 61 : 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))); 63 64 } 64 65 65 private static Task SelectTaskFromConflictSet(JSMEncoding solution, JSMDecodingErrorPolicy Types decodingErrorPolicy, JSMForcingStrategyTypesforcingStrategy, 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) { 66 67 if (conflictSet.Count == 1) 67 68 return conflictSet[0]; … … 89 90 } 90 91 91 private static Task ApplyDecodingErrorPolicy(JSMDecodingErrorPolicy TypesdecodingErrorPolicy, ItemList<Task> conflictSet, Permutation resource, int progress, IRandom random) {92 if (decodingErrorPolicy == JSMDecodingErrorPolicy Types.RandomPolicy) {92 private static Task ApplyDecodingErrorPolicy(JSMDecodingErrorPolicy decodingErrorPolicy, ItemList<Task> conflictSet, Permutation resource, int progress, IRandom random) { 93 if (decodingErrorPolicy == JSMDecodingErrorPolicy.RandomPolicy) { 93 94 //Random 94 95 return conflictSet[random.Next(conflictSet.Count - 1)]; … … 107 108 } 108 109 109 private static void ApplyForcingStrategy(JSMForcingStrategy TypesforcingStrategy, 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) { 110 111 var jsm = solution.JobSequenceMatrix; 111 if (forcingStrategy == JSMForcingStrategy Types.SwapForcing) {112 if (forcingStrategy == JSMForcingStrategy.SwapForcing) { 112 113 //SwapForcing 113 114 jsm[conflictedResource][newResolutionIndex] = jsm[conflictedResource][progressOnResource]; 114 115 jsm[conflictedResource][progressOnResource] = newResolution; 115 } else if (forcingStrategy == JSMForcingStrategy Types.ShiftForcing) {116 } else if (forcingStrategy == JSMForcingStrategy.ShiftForcing) { 116 117 //ShiftForcing 117 118 List<int> asList = jsm[conflictedResource].ToList<int>(); … … 135 136 } 136 137 137 public static Schedule DecodeSchedule(JSMEncoding solution, ItemList<Job> jobData, JSMDecodingErrorPolicy Types decodingErrorPolicy, JSMForcingStrategyTypesforcingStrategy) {138 public static Schedule DecodeSchedule(JSMEncoding solution, ItemList<Job> jobData, JSMDecodingErrorPolicy decodingErrorPolicy, JSMForcingStrategy forcingStrategy) { 138 139 var random = new FastRandom(solution.RandomSeed); 139 140 var jobs = (ItemList<Job>)jobData.Clone(); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder/JSMDecodingErrorPolicy.cs
r13448 r13449 21 21 22 22 namespace HeuristicLab.Encodings.ScheduleEncoding { 23 public enum JSMDecodingErrorPolicy Types{23 public enum JSMDecodingErrorPolicy { 24 24 RandomPolicy, 25 25 GuidedPolicy -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder/JSMForcingStrategy.cs
r13448 r13449 21 21 22 22 namespace HeuristicLab.Encodings.ScheduleEncoding { 23 public enum JSMForcingStrategy Types{23 public enum JSMForcingStrategy { 24 24 ShiftForcing, 25 25 SwapForcing
Note: See TracChangeset
for help on using the changeset viewer.