- Timestamp:
- 02/28/20 16:23:01 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3
- Files:
-
- 4 added
- 4 deleted
- 41 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/HeuristicLab.Encodings.ScheduleEncoding-3.3.csproj
r16723 r17461 128 128 <Compile Include="Interfaces\IScheduleCreator.cs" /> 129 129 <Compile Include="Interfaces\IScheduleCrossover.cs" /> 130 <Compile Include="Interfaces\ISchedule .cs" />130 <Compile Include="Interfaces\IScheduleSolution.cs" /> 131 131 <Compile Include="Interfaces\IScheduleDecoder.cs" /> 132 132 <Compile Include="Interfaces\IScheduleEncoding.cs" /> … … 138 138 <Compile Include="JobSequenceMatrix\Crossovers\JSMSXXCrossover.cs" /> 139 139 <Compile Include="JobSequenceMatrix\JobSequenceMatrixEncoding.cs" /> 140 <Compile Include="JobSequenceMatrix\JSM Encoding.cs" />140 <Compile Include="JobSequenceMatrix\JSM.cs" /> 141 141 <Compile Include="JobSequenceMatrix\JSMRandomCreator.cs" /> 142 142 <Compile Include="JobSequenceMatrix\Manipulators\JSMManipulator.cs" /> … … 149 149 <Compile Include="PermutationWithRepetition\Manipulators\PWRInsertionManipulator.cs" /> 150 150 <Compile Include="PermutationWithRepetition\PermutationWithRepetitionEncoding.cs" /> 151 <Compile Include="PermutationWithRepetition\PWR Encoding.cs" />151 <Compile Include="PermutationWithRepetition\PWR.cs" /> 152 152 <Compile Include="PermutationWithRepetition\PWRRandomCreator.cs" /> 153 153 <Compile Include="Plugin.cs" /> … … 158 158 <Compile Include="PriorityRulesVector\Manipulators\PRVUniformOnePositionManipulator.cs" /> 159 159 <Compile Include="PriorityRulesVector\PriorityRulesVectorEncoding.cs" /> 160 <Compile Include="PriorityRulesVector\PRV Encoding.cs" />160 <Compile Include="PriorityRulesVector\PRV.cs" /> 161 161 <Compile Include="PriorityRulesVector\PRVRandomCreator.cs" /> 162 162 <Compile Include="Properties\AssemblyInfo.cs" /> -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleCreator.cs
r17226 r17461 28 28 [StorableType("d6738639-c5fc-46af-8997-7527ea718759")] 29 29 public interface IScheduleCreator<TSchedule> : ISolutionCreator<TSchedule>, IScheduleOperator 30 where TSchedule : class, ISchedule{30 where TSchedule : class, IScheduleSolution { 31 31 ILookupParameter<TSchedule> ScheduleParameter { get; } 32 32 IValueLookupParameter<IntValue> JobsParameter { get; } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleCrossover.cs
r17226 r17461 27 27 [StorableType("809a6136-3a7a-4389-9119-2bb48f6d650a")] 28 28 public interface IScheduleCrossover : ICrossover, IScheduleOperator { 29 ILookupParameter<ISchedule > ChildParameter { get; }30 IScopeTreeLookupParameter<ISchedule > ParentsParameter { get; }29 ILookupParameter<IScheduleSolution> ChildParameter { get; } 30 IScopeTreeLookupParameter<IScheduleSolution> ParentsParameter { get; } 31 31 } 32 32 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleDecoder.cs
r16723 r17461 26 26 [StorableType("010C752F-0F5E-4B93-8695-8DD74903DBE7")] 27 27 public interface IScheduleDecoder : IScheduleOperator { 28 ILookupParameter<ISchedule > ScheduleEncodingParameter { get; }28 ILookupParameter<IScheduleSolution> ScheduleEncodingParameter { get; } 29 29 ILookupParameter<Schedule> ScheduleParameter { get; } 30 30 ILookupParameter<ItemList<Job>> JobDataParameter { get; } 31 31 32 Schedule DecodeSchedule(ISchedule solution, ItemList<Job> jobData);32 Schedule DecodeSchedule(IScheduleSolution solution, ItemList<Job> jobData); 33 33 } 34 34 35 35 public interface IScheduleDecoder<TSchedule> : IScheduleDecoder 36 where TSchedule : class, ISchedule {36 where TSchedule : class, IScheduleSolution { 37 37 Schedule DecodeSchedule(TSchedule solution, ItemList<Job> jobData); 38 38 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleEncoding.cs
r17226 r17461 22 22 #endregion 23 23 24 using HEAL.Attic; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; 26 27 using HeuristicLab.Optimization; 27 using HEAL.Attic;28 28 29 29 namespace HeuristicLab.Encodings.ScheduleEncoding { 30 30 [StorableType("09b9d24c-2576-495a-b06c-338d095cba0d")] 31 public interface IScheduleEncoding : IEncoding<ISchedule > {32 I FixedValueParameter<ItemList<Job>> JobDataParameter { get; set; }31 public interface IScheduleEncoding : IEncoding<IScheduleSolution> { 32 IValueParameter<ItemList<Job>> JobDataParameter { get; set; } 33 33 IFixedValueParameter<IntValue> JobsParameter { get; set; } 34 34 IFixedValueParameter<IntValue> ResourcesParameter { get; set; } … … 39 39 40 40 41 Schedule Decode(ISchedule schedule, ItemList<Job> jobData);41 Schedule Decode(IScheduleSolution schedule, ItemList<Job> jobData); 42 42 } 43 43 44 44 public interface IScheduleEncoding<TSchedule> : IEncoding<TSchedule> 45 where TSchedule : class, ISchedule {45 where TSchedule : class, IScheduleSolution { 46 46 47 47 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleManipulator.cs
r17226 r17461 27 27 [StorableType("aa89fd6f-db49-457d-abc9-5600aa8f24e5")] 28 28 public interface IScheduleManipulator : IManipulator, IScheduleOperator { 29 ILookupParameter<ISchedule > ScheduleParameter { get; }29 ILookupParameter<IScheduleSolution> ScheduleParameter { get; } 30 30 } 31 31 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMCrossover.cs
r17226 r17461 35 35 public JSMCrossover() : base() { } 36 36 37 public abstract JSM Encoding Cross(IRandom random, JSMEncoding parent1, JSMEncodingparent2);37 public abstract JSM Cross(IRandom random, JSM parent1, JSM parent2); 38 38 39 39 public override IOperation InstrumentedApply() { … … 41 41 42 42 ChildParameter.ActualValue = 43 Cross(RandomParameter.ActualValue, parents[0] as JSM Encoding, parents[1] as JSMEncoding);43 Cross(RandomParameter.ActualValue, parents[0] as JSM, parents[1] as JSM); 44 44 45 45 return base.InstrumentedApply(); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMJOXCrossover.cs
r17226 r17461 40 40 } 41 41 42 public static JSM Encoding Apply(IRandom random, JSMEncoding p1, JSMEncodingp2) {43 var result = new JSM Encoding(random.Next());42 public static JSM Apply(IRandom random, JSM p1, JSM p2) { 43 var result = new JSM(random.Next()); 44 44 45 45 int nrOfResources = p1.JobSequenceMatrix.Count; … … 53 53 54 54 bool dominantParent = random.Next(2) == 1; 55 JSM Encodingparent1 = dominantParent ? p1 : p2;56 JSM Encodingparent2 = dominantParent ? p2 : p1;55 JSM parent1 = dominantParent ? p1 : p2; 56 JSM parent2 = dominantParent ? p2 : p1; 57 57 58 58 //Fill childmatrix with values … … 75 75 } 76 76 77 public override JSM Encoding Cross(IRandom random, JSMEncoding parent1, JSMEncodingparent2) {77 public override JSM Cross(IRandom random, JSM parent1, JSM parent2) { 78 78 return Apply(random, parent1, parent2); 79 79 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMOXCrossover.cs
r17226 r17461 38 38 } 39 39 40 public static JSM Encoding Apply(IRandom random, JSMEncoding parent1, JSMEncodingparent2) {41 var result = new JSM Encoding(random.Next());40 public static JSM Apply(IRandom random, JSM parent1, JSM parent2) { 41 var result = new JSM(random.Next()); 42 42 43 43 for (int i = 0; i < parent1.JobSequenceMatrix.Count; i++) { … … 50 50 } 51 51 52 public override JSM Encoding Cross(IRandom random, JSMEncoding parent1, JSMEncodingparent2) {52 public override JSM Cross(IRandom random, JSM parent1, JSM parent2) { 53 53 return Apply(random, parent1, parent2); 54 54 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMSXXCrossover.cs
r17226 r17461 39 39 } 40 40 41 public static JSM Encoding Apply(IRandom random, JSMEncoding parent1, JSMEncodingparent2) {42 var result = new JSM Encoding(random.Next());41 public static JSM Apply(IRandom random, JSM parent1, JSM parent2) { 42 var result = new JSM(random.Next()); 43 43 int subSequenceLength = random.Next(parent1.JobSequenceMatrix[0].Length); 44 44 for (int i = 0; i < parent1.JobSequenceMatrix.Count; i++) { … … 91 91 } 92 92 93 public override JSM Encoding Cross(IRandom random, JSMEncoding parent1, JSMEncodingparent2) {93 public override JSM Cross(IRandom random, JSM parent1, JSM parent2) { 94 94 return Apply(random, parent1, parent2); 95 95 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder/JSMDecoder.cs
r16725 r17461 34 34 [Item("JobSequenceMatrixDecoder", "Applies the GifflerThompson algorithm to create an active schedule from a JobSequence Matrix.")] 35 35 [StorableType("BBE354C2-7599-43CC-ACDC-F8F0F65BE3F5")] 36 public class JSMDecoder : ScheduleDecoder<JSM Encoding>{36 public class JSMDecoder : ScheduleDecoder<JSM>, IJSMOperator { 37 37 38 38 public IFixedValueParameter<EnumValue<JSMDecodingErrorPolicy>> DecodingErrorPolicyParameter { … … 64 64 } 65 65 66 private static Task SelectTaskFromConflictSet(JSM Encodingsolution, JSMDecodingErrorPolicy decodingErrorPolicy, JSMForcingStrategy forcingStrategy, int conflictedResourceNr, int progressOnConflictedResource, ItemList<Task> conflictSet, IRandom random) {66 private static Task SelectTaskFromConflictSet(JSM solution, JSMDecodingErrorPolicy decodingErrorPolicy, JSMForcingStrategy forcingStrategy, int conflictedResourceNr, int progressOnConflictedResource, ItemList<Task> conflictSet, IRandom random) { 67 67 if (conflictSet.Count == 1) 68 68 return conflictSet[0]; … … 108 108 } 109 109 110 private static void ApplyForcingStrategy(JSMForcingStrategy forcingStrategy, JSM Encodingsolution, int conflictedResource, int newResolutionIndex, int progressOnResource, int newResolution) {110 private static void ApplyForcingStrategy(JSMForcingStrategy forcingStrategy, JSM solution, int conflictedResource, int newResolutionIndex, int progressOnResource, int newResolution) { 111 111 var jsm = solution.JobSequenceMatrix; 112 112 if (forcingStrategy == JSMForcingStrategy.SwapForcing) { … … 130 130 } 131 131 132 public override Schedule DecodeSchedule(JSM Encodingencoding, ItemList<Job> jobData) {132 public override Schedule DecodeSchedule(JSM encoding, ItemList<Job> jobData) { 133 133 return Decode(encoding, jobData, DecodingErrorPolicy, ForcingStrategy); 134 134 } 135 135 136 public static Schedule Decode(JSM Encodingsolution, ItemList<Job> jobData, JSMDecodingErrorPolicy decodingErrorPolicy, JSMForcingStrategy forcingStrategy) {136 public static Schedule Decode(JSM solution, ItemList<Job> jobData, JSMDecodingErrorPolicy decodingErrorPolicy, JSMForcingStrategy forcingStrategy) { 137 137 var random = new FastRandom(solution.RandomSeed); 138 138 var jobs = (ItemList<Job>)jobData.Clone(); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JSMRandomCreator.cs
r17226 r17461 30 30 [Item("JobSequenceMatrixCreator", "Creator class used to create Job Sequence Matrix solutions for standard JobShop scheduling problems.")] 31 31 [StorableType("F8053C69-31C2-4E05-8FA0-5AED15FAF804")] 32 public class JSMRandomCreator : ScheduleCreator<JSM Encoding>, IStochasticOperator {32 public class JSMRandomCreator : ScheduleCreator<JSM>, IStochasticOperator { 33 33 34 34 public ILookupParameter<IRandom> RandomParameter { … … 48 48 } 49 49 50 public static JSM EncodingApply(int jobs, int resources, IRandom random) {51 var solution = new JSM Encoding(random.Next());50 public static JSM Apply(int jobs, int resources, IRandom random) { 51 var solution = new JSM(random.Next()); 52 52 for (int i = 0; i < resources; i++) { 53 53 solution.JobSequenceMatrix.Add(new Permutation(PermutationTypes.Absolute, jobs, random)); … … 56 56 } 57 57 58 protected override JSM EncodingCreateSolution() {58 protected override JSM CreateSolution() { 59 59 return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue); 60 60 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JobSequenceMatrixEncoding.cs
r16725 r17461 31 31 32 32 namespace HeuristicLab.Encodings.ScheduleEncoding { 33 [Item("Job Sequence Matrix Encoding", "Represents an encoding of schedules in form of a job sequence per resource.")] 33 34 [StorableType("9C090369-0214-42E6-8C3E-369751F5A9E1")] 34 public sealed class JobSequenceMatrixEncoding : ScheduleEncoding<JSM Encoding> {35 public sealed class JobSequenceMatrixEncoding : ScheduleEncoding<JSM> { 35 36 [StorableConstructor] 36 37 private JobSequenceMatrixEncoding(StorableConstructorFlag _) : base(_) { } … … 41 42 42 43 public JobSequenceMatrixEncoding() 43 : base( ) {44 : base("JSM") { 44 45 SolutionCreator = new JSMRandomCreator(); 45 46 Decoder = new JSMDecoder(); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMManipulator.cs
r17226 r17461 34 34 public JSMManipulator() : base() { } 35 35 36 protected abstract void Manipulate(IRandom random, ISchedule individual);36 protected abstract void Manipulate(IRandom random, IScheduleSolution individual); 37 37 38 38 public override IOperation InstrumentedApply() { 39 var solution = ScheduleParameter.ActualValue as JSM Encoding;39 var solution = ScheduleParameter.ActualValue as JSM; 40 40 if (solution == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type JSMEncoding."); 41 41 Manipulate(RandomParameter.ActualValue, solution); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMShiftChangeManipulator.cs
r17226 r17461 42 42 } 43 43 44 public static void Apply(IRandom random, JSM Encodingindividual) {44 public static void Apply(IRandom random, JSM individual) { 45 45 int nrOfJobs = individual.JobSequenceMatrix[0].Length; 46 46 int jobIndex = random.Next(nrOfJobs); … … 63 63 } 64 64 65 protected override void Manipulate(IRandom random, ISchedule encoding) {66 var solution = encoding as JSM Encoding;65 protected override void Manipulate(IRandom random, IScheduleSolution encoding) { 66 var solution = encoding as JSM; 67 67 if (solution == null) throw new InvalidOperationException("Encoding is not of type JSMEncoding"); 68 68 Apply(random, solution); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMSwapManipulator.cs
r17226 r17461 40 40 } 41 41 42 public static void Apply(IRandom random, JSM Encodingindividual) {42 public static void Apply(IRandom random, JSM individual) { 43 43 int resourceIndex = random.Next(individual.JobSequenceMatrix.Count); 44 44 Permutation p = individual.JobSequenceMatrix[resourceIndex]; … … 50 50 } 51 51 52 protected override void Manipulate(IRandom random, ISchedule individual) {53 var solution = individual as JSM Encoding;52 protected override void Manipulate(IRandom random, IScheduleSolution individual) { 53 var solution = individual as JSM; 54 54 if (solution == null) throw new InvalidOperationException("Encoding is not of type JSMEncoding"); 55 55 Apply(random, solution); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Crossovers/PWRCrossover.cs
r17226 r17461 38 38 } 39 39 40 public abstract PWR Encoding Cross(IRandom random, PWREncoding parent1, PWREncodingparent2);40 public abstract PWR Cross(IRandom random, PWR parent1, PWR parent2); 41 41 42 42 public override IOperation InstrumentedApply() { … … 44 44 45 45 ChildParameter.ActualValue = 46 Cross(RandomParameter.ActualValue, parents[0] as PWR Encoding, parents[1] as PWREncoding);46 Cross(RandomParameter.ActualValue, parents[0] as PWR, parents[1] as PWR); 47 47 48 48 return base.InstrumentedApply(); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Crossovers/PWRGOXCrossover.cs
r17226 r17461 55 55 } 56 56 57 public static PWR Encoding Apply(IRandom random, PWREncoding parent1, PWREncodingparent2) {58 var result = new PWR Encoding();57 public static PWR Apply(IRandom random, PWR parent1, PWR parent2) { 58 var result = new PWR(); 59 59 60 60 var p1 = ((IntegerVector)(parent1.PermutationWithRepetition.Clone())).ToList(); … … 87 87 } 88 88 89 public override PWR Encoding Cross(IRandom random, PWREncoding parent1, PWREncodingparent2) {89 public override PWR Cross(IRandom random, PWR parent1, PWR parent2) { 90 90 return Apply(random, parent1, parent2); 91 91 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Crossovers/PWRPPXCrossover.cs
r17226 r17461 41 41 } 42 42 43 public static PWR Encoding Apply(IRandom random, PWREncoding parent1, PWREncodingparent2) {44 var result = new PWR Encoding();43 public static PWR Apply(IRandom random, PWR parent1, PWR parent2) { 44 var result = new PWR(); 45 45 var p1 = ((IntegerVector)(parent1.PermutationWithRepetition.Clone())).ToList(); 46 46 var p2 = ((IntegerVector)(parent2.PermutationWithRepetition.Clone())).ToList(); … … 69 69 } 70 70 71 public override PWR Encoding Cross(IRandom random, PWREncoding parent1, PWREncodingparent2) {71 public override PWR Cross(IRandom random, PWR parent1, PWR parent2) { 72 72 return Apply(random, parent1, parent2); 73 73 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Decoder/PWRDecoder.cs
r16725 r17461 27 27 [Item("PWRDecoder", "An item used to convert a PWR-individual into a generalized schedule.")] 28 28 [StorableType("60D171BE-9704-40E1-9C63-0E56D95403CD")] 29 public class PWRDecoder : ScheduleDecoder<PWR Encoding>{29 public class PWRDecoder : ScheduleDecoder<PWR>, IPWROperator { 30 30 [StorableConstructor] 31 31 protected PWRDecoder(StorableConstructorFlag _) : base(_) { } … … 37 37 } 38 38 39 public override Schedule DecodeSchedule(PWR Encodingsolution, ItemList<Job> jobData) {39 public override Schedule DecodeSchedule(PWR solution, ItemList<Job> jobData) { 40 40 return Decode(solution, jobData); 41 41 } 42 42 43 public static Schedule Decode(PWR Encodingsolution, ItemList<Job> jobData) {43 public static Schedule Decode(PWR solution, ItemList<Job> jobData) { 44 44 var jobs = (ItemList<Job>)jobData.Clone(); 45 45 var resultingSchedule = new Schedule(jobs[0].Tasks.Count); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Manipulators/PWRInsertionManipulator.cs
r17226 r17461 40 40 } 41 41 42 public static void Apply(IRandom random, PWR Encodingindividual) {42 public static void Apply(IRandom random, PWR individual) { 43 43 int cutIndex = random.Next(individual.PermutationWithRepetition.Length); 44 44 int insertIndex = random.Next(individual.PermutationWithRepetition.Length); … … 55 55 } 56 56 57 protected override void Manipulate(IRandom random, PWR Encodingindividual) {57 protected override void Manipulate(IRandom random, PWR individual) { 58 58 Apply(random, individual); 59 59 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Manipulators/PWRManipulator.cs
r17226 r17461 35 35 public PWRManipulator() : base() { } 36 36 37 protected abstract void Manipulate(IRandom random, PWR Encodingindividual);37 protected abstract void Manipulate(IRandom random, PWR individual); 38 38 39 39 public override IOperation InstrumentedApply() { 40 var solution = ScheduleParameter.ActualValue as PWR Encoding;40 var solution = ScheduleParameter.ActualValue as PWR; 41 41 if (solution == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type PWREncoding."); 42 42 Manipulate(RandomParameter.ActualValue, solution); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWRRandomCreator.cs
r17226 r17461 29 29 [Item("PermutationWithRepetitionRandomCreator", "Creates PWR-individuals at random.")] 30 30 [StorableType("6E753916-C0FD-4585-B6A6-47FD66ED098F")] 31 public class PWRRandomCreator : ScheduleCreator<PWR Encoding>, IStochasticOperator {31 public class PWRRandomCreator : ScheduleCreator<PWR>, IStochasticOperator { 32 32 33 33 public ILookupParameter<IRandom> RandomParameter { … … 47 47 } 48 48 49 public static PWR EncodingApply(int jobs, int resources, IRandom random) {50 return new PWR Encoding(jobs, resources, random);49 public static PWR Apply(int jobs, int resources, IRandom random) { 50 return new PWR(jobs, resources, random); 51 51 } 52 52 53 protected override PWR EncodingCreateSolution() {53 protected override PWR CreateSolution() { 54 54 return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue); 55 55 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PermutationWithRepetitionEncoding.cs
r16725 r17461 32 32 namespace HeuristicLab.Encodings.ScheduleEncoding { 33 33 [StorableType("468EF506-0749-469B-B9B9-36655AA0178D")] 34 public sealed class PermutationWithRepetitionEncoding : ScheduleEncoding<PWR Encoding> {34 public sealed class PermutationWithRepetitionEncoding : ScheduleEncoding<PWR> { 35 35 [StorableConstructor] 36 36 private PermutationWithRepetitionEncoding(StorableConstructorFlag _) : base(_) { } … … 41 41 42 42 public PermutationWithRepetitionEncoding() 43 : base( ) {43 : base("PWR") { 44 44 SolutionCreator = new PWRRandomCreator(); 45 45 Decoder = new PWRDecoder(); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVCrossover.cs
r17226 r17461 34 34 public PRVCrossover() : base() { } 35 35 36 public abstract PRV Encoding Cross(IRandom random, PRVEncoding parent1, PRVEncodingparent2);36 public abstract PRV Cross(IRandom random, PRV parent1, PRV parent2); 37 37 38 38 public override IOperation InstrumentedApply() { 39 39 var parents = ParentsParameter.ActualValue; 40 40 ChildParameter.ActualValue = 41 Cross(RandomParameter.ActualValue, parents[0] as PRV Encoding, parents[1] as PRVEncoding);41 Cross(RandomParameter.ActualValue, parents[0] as PRV, parents[1] as PRV); 42 42 return base.InstrumentedApply(); 43 43 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVDiscreteCrossover.cs
r17226 r17461 39 39 } 40 40 41 public static PRV Encoding Apply(IRandom random, PRVEncoding parent1, PRVEncodingparent2) {41 public static PRV Apply(IRandom random, PRV parent1, PRV parent2) { 42 42 var randomSeed = random.Next(); 43 43 var integerVector = DiscreteCrossover.Apply(random, new ItemArray<IntegerVector>(new[] { parent1.PriorityRulesVector, parent2.PriorityRulesVector })); 44 return new PRV Encoding(integerVector, randomSeed);44 return new PRV(integerVector, randomSeed); 45 45 } 46 46 47 public override PRV Encoding Cross(IRandom random, PRVEncoding parent1, PRVEncodingparent2) {47 public override PRV Cross(IRandom random, PRV parent1, PRV parent2) { 48 48 return Apply(random, parent1, parent2); 49 49 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVSinglePointCrossover.cs
r17226 r17461 39 39 } 40 40 41 public static PRV Encoding Apply(IRandom random, PRVEncoding parent1, PRVEncodingparent2) {41 public static PRV Apply(IRandom random, PRV parent1, PRV parent2) { 42 42 var randomSeed = random.Next(); 43 43 var integerVector = SinglePointCrossover.Apply(random, parent1.PriorityRulesVector, parent2.PriorityRulesVector); 44 return new PRV Encoding(integerVector, randomSeed);44 return new PRV(integerVector, randomSeed); 45 45 } 46 46 47 public override PRV Encoding Cross(IRandom random, PRVEncoding parent1, PRVEncodingparent2) {47 public override PRV Cross(IRandom random, PRV parent1, PRV parent2) { 48 48 return Apply(random, parent1, parent2); 49 49 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Decoder/PRVDecoder.cs
r16725 r17461 29 29 [Item("JobSequencingMatrixDecoder", "Applies the GifflerThompson algorithm to create an active schedule from a JobSequencing Matrix.")] 30 30 [StorableType("2D059957-AC7C-4B33-BADE-96706AEBAF29")] 31 public class PRVDecoder : ScheduleDecoder<PRV Encoding>{31 public class PRVDecoder : ScheduleDecoder<PRV>, IPRVOperator { 32 32 #region Priority Rules 33 33 //smallest number of remaining tasks … … 187 187 } 188 188 189 public override Schedule DecodeSchedule(PRV Encodingencoding, ItemList<Job> jobData) {189 public override Schedule DecodeSchedule(PRV encoding, ItemList<Job> jobData) { 190 190 return Decode(encoding, jobData); 191 191 } 192 192 193 public static Schedule Decode(PRV Encodingsolution, ItemList<Job> jobData) {193 public static Schedule Decode(PRV solution, ItemList<Job> jobData) { 194 194 var random = new FastRandom(solution.RandomSeed); 195 195 var jobs = (ItemList<Job>)jobData.Clone(); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVManipulator.cs
r17226 r17461 46 46 } 47 47 48 protected abstract void Manipulate(IRandom random, PRV Encodingindividual, int numberOfRules);48 protected abstract void Manipulate(IRandom random, PRV individual, int numberOfRules); 49 49 50 50 public override IOperation InstrumentedApply() { 51 var solution = ScheduleParameter.ActualValue as PRV Encoding;51 var solution = ScheduleParameter.ActualValue as PRV; 52 52 if (solution == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type PRVEncoding."); 53 53 Manipulate(RandomParameter.ActualValue, solution, NumberOfRulesParameter.ActualValue.Value); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVUniformOnePositionManipulator.cs
r17226 r17461 40 40 } 41 41 42 public static void Apply(IRandom random, PRV Encodingindividual, int numberOfRules) {42 public static void Apply(IRandom random, PRV individual, int numberOfRules) { 43 43 UniformOnePositionManipulator.Apply(random, individual.PriorityRulesVector, new IntMatrix(new int[,] { { 0, numberOfRules } })); 44 44 } 45 45 46 protected override void Manipulate(IRandom random, PRV Encodingindividual, int numberOfRules) {46 protected override void Manipulate(IRandom random, PRV individual, int numberOfRules) { 47 47 Apply(random, individual, numberOfRules); 48 48 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVRandomCreator.cs
r17226 r17461 29 29 [Item("PriorityRulesRandomCreator", "Creator class used to create PRV encoding objects for scheduling problems.")] 30 30 [StorableType("5FF2A11E-86F9-4A8B-8E1C-713D6801506C")] 31 public class PRVRandomCreator : ScheduleCreator<PRV Encoding>, IStochasticOperator {31 public class PRVRandomCreator : ScheduleCreator<PRV>, IStochasticOperator { 32 32 33 33 [Storable] … … 54 54 } 55 55 56 public static PRV EncodingApply(int jobs, int resources, IRandom random, int nrOfRules) {57 return new PRV Encoding(jobs * resources, random, 0, nrOfRules);56 public static PRV Apply(int jobs, int resources, IRandom random, int nrOfRules) { 57 return new PRV(jobs * resources, random, 0, nrOfRules); 58 58 } 59 59 60 protected override PRV EncodingCreateSolution() {60 protected override PRV CreateSolution() { 61 61 return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue, NrOfRules); 62 62 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PriorityRulesVectorEncoding.cs
r16725 r17461 34 34 namespace HeuristicLab.Encodings.ScheduleEncoding { 35 35 [StorableType("9C419EE5-F3A8-4F06-8263-7D37D3AE1C72")] 36 public sealed class PriorityRulesVectorEncoding : ScheduleEncoding<PRV Encoding> {36 public sealed class PriorityRulesVectorEncoding : ScheduleEncoding<PRV> { 37 37 38 38 private IFixedValueParameter<IntValue> numberOfRulesParameter; … … 60 60 61 61 public PriorityRulesVectorEncoding() 62 : base( ) {62 : base("PRV") { 63 63 //TODO change to meaningful value 64 64 numberOfRulesParameter = new FixedValueParameter<IntValue>(Name + ".NumberOfRules", new IntValue(10)); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleCreator.cs
r17226 r17461 31 31 [StorableType("3DDA1485-4518-4F1D-A475-795FFE63C98E")] 32 32 public abstract class ScheduleCreator<TSchedule> : InstrumentedOperator, IScheduleCreator<TSchedule> 33 where TSchedule : class,ISchedule {33 where TSchedule : class,IScheduleSolution { 34 34 35 35 public ILookupParameter<TSchedule> ScheduleParameter { -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleCrossover.cs
r17226 r17461 32 32 public abstract class ScheduleCrossover : InstrumentedOperator, IScheduleCrossover, IStochasticOperator { 33 33 34 public ILookupParameter<ISchedule > ChildParameter {35 get { return (ILookupParameter<ISchedule >)Parameters["Child"]; }34 public ILookupParameter<IScheduleSolution> ChildParameter { 35 get { return (ILookupParameter<IScheduleSolution>)Parameters["Child"]; } 36 36 } 37 public IScopeTreeLookupParameter<ISchedule > ParentsParameter {38 get { return (IScopeTreeLookupParameter<ISchedule >)Parameters["Parents"]; }37 public IScopeTreeLookupParameter<IScheduleSolution> ParentsParameter { 38 get { return (IScopeTreeLookupParameter<IScheduleSolution>)Parameters["Parents"]; } 39 39 } 40 40 public ILookupParameter<IRandom> RandomParameter { … … 48 48 : base() { 49 49 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 50 Parameters.Add(new LookupParameter<ISchedule >("Child", "The child solution resulting from the crossover."));50 Parameters.Add(new LookupParameter<IScheduleSolution>("Child", "The child solution resulting from the crossover.")); 51 51 ChildParameter.ActualName = "Schedule"; 52 Parameters.Add(new ScopeTreeLookupParameter<ISchedule >("Parents", "The parent solution which should be crossed."));52 Parameters.Add(new ScopeTreeLookupParameter<IScheduleSolution>("Parents", "The parent solution which should be crossed.")); 53 53 ParentsParameter.ActualName = "Schedule"; 54 54 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleDecoder.cs
r17226 r17461 31 31 [StorableType("57A68F4B-4B35-4DB4-9B5E-D5154DD46E45")] 32 32 public abstract class ScheduleDecoder<TSchedule> : SingleSuccessorOperator, IScheduleDecoder<TSchedule> 33 where TSchedule : class, ISchedule {33 where TSchedule : class, IScheduleSolution { 34 34 35 public ILookupParameter<ISchedule > ScheduleEncodingParameter {36 get { return (ILookupParameter<ISchedule >)Parameters["EncodedSchedule"]; }35 public ILookupParameter<IScheduleSolution> ScheduleEncodingParameter { 36 get { return (ILookupParameter<IScheduleSolution>)Parameters["EncodedSchedule"]; } 37 37 } 38 38 public ILookupParameter<Schedule> ScheduleParameter { … … 48 48 public ScheduleDecoder() 49 49 : base() { 50 Parameters.Add(new LookupParameter<ISchedule >("EncodedSchedule", "The new scheduling solution represented as encoding."));50 Parameters.Add(new LookupParameter<IScheduleSolution>("EncodedSchedule", "The new scheduling solution represented as encoding.")); 51 51 Parameters.Add(new LookupParameter<Schedule>("Schedule", "The decoded scheduling solution represented as generalized schedule.")); 52 52 Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the JSSP - Instance.")); 53 53 } 54 54 55 public Schedule DecodeSchedule(ISchedule schedule, ItemList<Job> jobData) {55 public Schedule DecodeSchedule(IScheduleSolution schedule, ItemList<Job> jobData) { 56 56 TSchedule solution = schedule as TSchedule; 57 57 if (solution == null) throw new InvalidOperationException("Encoding is not of type " + typeof(TSchedule).GetPrettyName()); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding.cs
r17226 r17461 33 33 [StorableType("D2FB1AF9-EF13-4ED2-B3E9-D5BE4E5772EA")] 34 34 public abstract class ScheduleEncoding<TSchedule> : Encoding<TSchedule>, IScheduleEncoding 35 where TSchedule : class, ISchedule {35 where TSchedule : class, IScheduleSolution { 36 36 #region Encoding Parameters 37 37 [Storable] 38 private I FixedValueParameter<ItemList<Job>> jobDataParameter;39 public I FixedValueParameter<ItemList<Job>> JobDataParameter {38 private IValueParameter<ItemList<Job>> jobDataParameter; 39 public IValueParameter<ItemList<Job>> JobDataParameter { 40 40 get { return jobDataParameter; } 41 41 set { … … 126 126 } 127 127 128 protected ScheduleEncoding() : this("Schedule") { }129 128 protected ScheduleEncoding(string name) : this(name, Enumerable.Empty<Job>()) { } 130 129 protected ScheduleEncoding(string name, IEnumerable<Job> jobData) … … 133 132 int resources = jobData.SelectMany(j => j.Tasks).Select(t => t.ResourceNr).Distinct().Count(); 134 133 135 jobDataParameter = new FixedValueParameter<ItemList<Job>>(Name + ".JobData", new ItemList<Job>(jobData));134 jobDataParameter = new ValueParameter<ItemList<Job>>(Name + ".JobData", new ItemList<Job>(jobData)); 136 135 jobsParameter = new FixedValueParameter<IntValue>(Name + ".Jobs", new IntValue(jobs)); 137 136 resourcesParameter = new FixedValueParameter<IntValue>(Name + ".Resources", new IntValue(resources)); … … 144 143 } 145 144 146 public Schedule Decode(ISchedule schedule, ItemList<Job> jobData) {145 public Schedule Decode(IScheduleSolution schedule, ItemList<Job> jobData) { 147 146 return Decoder.DecodeSchedule(schedule, jobData); 148 147 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Decoder/DirectScheduleDecoder.cs
r16725 r17461 27 27 [Item("DirectScheduleDecoder", "An item used to convert a direct schedule into a generalized schedule.")] 28 28 [StorableType("151C772B-6E6C-40D9-B171-F5626C676A5F")] 29 public class DirectScheduleDecoder : ScheduleDecoder<Schedule> {29 public class DirectScheduleDecoder : ScheduleDecoder<Schedule>, IDirectScheduleOperator { 30 30 [StorableConstructor] 31 31 protected DirectScheduleDecoder(StorableConstructorFlag _) : base(_) { } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/DirectScheduleEncoding.cs
r16725 r17461 31 31 32 32 namespace HeuristicLab.Encodings.ScheduleEncoding { 33 [Item("Direct Schedule Encoding", "Encodes a solution by directly assigning start and end types to the tasks.")] 33 34 [StorableType("BB1BD851-3E77-4357-942C-EAF5BE6760B4")] 34 35 public sealed class DirectScheduleEncoding : ScheduleEncoding<Schedule> { … … 41 42 42 43 public DirectScheduleEncoding() 43 : base( ) {44 : base("Schedule") { 44 45 SolutionCreator = new DirectScheduleRandomCreator(); 45 46 Decoder = new DirectScheduleDecoder(); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/DirectScheduleRandomCreator.cs
r17226 r17461 54 54 55 55 56 public static Schedule Apply(PWR Encodingpwr, ItemList<Job> jobData) {56 public static Schedule Apply(PWR pwr, ItemList<Job> jobData) { 57 57 var resultingSchedule = new Schedule(jobData[0].Tasks.Count); 58 58 foreach (int jobNr in pwr.PermutationWithRepetition) { … … 70 70 protected override Schedule CreateSolution() { 71 71 var jobData = (ItemList<Job>)JobDataParameter.ActualValue.Clone(); 72 var pwrEncoding = new PWR Encoding(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value,72 var pwrEncoding = new PWR(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, 73 73 RandomParameter.ActualValue); 74 74 return Apply(pwrEncoding, jobData); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Schedule.cs
r17360 r17461 31 31 [Item("Schedule", "Represents the general solution for scheduling problems.")] 32 32 [StorableType("EA6D14A3-7FA6-4B4B-B7F6-40B42657D398")] 33 public class Schedule : NamedItem, ISchedule {33 public class Schedule : NamedItem, IScheduleSolution { 34 34 35 35 #region Properties -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleManipulator.cs
r17226 r17461 32 32 public abstract class ScheduleManipulator : InstrumentedOperator, IScheduleManipulator, IStochasticOperator { 33 33 34 public ILookupParameter<ISchedule > ScheduleParameter {35 get { return (ILookupParameter<ISchedule >)Parameters["Schedule"]; }34 public ILookupParameter<IScheduleSolution> ScheduleParameter { 35 get { return (ILookupParameter<IScheduleSolution>)Parameters["Schedule"]; } 36 36 } 37 37 … … 45 45 public ScheduleManipulator() 46 46 : base() { 47 Parameters.Add(new LookupParameter<ISchedule >("Schedule", "The scheduling solution to be manipulated."));47 Parameters.Add(new LookupParameter<IScheduleSolution>("Schedule", "The scheduling solution to be manipulated.")); 48 48 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 49 49 }
Note: See TracChangeset
for help on using the changeset viewer.