Changeset 13443
- Timestamp:
- 12/08/15 14:31:05 (8 years ago)
- Location:
- branches/ProblemRefactoring
- Files:
-
- 5 added
- 1 deleted
- 31 edited
- 8 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/HeuristicLab.Encodings.ScheduleEncoding-3.3.csproj
r13437 r13443 116 116 </ItemGroup> 117 117 <ItemGroup> 118 <Compile Include="JobSequenceMatrix\Decoder\JSMDecoder.cs" /> 119 <Compile Include="JobSequenceMatrix\Decoder\JSMDecodingErrorPolicy.cs" /> 120 <Compile Include="JobSequenceMatrix\Decoder\JSMDecodingErrorPolicyTypes.cs" /> 121 <Compile Include="JobSequenceMatrix\Decoder\JSMForcingStrategy.cs" /> 122 <Compile Include="JobSequenceMatrix\Decoder\JSMForcingStrategyTypes.cs" /> 123 <Compile Include="PriorityRulesVector\Decoder\PRVDecoder.cs" /> 124 <Compile Include="PermutationWithRepetition\Decoder\PWRDecoder.cs" /> 125 <Compile Include="ScheduleDecoder.cs" /> 118 126 <Compile Include="Interfaces\IDirectScheduleOperator.cs" /> 119 127 <Compile Include="Interfaces\IJSMOperator.cs" /> … … 123 131 <Compile Include="Interfaces\IScheduleCrossover.cs" /> 124 132 <Compile Include="Interfaces\ISchedule.cs" /> 133 <Compile Include="Interfaces\IScheduleDecoder.cs" /> 125 134 <Compile Include="Interfaces\IScheduleEncoding.cs" /> 126 135 <Compile Include="Interfaces\IScheduleManipulator.cs" /> … … 159 168 <Compile Include="GTAlgorithmUtils.cs" /> 160 169 <Compile Include="Job.cs" /> 170 <Compile Include="ScheduleEncoding\Decoder\DirectScheduleDecoder.cs" /> 161 171 <Compile Include="ScheduleEncoding\DirectScheduleEncoding.cs" /> 162 172 <Compile Include="ScheduleEncoding\Manipulators\DirectScheduleManipulator.cs" /> … … 181 191 <Private>False</Private> 182 192 </ProjectReference> 193 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj"> 194 <Project>{0e27a536-1c4a-4624-a65e-dc4f4f23e3e1}</Project> 195 <Name>HeuristicLab.Common.Resources-3.3</Name> 196 <Private>False</Private> 197 </ProjectReference> 183 198 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> 184 199 <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project> … … 229 244 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project> 230 245 <Name>HeuristicLab.PluginInfrastructure-3.3</Name> 246 <Private>False</Private> 247 </ProjectReference> 248 <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj"> 249 <Project>{f4539fb6-4708-40c9-be64-0a1390aea197}</Project> 250 <Name>HeuristicLab.Random-3.3</Name> 231 251 <Private>False</Private> 232 252 </ProjectReference> -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IPRVOperator.cs
r12012 r13443 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Data; 23 24 24 25 namespace HeuristicLab.Encodings.ScheduleEncoding { 25 26 public interface IPRVOperator : IOperator { 26 27 } 28 29 public interface IPRVRulesOperator : IPRVOperator { 30 ILookupParameter<IntValue> NumberOfRulesParameter { get; } 31 } 27 32 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleDecoder.cs
r13435 r13443 23 23 24 24 namespace HeuristicLab.Encodings.ScheduleEncoding { 25 public interface IScheduleDecoder : I Operator {25 public interface IScheduleDecoder : IScheduleOperator { 26 26 ILookupParameter<ISchedule> ScheduleEncodingParameter { get; } 27 27 ILookupParameter<Schedule> ScheduleParameter { get; } 28 ILookupParameter<ItemList<Job>> JobDataParameter { get; } 29 30 Schedule DecodeSchedule(ISchedule solution, ItemList<Job> jobData); 28 31 } 29 32 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleEncoding.cs
r13437 r13443 36 36 int Resources { get; set; } 37 37 38 39 Schedule Decode(ISchedule schedule, ItemList<Job> jobData); 40 } 41 42 public interface IScheduleEncoding<TSchedule> : IEncoding<TSchedule> 43 where TSchedule : class, ISchedule { 44 38 45 } 39 46 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMJOXCrossover.cs
r13437 r13443 41 41 42 42 public static JSMEncoding Apply(IRandom random, JSMEncoding p1, JSMEncoding p2) { 43 var result = new JSMEncoding( );43 var result = new JSMEncoding(random.Next()); 44 44 45 45 int nrOfResources = p1.JobSequenceMatrix.Count; -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMOXCrossover.cs
r13437 r13443 39 39 40 40 public static JSMEncoding Apply(IRandom random, JSMEncoding parent1, JSMEncoding parent2) { 41 var result = new JSMEncoding( );41 var result = new JSMEncoding(random.Next()); 42 42 43 43 for (int i = 0; i < parent1.JobSequenceMatrix.Count; i++) { -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMSXXCrossover.cs
r13437 r13443 40 40 41 41 public static JSMEncoding Apply(IRandom random, JSMEncoding parent1, JSMEncoding parent2) { 42 var result = new JSMEncoding( );42 var result = new JSMEncoding(random.Next()); 43 43 int subSequenceLength = random.Next(parent1.JobSequenceMatrix[0].Length); 44 44 for (int i = 0; i < parent1.JobSequenceMatrix.Count; i++) { -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder/JSMDecoder.cs
r13437 r13443 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Encodings.PermutationEncoding; 28 using HeuristicLab.Encodings.ScheduleEncoding;29 using HeuristicLab.Optimization;30 28 using HeuristicLab.Parameters; 31 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 using HeuristicLab.Random; 32 31 33 namespace HeuristicLab. Problems.Scheduling {32 namespace HeuristicLab.Encodings.ScheduleEncoding { 34 33 [Item("JobSequenceMatrixDecoder", "Applies the GifflerThompson algorithm to create an active schedule from a JobSequence Matrix.")] 35 34 [StorableClass] 36 public class JSMDecoder : ScheduleDecoder , IStochasticOperator, IJSSPOperator{35 public class JSMDecoder : ScheduleDecoder { 37 36 38 public ILookupParameter<IRandom> RandomParameter {39 get { return (LookupParameter<IRandom>)Parameters["Random"]; }40 }41 public ILookupParameter<ItemList<Job>> JobDataParameter {42 get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; }43 }44 37 public IValueParameter<JSMDecodingErrorPolicy> DecodingErrorPolicyParameter { 45 38 get { return (IValueParameter<JSMDecodingErrorPolicy>)Parameters["DecodingErrorPolicy"]; } … … 66 59 public JSMDecoder() 67 60 : base() { 68 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));69 Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the Schedulingproblem - Instance."));70 61 Parameters.Add(new ValueParameter<JSMDecodingErrorPolicy>("DecodingErrorPolicy", "Specify the policy that should be used to handle decoding errors.", new JSMDecodingErrorPolicy(JSMDecodingErrorPolicyTypes.RandomPolicy))); 71 62 Parameters.Add(new ValueParameter<JSMForcingStrategy>("ForcingStrategy", "Specifies a forcing strategy.", new JSMForcingStrategy(JSMForcingStrategyTypes.SwapForcing))); 72 73 ScheduleEncodingParameter.ActualName = "JobSequenceMatrix";74 63 } 75 64 76 private Task SelectTaskFromConflictSet(int conflictedResourceNr, int progressOnConflictedResource, ItemList<Task> conflictSet, ItemList<Permutation> jsm) {65 private static Task SelectTaskFromConflictSet(JSMEncoding solution, JSMDecodingErrorPolicyTypes decodingErrorPolicy, JSMForcingStrategyTypes forcingStrategy, int conflictedResourceNr, int progressOnConflictedResource, ItemList<Task> conflictSet, IRandom random) { 77 66 if (conflictSet.Count == 1) 78 67 return conflictSet[0]; 68 69 var jsm = solution.JobSequenceMatrix; 79 70 80 71 //get solutionCandidate from jobSequencingMatrix … … 88 79 89 80 //if solutionCandidate wasn't found in conflictSet apply DecodingErrorPolicy and ForcingPolicy 90 Task result = ApplyDecodingErrorPolicy( conflictSet, jsm[conflictedResourceNr], progressOnConflictedResource);81 Task result = ApplyDecodingErrorPolicy(decodingErrorPolicy, conflictSet, jsm[conflictedResourceNr], progressOnConflictedResource, random); 91 82 int newResolutionIndex = 0; 92 83 93 84 while (newResolutionIndex < jsm[conflictedResourceNr].Length && jsm[conflictedResourceNr][newResolutionIndex] != result.JobNr) 94 85 newResolutionIndex++; 95 ApplyForcingStrategy( jsm, conflictedResourceNr, newResolutionIndex, progressOnConflictedResource, result.JobNr);86 ApplyForcingStrategy(forcingStrategy, solution, conflictedResourceNr, newResolutionIndex, progressOnConflictedResource, result.JobNr); 96 87 97 88 return result; 98 89 } 99 90 100 private Task ApplyDecodingErrorPolicy(ItemList<Task> conflictSet, Permutation resource, int progress) {101 if ( DecodingErrorPolicy == JSMDecodingErrorPolicyTypes.RandomPolicy) {91 private static Task ApplyDecodingErrorPolicy(JSMDecodingErrorPolicyTypes decodingErrorPolicy, ItemList<Task> conflictSet, Permutation resource, int progress, IRandom random) { 92 if (decodingErrorPolicy == JSMDecodingErrorPolicyTypes.RandomPolicy) { 102 93 //Random 103 return conflictSet[ RandomParameter.ActualValue.Next(conflictSet.Count - 1)];94 return conflictSet[random.Next(conflictSet.Count - 1)]; 104 95 } else { 105 96 //Guided … … 112 103 return (conflictSet[j]); 113 104 } 114 return conflictSet[ RandomParameter.ActualValue.Next(conflictSet.Count - 1)];105 return conflictSet[random.Next(conflictSet.Count - 1)]; 115 106 } 116 107 } 117 108 118 private void ApplyForcingStrategy(ItemList<Permutation> jsm, int conflictedResource, int newResolutionIndex, int progressOnResource, int newResolution) { 119 if (ForcingStrategy == JSMForcingStrategyTypes.SwapForcing) { 109 private static void ApplyForcingStrategy(JSMForcingStrategyTypes forcingStrategy, JSMEncoding solution, int conflictedResource, int newResolutionIndex, int progressOnResource, int newResolution) { 110 var jsm = solution.JobSequenceMatrix; 111 if (forcingStrategy == JSMForcingStrategyTypes.SwapForcing) { 120 112 //SwapForcing 121 113 jsm[conflictedResource][newResolutionIndex] = jsm[conflictedResource][progressOnResource]; 122 114 jsm[conflictedResource][progressOnResource] = newResolution; 123 } else {115 } else if (forcingStrategy == JSMForcingStrategyTypes.ShiftForcing) { 124 116 //ShiftForcing 125 117 List<int> asList = jsm[conflictedResource].ToList<int>(); … … 132 124 } 133 125 jsm[conflictedResource] = new Permutation(PermutationTypes.Absolute, asList.ToArray<int>()); 126 } else { 127 throw new InvalidOperationException(string.Format("JSMDecoder encountered unknown forcing strategy {0}", forcingStrategy)); 134 128 } 135 129 } 136 130 137 public Schedule CreateScheduleFromEncoding(JSMEncoding solution, ItemList<Job> jobData) { 138 ItemList<Permutation> jobSequenceMatrix = solution.JobSequenceMatrix; 131 public override Schedule DecodeSchedule(ISchedule encoding, ItemList<Job> jobData) { 132 var solution = encoding as JSMEncoding; 133 if (solution == null) throw new InvalidOperationException("Encoding is not of type JSMEncoding"); 134 return DecodeSchedule(solution, jobData, DecodingErrorPolicy, ForcingStrategy); 135 } 139 136 137 public static Schedule DecodeSchedule(JSMEncoding solution, ItemList<Job> jobData, JSMDecodingErrorPolicyTypes decodingErrorPolicy, JSMForcingStrategyTypes forcingStrategy) { 138 var random = new FastRandom(solution.RandomSeed); 140 139 var jobs = (ItemList<Job>)jobData.Clone(); 141 140 var resultingSchedule = new Schedule(jobs[0].Tasks.Count); … … 162 161 //STEP 3 - Select a task from the conflict set 163 162 int progressOnResource = conflictedResource.Tasks.Count; 164 Task selectedTask = SelectTaskFromConflictSet( conflictedResourceNr, progressOnResource, conflictSet, jobSequenceMatrix);163 Task selectedTask = SelectTaskFromConflictSet(solution, decodingErrorPolicy, forcingStrategy, conflictedResourceNr, progressOnResource, conflictSet, random); 165 164 166 165 //STEP 4 - Add the selected task to the current schedule … … 175 174 return resultingSchedule; 176 175 } 177 178 public override Schedule CreateScheduleFromEncoding(ISchedule encoding) {179 var solution = encoding as JSMEncoding;180 if (solution == null) throw new InvalidOperationException("Encoding is not of type JSMEncoding");181 return CreateScheduleFromEncoding(solution, JobDataParameter.ActualValue);182 }183 176 } 184 177 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder/JSMDecodingErrorPolicy.cs
r13434 r13443 22 22 using System.Drawing; 23 23 using HeuristicLab.Common; 24 using HeuristicLab.Common.Resources; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 28 28 namespace HeuristicLab. Problems.Scheduling {29 namespace HeuristicLab.Encodings.ScheduleEncoding { 29 30 [Item("JSMDecodingErrorPolicy", "Represents a policy for handling decoding errors.")] 30 31 [StorableClass] … … 32 33 33 34 public static new Image StaticItemImage { 34 get { return HeuristicLab.Common.Resources.VSImageLibrary.Enum; }35 get { return VSImageLibrary.Enum; } 35 36 } 36 37 -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder/JSMDecodingErrorPolicyTypes.cs
r13434 r13443 20 20 #endregion 21 21 22 namespace HeuristicLab. Problems.Scheduling {22 namespace HeuristicLab.Encodings.ScheduleEncoding { 23 23 public enum JSMDecodingErrorPolicyTypes { 24 24 RandomPolicy, -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder/JSMForcingStrategy.cs
r13434 r13443 22 22 using System.Drawing; 23 23 using HeuristicLab.Common; 24 using HeuristicLab.Common.Resources; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 28 28 namespace HeuristicLab. Problems.Scheduling {29 namespace HeuristicLab.Encodings.ScheduleEncoding { 29 30 [Item("JSMForcingStrategy", "Represents a forcing strategy.")] 30 31 [StorableClass] … … 32 33 33 34 public static new Image StaticItemImage { 34 get { return HeuristicLab.Common.Resources.VSImageLibrary.Enum; }35 get { return VSImageLibrary.Enum; } 35 36 } 36 37 -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Decoder/JSMForcingStrategyTypes.cs
r13434 r13443 20 20 #endregion 21 21 22 namespace HeuristicLab. Problems.Scheduling {22 namespace HeuristicLab.Encodings.ScheduleEncoding { 23 23 public enum JSMForcingStrategyTypes { 24 24 ShiftForcing, -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JSMEncoding.cs
r13437 r13443 32 32 33 33 [Storable] 34 public ItemList<Permutation> JobSequenceMatrix { get; set; } 34 public ItemList<Permutation> JobSequenceMatrix { get; private set; } 35 [Storable] 36 public int RandomSeed { get; private set; } 35 37 36 38 [StorableConstructor] … … 39 41 : base(original, cloner) { 40 42 this.JobSequenceMatrix = cloner.Clone(original.JobSequenceMatrix); 43 this.RandomSeed = original.RandomSeed; 41 44 } 42 45 public override IDeepCloneable Clone(Cloner cloner) { 43 46 return new JSMEncoding(this, cloner); 44 47 } 45 public JSMEncoding( )48 public JSMEncoding(int randomSeed) 46 49 : base() { 50 RandomSeed = randomSeed; 47 51 JobSequenceMatrix = new ItemList<Permutation>(); 48 52 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JSMRandomCreator.cs
r13437 r13443 49 49 50 50 public static JSMEncoding Apply(int jobs, int resources, IRandom random) { 51 var solution = new JSMEncoding( );51 var solution = new JSMEncoding(random.Next()); 52 52 for (int i = 0; i < resources; i++) { 53 53 solution.JobSequenceMatrix.Add(new Permutation(PermutationTypes.Absolute, jobs, random)); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JobSequenceMatrixEncoding.cs
r13437 r13443 27 27 using HeuristicLab.Common; 28 28 using HeuristicLab.Core; 29 using HeuristicLab.Encodings.ScheduleEncoding;30 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 30 using HeuristicLab.PluginInfrastructure; 32 31 33 namespace HeuristicLab.Encodings.Schedule {32 namespace HeuristicLab.Encodings.ScheduleEncoding { 34 33 [StorableClass] 35 public sealed class JobSequenceMatrixEncoding : ScheduleEncoding {34 public sealed class JobSequenceMatrixEncoding : ScheduleEncoding<JSMEncoding> { 36 35 [StorableConstructor] 37 36 private JobSequenceMatrixEncoding(bool deserializing) : base(deserializing) { } … … 44 43 : base() { 45 44 SolutionCreator = new JSMRandomCreator(); 45 Decoder = new JSMDecoder(); 46 46 DiscoverOperators(); 47 47 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Decoder/PWRDecoder.cs
r13437 r13443 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Encodings.ScheduleEncoding;26 using HeuristicLab.Optimization;27 using HeuristicLab.Parameters;28 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 26 30 namespace HeuristicLab. Problems.Scheduling {27 namespace HeuristicLab.Encodings.ScheduleEncoding { 31 28 [Item("PWRDecoder", "An item used to convert a PWR-individual into a generalized schedule.")] 32 29 [StorableClass] 33 public class PWRDecoder : ScheduleDecoder, IStochasticOperator, IJSSPOperator { 34 35 public ILookupParameter<IRandom> RandomParameter { 36 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 37 } 38 public ILookupParameter<ItemList<Job>> JobDataParameter { 39 get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; } 40 } 41 30 public class PWRDecoder : ScheduleDecoder { 42 31 [StorableConstructor] 43 32 protected PWRDecoder(bool deserializing) : base(deserializing) { } 44 33 protected PWRDecoder(PWRDecoder original, Cloner cloner) : base(original, cloner) { } 45 public PWRDecoder() 46 : base() { 47 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 48 Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the JSSP - Instance.")); 49 ScheduleEncodingParameter.ActualName = "PermutationWithRepetition"; 50 } 34 public PWRDecoder() : base() { } 51 35 52 36 public override IDeepCloneable Clone(Cloner cloner) { … … 54 38 } 55 39 56 public override Schedule CreateScheduleFromEncoding(ISchedule encoding) { 57 var solution = encoding as PWREncoding; 58 if (solution == null) throw new InvalidOperationException("Encoding is not of type PWREncoding"); 40 public override Schedule DecodeSchedule(ISchedule solution, ItemList<Job> jobData) { 41 var pwr = solution as PWREncoding; 42 if (pwr == null) throw new InvalidOperationException("Encoding is not of type PWREncoding"); 43 return DecodeSchedule(pwr, jobData); 44 } 59 45 60 var jobs = (ItemList<Job>)JobDataParameter.ActualValue.Clone(); 46 public static Schedule DecodeSchedule(PWREncoding solution, ItemList<Job> jobData) { 47 var jobs = (ItemList<Job>)jobData.Clone(); 61 48 var resultingSchedule = new Schedule(jobs[0].Tasks.Count); 62 49 foreach (int jobNr in solution.PermutationWithRepetition) { -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PermutationWithRepetitionEncoding.cs
r13437 r13443 27 27 using HeuristicLab.Common; 28 28 using HeuristicLab.Core; 29 using HeuristicLab.Encodings.ScheduleEncoding;30 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 30 using HeuristicLab.PluginInfrastructure; 32 31 33 namespace HeuristicLab.Encodings.Schedule {32 namespace HeuristicLab.Encodings.ScheduleEncoding { 34 33 [StorableClass] 35 public sealed class PermutationWithRepetitionEncoding : ScheduleEncoding {34 public sealed class PermutationWithRepetitionEncoding : ScheduleEncoding<PWREncoding> { 36 35 [StorableConstructor] 37 36 private PermutationWithRepetitionEncoding(bool deserializing) : base(deserializing) { } … … 44 43 : base() { 45 44 SolutionCreator = new PWRRandomCreator(); 45 Decoder = new PWRDecoder(); 46 46 DiscoverOperators(); 47 47 } 48 48 49 49 50 #region Operator Discovery -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVDiscreteCrossover.cs
r13437 r13443 40 40 41 41 public static PRVEncoding Apply(IRandom random, PRVEncoding parent1, PRVEncoding parent2) { 42 return new PRVEncoding(DiscreteCrossover.Apply(random, new ItemArray<IntegerVector>(new IntegerVector[] { parent1.PriorityRulesVector, parent2.PriorityRulesVector })), parent1.NrOfRules); 42 var randomSeed = random.Next(); 43 var integerVector = DiscreteCrossover.Apply(random, new ItemArray<IntegerVector>(new[] { parent1.PriorityRulesVector, parent2.PriorityRulesVector })); 44 return new PRVEncoding(integerVector, randomSeed); 43 45 } 44 46 -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVSinglePointCrossover.cs
r13437 r13443 40 40 41 41 public static PRVEncoding Apply(IRandom random, PRVEncoding parent1, PRVEncoding parent2) { 42 return new PRVEncoding(SinglePointCrossover.Apply(random, parent1.PriorityRulesVector, parent2.PriorityRulesVector), parent1.NrOfRules); 42 var randomSeed = random.Next(); 43 var integerVector = SinglePointCrossover.Apply(random, parent1.PriorityRulesVector, parent2.PriorityRulesVector); 44 return new PRVEncoding(integerVector, randomSeed); 43 45 } 44 46 -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Decoder/PRVDecoder.cs
r13437 r13443 21 21 22 22 using System; 23 using System.Linq; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Encodings.ScheduleEncoding; 26 using HeuristicLab.Optimization;27 using HeuristicLab.Parameters;28 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 30 namespace HeuristicLab.Problems.Scheduling { 28 using HeuristicLab.Random; 29 30 namespace HeuristicLab.Encodings.ScheduleEncoding { 31 31 [Item("JobSequencingMatrixDecoder", "Applies the GifflerThompson algorithm to create an active schedule from a JobSequencing Matrix.")] 32 32 [StorableClass] 33 public class PRVDecoder : ScheduleDecoder, IStochasticOperator, IJSSPOperator { 34 35 public ILookupParameter<IRandom> RandomParameter { 36 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 37 } 38 public ILookupParameter<ItemList<Job>> JobDataParameter { 39 get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; } 40 } 41 33 public class PRVDecoder : ScheduleDecoder { 42 34 #region Priority Rules 43 35 //smallest number of remaining tasks 44 private Task FILORule(ItemList<Task> tasks) {36 private static Task FILORule(ItemList<Task> tasks) { 45 37 Task currentResult = tasks[tasks.Count - 1]; 46 38 return currentResult; … … 48 40 49 41 //earliest start time 50 private Task ESTRule(ItemList<Task> tasks, Schedule schedule) {51 Task currentResult = RandomRule(tasks);42 private static Task ESTRule(ItemList<Task> tasks, Schedule schedule) { 43 Task currentResult = tasks.First(); 52 44 double currentEST = double.MaxValue; 53 45 foreach (Task t in tasks) { … … 62 54 63 55 //shortest processingtime 64 private Task SPTRule(ItemList<Task> tasks) {65 Task currentResult = RandomRule(tasks);56 private static Task SPTRule(ItemList<Task> tasks) { 57 Task currentResult = tasks.First(); 66 58 foreach (Task t in tasks) { 67 59 if (t.Duration < currentResult.Duration) … … 72 64 73 65 //longest processing time 74 private Task LPTRule(ItemList<Task> tasks) {75 Task currentResult = RandomRule(tasks);66 private static Task LPTRule(ItemList<Task> tasks) { 67 Task currentResult = tasks.First(); 76 68 foreach (Task t in tasks) { 77 69 if (t.Duration > currentResult.Duration) … … 82 74 83 75 //most work remaining 84 private Task MWRRule(ItemList<Task> tasks, ItemList<Job> jobs) {85 Task currentResult = RandomRule(tasks);76 private static Task MWRRule(ItemList<Task> tasks, ItemList<Job> jobs) { 77 Task currentResult = tasks.First(); 86 78 double currentLargestRemainingProcessingTime = 0; 87 79 foreach (Task t in tasks) { … … 100 92 101 93 //least work remaining 102 private Task LWRRule(ItemList<Task> tasks, ItemList<Job> jobs) {103 Task currentResult = RandomRule(tasks);94 private static Task LWRRule(ItemList<Task> tasks, ItemList<Job> jobs) { 95 Task currentResult = tasks.First(); 104 96 double currentSmallestRemainingProcessingTime = double.MaxValue; 105 97 foreach (Task t in tasks) { … … 118 110 119 111 //most operations remaining 120 private Task MORRule(ItemList<Task> tasks, ItemList<Job> jobs) {121 Task currentResult = RandomRule(tasks);112 private static Task MORRule(ItemList<Task> tasks, ItemList<Job> jobs) { 113 Task currentResult = tasks.First(); 122 114 int currentLargestNrOfRemainingTasks = 0; 123 115 foreach (Task t in tasks) { … … 136 128 137 129 //least operationsremaining 138 private Task LORRule(ItemList<Task> tasks, ItemList<Job> jobs) {139 Task currentResult = RandomRule(tasks);130 private static Task LORRule(ItemList<Task> tasks, ItemList<Job> jobs) { 131 Task currentResult = tasks.First(); 140 132 int currentSmallestNrOfRemainingTasks = int.MaxValue; 141 133 foreach (Task t in tasks) { … … 154 146 155 147 //first operation in Queue 156 private Task FIFORule(ItemList<Task> tasks) {148 private static Task FIFORule(ItemList<Task> tasks) { 157 149 Task currentResult = tasks[0]; 158 150 return currentResult; … … 160 152 161 153 //random 162 private Task RandomRule(ItemList<Task> tasks) {163 Task currentResult = tasks[ RandomParameter.ActualValue.Next(tasks.Count)];154 private static Task RandomRule(ItemList<Task> tasks, IRandom random) { 155 Task currentResult = tasks[random.Next(tasks.Count)]; 164 156 return currentResult; 165 157 } … … 170 162 protected PRVDecoder(bool deserializing) : base(deserializing) { } 171 163 protected PRVDecoder(PRVDecoder original, Cloner cloner) : base(original, cloner) { } 172 public PRVDecoder() 173 : base() { 174 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 175 Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the SchedulingProblem - Instance.")); 176 ScheduleEncodingParameter.ActualName = "PriorityRulesVector"; 177 } 164 public PRVDecoder() : base() { } 178 165 179 166 public override IDeepCloneable Clone(Cloner cloner) { … … 181 168 } 182 169 183 private Task SelectTaskFromConflictSet(ItemList<Task> conflictSet, int ruleIndex, int nrOfRules, Schedule schedule, ItemList<Job> jobs) {170 private static Task SelectTaskFromConflictSet(ItemList<Task> conflictSet, int ruleIndex, Schedule schedule, ItemList<Job> jobs, IRandom random) { 184 171 if (conflictSet.Count == 1) 185 172 return conflictSet[0]; 186 173 187 ruleIndex = ruleIndex % nrOfRules; 174 //TODO change to property, Encoding parameter? 175 ruleIndex = ruleIndex % 10; 188 176 switch (ruleIndex) { 189 177 case 0: return FILORule(conflictSet); … … 196 184 case 7: return LORRule(conflictSet, jobs); 197 185 case 8: return FIFORule(conflictSet); 198 case 9: return RandomRule(conflictSet );199 default: return RandomRule(conflictSet );200 } 201 } 202 203 public override Schedule CreateScheduleFromEncoding(ISchedule encoding) {186 case 9: return RandomRule(conflictSet, random); 187 default: return RandomRule(conflictSet, random); 188 } 189 } 190 191 public override Schedule DecodeSchedule(ISchedule encoding, ItemList<Job> jobData) { 204 192 var solution = encoding as PRVEncoding; 205 193 if (solution == null) throw new InvalidOperationException("Encoding is not of type PRVEncoding"); 206 207 var jobs = (ItemList<Job>)JobDataParameter.ActualValue.Clone(); 194 return DecodeSchedule(solution, jobData); 195 } 196 197 public static Schedule DecodeSchedule(PRVEncoding solution, ItemList<Job> jobData) { 198 var random = new FastRandom(solution.RandomSeed); 199 var jobs = (ItemList<Job>)jobData.Clone(); 208 200 var resultingSchedule = new Schedule(jobs[0].Tasks.Count); 209 201 … … 228 220 //STEP 3 - Select an operation from the conflict set (various methods depending on how the algorithm should work..) 229 221 //Task selectedTask = SelectTaskFromConflictSet(conflictSet, solution.PriorityRulesVector [currentDecisionIndex++], solution.NrOfRules.Value); 230 Task selectedTask = SelectTaskFromConflictSet(conflictSet, solution.PriorityRulesVector[minimal.JobNr], solution.NrOfRules, resultingSchedule, jobs);222 Task selectedTask = SelectTaskFromConflictSet(conflictSet, solution.PriorityRulesVector[minimal.JobNr], resultingSchedule, jobs, random); 231 223 232 224 //STEP 4 - Adding the selected operation to the current schedule -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVManipulator.cs
r13437 r13443 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Data; 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 28 … … 28 30 [Item("PRVManipulator", "An operator which manipulates a PRV representation.")] 29 31 [StorableClass] 30 public abstract class PRVManipulator : ScheduleManipulator, IPRVOperator { 32 public abstract class PRVManipulator : ScheduleManipulator, IPRVRulesOperator { 33 34 public ILookupParameter<IntValue> NumberOfRulesParameter { 35 get { return (ILookupParameter<IntValue>)Parameters["NumberOfRulesParameter"]; } 36 } 37 38 31 39 [StorableConstructor] 32 40 protected PRVManipulator(bool deserializing) : base(deserializing) { } 33 41 protected PRVManipulator(PRVManipulator original, Cloner cloner) : base(original, cloner) { } 34 public PRVManipulator() : base() { }35 42 36 protected abstract void Manipulate(IRandom random, PRVEncoding individual); 43 public PRVManipulator() 44 : base() { 45 Parameters.Add(new LookupParameter<IntValue>("NumberOfRulesParameter")); 46 } 47 48 protected abstract void Manipulate(IRandom random, PRVEncoding individual, int numberOfRules); 37 49 38 50 public override IOperation InstrumentedApply() { 39 51 var solution = ScheduleParameter.ActualValue as PRVEncoding; 40 52 if (solution == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type PRVEncoding."); 41 Manipulate(RandomParameter.ActualValue, solution );53 Manipulate(RandomParameter.ActualValue, solution, NumberOfRulesParameter.ActualValue.Value); 42 54 return base.InstrumentedApply(); 43 55 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVUniformOnePositionManipulator.cs
r13437 r13443 40 40 } 41 41 42 public static void Apply(IRandom random, PRVEncoding individual ) {43 UniformOnePositionManipulator.Apply(random, individual.PriorityRulesVector, new IntMatrix(new int[,] { { 0, individual.NrOfRules } }));42 public static void Apply(IRandom random, PRVEncoding individual, int numberOfRules) { 43 UniformOnePositionManipulator.Apply(random, individual.PriorityRulesVector, new IntMatrix(new int[,] { { 0, numberOfRules } })); 44 44 } 45 45 46 protected override void Manipulate(IRandom random, PRVEncoding individual ) {47 Apply(random, individual );46 protected override void Manipulate(IRandom random, PRVEncoding individual, int numberOfRules) { 47 Apply(random, individual, numberOfRules); 48 48 } 49 49 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVEncoding.cs
r13437 r13443 31 31 public class PRVEncoding : Item, ISchedule { 32 32 [Storable] 33 public IntegerVector PriorityRulesVector { get; set; } 34 33 public IntegerVector PriorityRulesVector { get; private set; } 35 34 [Storable] 36 public int NrOfRules{ get; private set; }35 public int RandomSeed { get; private set; } 37 36 38 37 [StorableConstructor] … … 40 39 protected PRVEncoding(PRVEncoding original, Cloner cloner) 41 40 : base(original, cloner) { 42 this.NrOfRules = original.NrOfRules;43 41 this.PriorityRulesVector = cloner.Clone(original.PriorityRulesVector); 42 this.RandomSeed = original.RandomSeed; 44 43 } 45 public PRVEncoding(int nrOfRules) 44 45 public PRVEncoding(IntegerVector iv, int randomSeed) 46 46 : base() { 47 this.NrOfRules = nrOfRules; 48 this.PriorityRulesVector = new IntegerVector(); 49 } 50 public PRVEncoding(IntegerVector iv, int nrOfRules) 51 : base() { 52 this.NrOfRules = nrOfRules; 47 this.RandomSeed = randomSeed; 53 48 this.PriorityRulesVector = (IntegerVector)iv.Clone(); 54 49 } 55 public PRVEncoding(int length, IRandom random, int min, int max , int nrOfRules)50 public PRVEncoding(int length, IRandom random, int min, int max) 56 51 : base() { 57 this. NrOfRules = nrOfRules;52 this.RandomSeed = random.Next(); 58 53 this.PriorityRulesVector = new IntegerVector(length, random, min, max); 59 54 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVRandomCreator.cs
r13437 r13443 55 55 56 56 public static PRVEncoding Apply(int jobs, int resources, IRandom random, int nrOfRules) { 57 return new PRVEncoding(jobs * resources, random, 0, nrOfRules , nrOfRules);57 return new PRVEncoding(jobs * resources, random, 0, nrOfRules); 58 58 } 59 59 -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PriorityRulesVectorEncoding.cs
r13437 r13443 27 27 using HeuristicLab.Common; 28 28 using HeuristicLab.Core; 29 using HeuristicLab.Encodings.ScheduleEncoding; 29 using HeuristicLab.Data; 30 using HeuristicLab.Parameters; 30 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 32 using HeuristicLab.PluginInfrastructure; 32 33 33 namespace HeuristicLab.Encodings.Schedule {34 namespace HeuristicLab.Encodings.ScheduleEncoding { 34 35 [StorableClass] 35 public sealed class PriorityRulesVectorEncoding : ScheduleEncoding { 36 public sealed class PriorityRulesVectorEncoding : ScheduleEncoding<PRVEncoding> { 37 38 private IFixedValueParameter<IntValue> numberOfRulesParameter; 39 public IFixedValueParameter<IntValue> NumberOfRulesParameter { 40 get { return numberOfRulesParameter; } 41 set { 42 if (value == null) throw new ArgumentNullException("Number of Rules parameter must not be null."); 43 if (value.Value == null) throw new ArgumentNullException("Number of Rules parameter value must not be null."); 44 if (numberOfRulesParameter == value) return; 45 46 if (numberOfRulesParameter != null) Parameters.Remove(numberOfRulesParameter); 47 numberOfRulesParameter = value; 48 Parameters.Add(numberOfRulesParameter); 49 OnNumberOfRulesParameterChanged(); 50 } 51 } 52 53 36 54 [StorableConstructor] 37 55 private PriorityRulesVectorEncoding(bool deserializing) : base(deserializing) { } … … 43 61 public PriorityRulesVectorEncoding() 44 62 : base() { 63 //TODO change to meaningful value 64 numberOfRulesParameter = new FixedValueParameter<IntValue>(Name + ".NumberOfRules", new IntValue(10)); 65 Parameters.Add(numberOfRulesParameter); 66 45 67 SolutionCreator = new PRVRandomCreator(); 68 Decoder = new PRVDecoder(); 46 69 DiscoverOperators(); 70 } 71 72 private void OnNumberOfRulesParameterChanged() { 73 ConfigureOperators(Operators); 47 74 } 48 75 … … 64 91 AddOperator(@operator); 65 92 } 93 94 public override void ConfigureOperators(IEnumerable<IItem> operators) { 95 base.ConfigureOperators(operators); 96 ConfigureRulesParameter(operators.OfType<IPRVRulesOperator>()); 97 } 98 99 private void ConfigureRulesParameter(IEnumerable<IPRVRulesOperator> rulesOperators) { 100 foreach (var rulesOperator in rulesOperators) 101 rulesOperator.NumberOfRulesParameter.ActualName = numberOfRulesParameter.Name; 102 } 103 66 104 #endregion 67 105 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleDecoder.cs
r13435 r13443 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Encodings.ScheduleEncoding;25 24 using HeuristicLab.Operators; 26 25 using HeuristicLab.Parameters; 27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 29 namespace HeuristicLab. Problems.Scheduling {28 namespace HeuristicLab.Encodings.ScheduleEncoding { 30 29 [Item("ScheduleDecoder", "A schedule decoder translates a respresentation into an actual schedule.")] 31 30 [StorableClass] … … 33 32 34 33 public ILookupParameter<ISchedule> ScheduleEncodingParameter { 35 get { return (ILookupParameter<ISchedule>)Parameters[" ScheduleEncoding"]; }34 get { return (ILookupParameter<ISchedule>)Parameters["EncodedSchedule"]; } 36 35 } 37 36 public ILookupParameter<Schedule> ScheduleParameter { 38 37 get { return (ILookupParameter<Schedule>)Parameters["Schedule"]; } 38 } 39 public ILookupParameter<ItemList<Job>> JobDataParameter { 40 get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; } 39 41 } 40 42 … … 44 46 public ScheduleDecoder() 45 47 : base() { 46 Parameters.Add(new LookupParameter<ISchedule>(" ScheduleEncoding", "The new scheduling solution represented as encoding."));48 Parameters.Add(new LookupParameter<ISchedule>("EncodedSchedule", "The new scheduling solution represented as encoding.")); 47 49 Parameters.Add(new LookupParameter<Schedule>("Schedule", "The decoded scheduling solution represented as generalized schedule.")); 50 Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the JSSP - Instance.")); 48 51 } 49 52 50 public abstract Schedule CreateScheduleFromEncoding(ISchedule solution);53 public abstract Schedule DecodeSchedule(ISchedule solution, ItemList<Job> jobData); 51 54 52 55 public override IOperation Apply() { 53 Schedule result = CreateScheduleFromEncoding(ScheduleEncodingParameter.ActualValue);56 Schedule result = DecodeSchedule(ScheduleEncodingParameter.ActualValue, JobDataParameter.ActualValue); 54 57 ScheduleParameter.ActualValue = result; 55 58 return base.Apply(); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding.cs
r13437 r13443 28 28 using HeuristicLab.Core; 29 29 using HeuristicLab.Data; 30 using HeuristicLab.Encodings.ScheduleEncoding;31 30 using HeuristicLab.Optimization; 32 31 using HeuristicLab.Parameters; 33 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 34 33 35 namespace HeuristicLab.Encodings.Schedule {34 namespace HeuristicLab.Encodings.ScheduleEncoding { 36 35 [StorableClass] 37 public abstract class ScheduleEncoding : Encoding<ISchedule>, IScheduleEncoding { 36 public abstract class ScheduleEncoding<TSchedule> : Encoding<ISchedule>, IScheduleEncoding 37 where TSchedule : class, ISchedule { 38 38 #region Encoding Parameters 39 39 [Storable] … … 83 83 } 84 84 } 85 86 [Storable] 87 private IValueParameter<IScheduleDecoder> decoderParameter; 88 89 public IValueParameter<IScheduleDecoder> DecoderParameter { 90 get { return decoderParameter; } 91 set { 92 if (value == null) throw new ArgumentNullException("Decoder parameter must not be null."); 93 if (value.Value == null) throw new ArgumentNullException("Decoder parameter value must not be null."); 94 if (decoderParameter == value) return; 95 96 if (decoderParameter != null) Parameters.Remove(decoderParameter); 97 decoderParameter = value; 98 Parameters.Add(decoderParameter); 99 OnDecoderParameterChanged(); 100 } 101 } 85 102 #endregion 86 103 … … 97 114 } 98 115 116 public IScheduleDecoder Decoder { 117 get { return DecoderParameter.Value; } 118 set { DecoderParameter.Value = value; } 119 } 99 120 100 121 [StorableConstructor] 101 122 protected ScheduleEncoding(bool deserializing) : base(deserializing) { } 102 protected ScheduleEncoding(ScheduleEncoding original, Cloner cloner)123 protected ScheduleEncoding(ScheduleEncoding<TSchedule> original, Cloner cloner) 103 124 : base(original, cloner) { 104 125 } … … 114 135 jobsParameter = new FixedValueParameter<IntValue>(Name + ".Jobs", new IntValue(jobs)); 115 136 resourcesParameter = new FixedValueParameter<IntValue>(Name + ".Resources", new IntValue(resources)); 137 decoderParameter = new ValueParameter<IScheduleDecoder>(Name + ".Decoder"); 116 138 117 139 Parameters.Add(jobDataParameter); 118 140 Parameters.Add(jobsParameter); 119 141 Parameters.Add(resourcesParameter); 142 Parameters.Add(decoderParameter); 143 } 144 145 public Schedule Decode(ISchedule schedule, ItemList<Job> jobData) { 146 return Decoder.DecodeSchedule(schedule, jobData); 120 147 } 121 148 … … 127 154 } 128 155 private void OnBoundsParameterChanged() { 156 ConfigureOperators(Operators); 157 } 158 159 private void OnDecoderParameterChanged() { 129 160 ConfigureOperators(Operators); 130 161 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Crossovers/DirectScheduleCrossover.cs
r13437 r13443 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 27 namespace HeuristicLab.Encodings.ScheduleEncoding .ScheduleEncoding{27 namespace HeuristicLab.Encodings.ScheduleEncoding { 28 28 [Item("DirectScheduleCrossover", "An operator which crosses two schedule representations.")] 29 29 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Crossovers/DirectScheduleGTCrossover.cs
r13437 r13443 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 28 namespace HeuristicLab.Encodings.ScheduleEncoding .ScheduleEncoding{28 namespace HeuristicLab.Encodings.ScheduleEncoding { 29 29 [Item("DirectScheduleGTCrossover", "Represents a crossover using the GT-Algorithm to cross two direct schedule representations.")] 30 30 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/DirectScheduleEncoding.cs
r13437 r13443 27 27 using HeuristicLab.Common; 28 28 using HeuristicLab.Core; 29 using HeuristicLab.Encodings.ScheduleEncoding;30 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 30 using HeuristicLab.PluginInfrastructure; 32 31 33 namespace HeuristicLab.Encodings.Schedule {32 namespace HeuristicLab.Encodings.ScheduleEncoding { 34 33 [StorableClass] 35 public sealed class DirectScheduleEncoding : ScheduleEncoding {34 public sealed class DirectScheduleEncoding : ScheduleEncoding<Schedule> { 36 35 [StorableConstructor] 37 36 private DirectScheduleEncoding(bool deserializing) : base(deserializing) { } … … 44 43 : base() { 45 44 SolutionCreator = new DirectScheduleRandomCreator(); 45 Decoder = new DirectScheduleDecoder(); 46 46 DiscoverOperators(); 47 47 } 48 48 49 49 50 #region Operator Discovery -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/DirectScheduleRandomCreator.cs
r13437 r13443 20 20 #endregion 21 21 22 using System;23 22 using HeuristicLab.Common; 24 23 using HeuristicLab.Core; … … 55 54 56 55 57 public static Schedule Apply( int jobs, int resources,PWREncoding pwr, ItemList<Job> jobData) {56 public static Schedule Apply(PWREncoding pwr, ItemList<Job> jobData) { 58 57 var resultingSchedule = new Schedule(jobData[0].Tasks.Count); 59 58 foreach (int jobNr in pwr.PermutationWithRepetition) { … … 71 70 72 71 protected override ISchedule CreateSolution() { 73 try { 74 var jobData = (ItemList<Job>)JobDataParameter.ActualValue.Clone(); 75 return Apply(JobsParameter.ActualValue.Value, 76 ResourcesParameter.ActualValue.Value, 77 new PWREncoding(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue), 78 jobData); 79 } 80 catch { 81 throw new Exception("ScheduleRandomCreator needs JobData parameter from a JSSP-Instance to create Schedule-Instances!"); 82 } 72 var jobData = (ItemList<Job>)JobDataParameter.ActualValue.Clone(); 73 var pwrEncoding = new PWREncoding(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, 74 RandomParameter.ActualValue); 75 return Apply(pwrEncoding, jobData); 83 76 } 84 77 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Manipulators/DirectScheduleManipulator.cs
r13437 r13443 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 28 namespace HeuristicLab.Encodings.ScheduleEncoding .ScheduleEncoding{28 namespace HeuristicLab.Encodings.ScheduleEncoding { 29 29 [Item("DirectScheduleManipulator", "An operator which manipulates a direct schedule representation.")] 30 30 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling.Views/3.3/JSMDecodingErrorPolicyView.cs
r12012 r13443 23 23 using System.Windows.Forms; 24 24 using HeuristicLab.Core.Views; 25 using HeuristicLab.Encodings.ScheduleEncoding; 25 26 using HeuristicLab.MainForm; 26 27 -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling.Views/3.3/JSMForcingStrategyView.cs
r12012 r13443 23 23 using System.Windows.Forms; 24 24 using HeuristicLab.Core.Views; 25 using HeuristicLab.Encodings.ScheduleEncoding; 25 26 using HeuristicLab.MainForm; 26 27 -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling.Views/3.3/JobShopSchedulingProblemView.Designer.cs
r12012 r13443 1 #region License Information2 / * HeuristicLab3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 *5 * This file is part of HeuristicLab.6 *7 * HeuristicLab is free software: you can redistribute it and/or modify8 * it under the terms of the GNU General Public License as published by9 * the Free Software Foundation, either version 3 of the License, or10 * (at your option) any later version.11 *12 * HeuristicLab is distributed in the hope that it will be useful,13 * but WITHOUT ANY WARRANTY; without even the implied warranty of14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 * GNU General Public License for more details.16 *17 * You should have received a copy of the GNU General Public License18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.19 */20 #endregion1 //#region License Information 2 ///* HeuristicLab 3 // * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 // * 5 // * This file is part of HeuristicLab. 6 // * 7 // * HeuristicLab is free software: you can redistribute it and/or modify 8 // * it under the terms of the GNU General Public License as published by 9 // * the Free Software Foundation, either version 3 of the License, or 10 // * (at your option) any later version. 11 // * 12 // * HeuristicLab is distributed in the hope that it will be useful, 13 // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // * GNU General Public License for more details. 16 // * 17 // * You should have received a copy of the GNU General Public License 18 // * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 // */ 20 //#endregion 21 21 22 using HeuristicLab.Encodings.ScheduleEncoding.Views;23 namespace HeuristicLab.Problems.Scheduling.Views {24 partial class JobShopSchedulingProblemView {25 /// <summary>26 /// Required designer variable.27 /// </summary>28 private System.ComponentModel.IContainer components = null;22 //using HeuristicLab.Encodings.ScheduleEncoding.Views; 23 //namespace HeuristicLab.Problems.Scheduling.Views { 24 // partial class JobShopSchedulingProblemView { 25 // /// <summary> 26 // /// Required designer variable. 27 // /// </summary> 28 // private System.ComponentModel.IContainer components = null; 29 29 30 /// <summary>31 /// Clean up any resources being used.32 /// </summary>33 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>34 protected override void Dispose(bool disposing) {35 if (disposing && (components != null)) {36 components.Dispose();37 }38 base.Dispose(disposing);39 }30 // /// <summary> 31 // /// Clean up any resources being used. 32 // /// </summary> 33 // /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 34 // protected override void Dispose(bool disposing) { 35 // if (disposing && (components != null)) { 36 // components.Dispose(); 37 // } 38 // base.Dispose(disposing); 39 // } 40 40 41 #region Component Designer generated code41 // #region Component Designer generated code 42 42 43 /// <summary>44 /// Required method for Designer support - do not modify45 /// the contents of this method with the code editor.46 /// </summary>47 private void InitializeComponent() {48 this.problemTabControl = new System.Windows.Forms.TabControl();49 this.problemTabPage = new System.Windows.Forms.TabPage();50 this.visualizationTabPage = new System.Windows.Forms.TabPage();51 this.ganttChart = new HeuristicLab.Encodings.ScheduleEncoding.Views.GanttChart();52 ((System.ComponentModel.ISupportInitialize)(this.problemInstanceSplitContainer)).BeginInit();53 this.problemInstanceSplitContainer.Panel1.SuspendLayout();54 this.problemInstanceSplitContainer.Panel2.SuspendLayout();55 this.problemInstanceSplitContainer.SuspendLayout();56 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();57 this.problemTabControl.SuspendLayout();58 this.problemTabPage.SuspendLayout();59 this.visualizationTabPage.SuspendLayout();60 this.SuspendLayout();61 //62 // problemInstanceSplitContainer.Panel263 //64 this.problemInstanceSplitContainer.Panel2.Controls.Add(this.problemTabControl);65 //66 // parameterCollectionView67 //68 this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));69 this.parameterCollectionView.Dock = System.Windows.Forms.DockStyle.Fill;70 this.parameterCollectionView.Location = new System.Drawing.Point(3, 3);71 this.parameterCollectionView.Size = new System.Drawing.Size(491, 271);72 //73 // nameTextBox74 //75 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);76 this.errorProvider.SetIconPadding(this.nameTextBox, 2);77 this.nameTextBox.Size = new System.Drawing.Size(439, 20);78 //79 // infoLabel80 //81 this.infoLabel.Location = new System.Drawing.Point(492, 3);82 //83 // problemTabControl84 //85 this.problemTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)86 | System.Windows.Forms.AnchorStyles.Left)87 | System.Windows.Forms.AnchorStyles.Right)));88 this.problemTabControl.Controls.Add(this.problemTabPage);89 this.problemTabControl.Controls.Add(this.visualizationTabPage);90 this.problemTabControl.Location = new System.Drawing.Point(3, 27);91 this.problemTabControl.Name = "problemTabControl";92 this.problemTabControl.SelectedIndex = 0;93 this.problemTabControl.Size = new System.Drawing.Size(505, 303);94 this.problemTabControl.TabIndex = 5;95 //96 // problemTabPage97 //98 this.problemTabPage.Controls.Add(this.parameterCollectionView);99 this.problemTabPage.Location = new System.Drawing.Point(4, 22);100 this.problemTabPage.Name = "problemTabPage";101 this.problemTabPage.Padding = new System.Windows.Forms.Padding(3);102 this.problemTabPage.Size = new System.Drawing.Size(497, 277);103 this.problemTabPage.TabIndex = 0;104 this.problemTabPage.Text = "Problem";105 this.problemTabPage.UseVisualStyleBackColor = true;106 //107 // visualizationTabPage108 //109 this.visualizationTabPage.Controls.Add(this.ganttChart);110 this.visualizationTabPage.Location = new System.Drawing.Point(4, 22);111 this.visualizationTabPage.Name = "visualizationTabPage";112 this.visualizationTabPage.Padding = new System.Windows.Forms.Padding(3);113 this.visualizationTabPage.Size = new System.Drawing.Size(497, 277);114 this.visualizationTabPage.TabIndex = 1;115 this.visualizationTabPage.Text = "Visualization";116 this.visualizationTabPage.UseVisualStyleBackColor = true;117 //118 // ganttChart119 //120 this.ganttChart.Dock = System.Windows.Forms.DockStyle.Fill;121 this.ganttChart.Location = new System.Drawing.Point(3, 3);122 this.ganttChart.Name = "ganttChart";123 this.ganttChart.Size = new System.Drawing.Size(491, 271);124 this.ganttChart.TabIndex = 0;125 //126 // JobShopSchedulingProblemView127 //128 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);129 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;130 this.Name = "JobShopSchedulingProblemView";131 this.problemInstanceSplitContainer.Panel1.ResumeLayout(false);132 this.problemInstanceSplitContainer.Panel2.ResumeLayout(false);133 this.problemInstanceSplitContainer.Panel2.PerformLayout();134 ((System.ComponentModel.ISupportInitialize)(this.problemInstanceSplitContainer)).EndInit();135 this.problemInstanceSplitContainer.ResumeLayout(false);136 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();137 this.problemTabControl.ResumeLayout(false);138 this.problemTabPage.ResumeLayout(false);139 this.visualizationTabPage.ResumeLayout(false);140 this.ResumeLayout(false);43 // /// <summary> 44 // /// Required method for Designer support - do not modify 45 // /// the contents of this method with the code editor. 46 // /// </summary> 47 // private void InitializeComponent() { 48 // this.problemTabControl = new System.Windows.Forms.TabControl(); 49 // this.problemTabPage = new System.Windows.Forms.TabPage(); 50 // this.visualizationTabPage = new System.Windows.Forms.TabPage(); 51 // this.ganttChart = new HeuristicLab.Encodings.ScheduleEncoding.Views.GanttChart(); 52 // ((System.ComponentModel.ISupportInitialize)(this.problemInstanceSplitContainer)).BeginInit(); 53 // this.problemInstanceSplitContainer.Panel1.SuspendLayout(); 54 // this.problemInstanceSplitContainer.Panel2.SuspendLayout(); 55 // this.problemInstanceSplitContainer.SuspendLayout(); 56 // ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 57 // this.problemTabControl.SuspendLayout(); 58 // this.problemTabPage.SuspendLayout(); 59 // this.visualizationTabPage.SuspendLayout(); 60 // this.SuspendLayout(); 61 // // 62 // // problemInstanceSplitContainer.Panel2 63 // // 64 // this.problemInstanceSplitContainer.Panel2.Controls.Add(this.problemTabControl); 65 // // 66 // // parameterCollectionView 67 // // 68 // this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left))); 69 // this.parameterCollectionView.Dock = System.Windows.Forms.DockStyle.Fill; 70 // this.parameterCollectionView.Location = new System.Drawing.Point(3, 3); 71 // this.parameterCollectionView.Size = new System.Drawing.Size(491, 271); 72 // // 73 // // nameTextBox 74 // // 75 // this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 76 // this.errorProvider.SetIconPadding(this.nameTextBox, 2); 77 // this.nameTextBox.Size = new System.Drawing.Size(439, 20); 78 // // 79 // // infoLabel 80 // // 81 // this.infoLabel.Location = new System.Drawing.Point(492, 3); 82 // // 83 // // problemTabControl 84 // // 85 // this.problemTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 86 // | System.Windows.Forms.AnchorStyles.Left) 87 // | System.Windows.Forms.AnchorStyles.Right))); 88 // this.problemTabControl.Controls.Add(this.problemTabPage); 89 // this.problemTabControl.Controls.Add(this.visualizationTabPage); 90 // this.problemTabControl.Location = new System.Drawing.Point(3, 27); 91 // this.problemTabControl.Name = "problemTabControl"; 92 // this.problemTabControl.SelectedIndex = 0; 93 // this.problemTabControl.Size = new System.Drawing.Size(505, 303); 94 // this.problemTabControl.TabIndex = 5; 95 // // 96 // // problemTabPage 97 // // 98 // this.problemTabPage.Controls.Add(this.parameterCollectionView); 99 // this.problemTabPage.Location = new System.Drawing.Point(4, 22); 100 // this.problemTabPage.Name = "problemTabPage"; 101 // this.problemTabPage.Padding = new System.Windows.Forms.Padding(3); 102 // this.problemTabPage.Size = new System.Drawing.Size(497, 277); 103 // this.problemTabPage.TabIndex = 0; 104 // this.problemTabPage.Text = "Problem"; 105 // this.problemTabPage.UseVisualStyleBackColor = true; 106 // // 107 // // visualizationTabPage 108 // // 109 // this.visualizationTabPage.Controls.Add(this.ganttChart); 110 // this.visualizationTabPage.Location = new System.Drawing.Point(4, 22); 111 // this.visualizationTabPage.Name = "visualizationTabPage"; 112 // this.visualizationTabPage.Padding = new System.Windows.Forms.Padding(3); 113 // this.visualizationTabPage.Size = new System.Drawing.Size(497, 277); 114 // this.visualizationTabPage.TabIndex = 1; 115 // this.visualizationTabPage.Text = "Visualization"; 116 // this.visualizationTabPage.UseVisualStyleBackColor = true; 117 // // 118 // // ganttChart 119 // // 120 // this.ganttChart.Dock = System.Windows.Forms.DockStyle.Fill; 121 // this.ganttChart.Location = new System.Drawing.Point(3, 3); 122 // this.ganttChart.Name = "ganttChart"; 123 // this.ganttChart.Size = new System.Drawing.Size(491, 271); 124 // this.ganttChart.TabIndex = 0; 125 // // 126 // // JobShopSchedulingProblemView 127 // // 128 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 129 // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 130 // this.Name = "JobShopSchedulingProblemView"; 131 // this.problemInstanceSplitContainer.Panel1.ResumeLayout(false); 132 // this.problemInstanceSplitContainer.Panel2.ResumeLayout(false); 133 // this.problemInstanceSplitContainer.Panel2.PerformLayout(); 134 // ((System.ComponentModel.ISupportInitialize)(this.problemInstanceSplitContainer)).EndInit(); 135 // this.problemInstanceSplitContainer.ResumeLayout(false); 136 // ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 137 // this.problemTabControl.ResumeLayout(false); 138 // this.problemTabPage.ResumeLayout(false); 139 // this.visualizationTabPage.ResumeLayout(false); 140 // this.ResumeLayout(false); 141 141 142 }142 // } 143 143 144 #endregion144 // #endregion 145 145 146 private System.Windows.Forms.TabControl problemTabControl;147 private System.Windows.Forms.TabPage problemTabPage;148 private System.Windows.Forms.TabPage visualizationTabPage;149 private GanttChart ganttChart;150 }151 }146 // private System.Windows.Forms.TabControl problemTabControl; 147 // private System.Windows.Forms.TabPage problemTabPage; 148 // private System.Windows.Forms.TabPage visualizationTabPage; 149 // private GanttChart ganttChart; 150 // } 151 //} -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling.Views/3.3/JobShopSchedulingProblemView.cs
r12012 r13443 1 #region License Information2 / * HeuristicLab3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 *5 * This file is part of HeuristicLab.6 *7 * HeuristicLab is free software: you can redistribute it and/or modify8 * it under the terms of the GNU General Public License as published by9 * the Free Software Foundation, either version 3 of the License, or10 * (at your option) any later version.11 *12 * HeuristicLab is distributed in the hope that it will be useful,13 * but WITHOUT ANY WARRANTY; without even the implied warranty of14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 * GNU General Public License for more details.16 *17 * You should have received a copy of the GNU General Public License18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.19 */20 #endregion1 //#region License Information 2 ///* HeuristicLab 3 // * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 // * 5 // * This file is part of HeuristicLab. 6 // * 7 // * HeuristicLab is free software: you can redistribute it and/or modify 8 // * it under the terms of the GNU General Public License as published by 9 // * the Free Software Foundation, either version 3 of the License, or 10 // * (at your option) any later version. 11 // * 12 // * HeuristicLab is distributed in the hope that it will be useful, 13 // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // * GNU General Public License for more details. 16 // * 17 // * You should have received a copy of the GNU General Public License 18 // * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 // */ 20 //#endregion 21 21 22 using System;23 using System.Windows.Forms;24 using HeuristicLab.Collections;25 using HeuristicLab.Encodings.ScheduleEncoding;26 using HeuristicLab.MainForm;27 using HeuristicLab.Optimization.Views;22 //using System; 23 //using System.Windows.Forms; 24 //using HeuristicLab.Collections; 25 //using HeuristicLab.Encodings.ScheduleEncoding; 26 //using HeuristicLab.MainForm; 27 //using HeuristicLab.Optimization.Views; 28 28 29 namespace HeuristicLab.Problems.Scheduling.Views {30 [View("JobShop Scheduling Problem View")]31 [Content(typeof(JobShopSchedulingProblem), true)]32 public partial class JobShopSchedulingProblemView : ProblemView {29 //namespace HeuristicLab.Problems.Scheduling.Views { 30 // [View("JobShop Scheduling Problem View")] 31 // [Content(typeof(JobShopSchedulingProblem), true)] 32 // public partial class JobShopSchedulingProblemView : ProblemView { 33 33 34 public new JobShopSchedulingProblem Content {35 get { return (JobShopSchedulingProblem)base.Content; }36 set { base.Content = value; }37 }34 // public new JobShopSchedulingProblem Content { 35 // get { return (JobShopSchedulingProblem)base.Content; } 36 // set { base.Content = value; } 37 // } 38 38 39 public JobShopSchedulingProblemView() {40 InitializeComponent();41 Controls.Remove(parameterCollectionView);42 parameterCollectionView.Dock = DockStyle.Fill;43 problemTabPage.Controls.Add(parameterCollectionView);44 }39 // public JobShopSchedulingProblemView() { 40 // InitializeComponent(); 41 // Controls.Remove(parameterCollectionView); 42 // parameterCollectionView.Dock = DockStyle.Fill; 43 // problemTabPage.Controls.Add(parameterCollectionView); 44 // } 45 45 46 protected override void OnContentChanged() {47 base.OnContentChanged();48 FillGanttChart();49 }46 // protected override void OnContentChanged() { 47 // base.OnContentChanged(); 48 // FillGanttChart(); 49 // } 50 50 51 protected override void DeregisterContentEvents() {52 Content.JobDataParameter.ValueChanged -= JobDataParameterOnValueChanged;53 Content.JobData.ItemsAdded -= JobsOnChanged;54 Content.JobData.ItemsRemoved -= JobsOnRemoved;55 Content.JobData.ItemsReplaced -= JobsOnChanged;56 Content.JobData.CollectionReset -= JobsOnChanged;57 foreach (var job in Content.JobData) {58 job.TasksChanged -= JobOnTasksChanged;59 }60 base.DeregisterContentEvents();61 }62 protected override void RegisterContentEvents() {63 base.RegisterContentEvents();64 Content.JobDataParameter.ValueChanged += JobDataParameterOnValueChanged;65 Content.JobData.ItemsAdded += JobsOnChanged;66 Content.JobData.ItemsRemoved += JobsOnRemoved;67 Content.JobData.ItemsReplaced += JobsOnChanged;68 Content.JobData.CollectionReset += JobsOnChanged;69 foreach (var job in Content.JobData) {70 job.TasksChanged += JobOnTasksChanged;71 }72 }51 // protected override void DeregisterContentEvents() { 52 // Content.JobDataParameter.ValueChanged -= JobDataParameterOnValueChanged; 53 // Content.JobData.ItemsAdded -= JobsOnChanged; 54 // Content.JobData.ItemsRemoved -= JobsOnRemoved; 55 // Content.JobData.ItemsReplaced -= JobsOnChanged; 56 // Content.JobData.CollectionReset -= JobsOnChanged; 57 // foreach (var job in Content.JobData) { 58 // job.TasksChanged -= JobOnTasksChanged; 59 // } 60 // base.DeregisterContentEvents(); 61 // } 62 // protected override void RegisterContentEvents() { 63 // base.RegisterContentEvents(); 64 // Content.JobDataParameter.ValueChanged += JobDataParameterOnValueChanged; 65 // Content.JobData.ItemsAdded += JobsOnChanged; 66 // Content.JobData.ItemsRemoved += JobsOnRemoved; 67 // Content.JobData.ItemsReplaced += JobsOnChanged; 68 // Content.JobData.CollectionReset += JobsOnChanged; 69 // foreach (var job in Content.JobData) { 70 // job.TasksChanged += JobOnTasksChanged; 71 // } 72 // } 73 73 74 private void JobsOnChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<Job>> e) {75 foreach (var job in e.OldItems)76 job.Value.TasksChanged -= JobOnTasksChanged;77 foreach (var job in e.Items)78 job.Value.TasksChanged += JobOnTasksChanged;79 FillGanttChart();80 }74 // private void JobsOnChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<Job>> e) { 75 // foreach (var job in e.OldItems) 76 // job.Value.TasksChanged -= JobOnTasksChanged; 77 // foreach (var job in e.Items) 78 // job.Value.TasksChanged += JobOnTasksChanged; 79 // FillGanttChart(); 80 // } 81 81 82 private void JobsOnRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Job>> e) {83 foreach (var job in e.Items)84 job.Value.TasksChanged -= JobOnTasksChanged;85 FillGanttChart();86 }82 // private void JobsOnRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Job>> e) { 83 // foreach (var job in e.Items) 84 // job.Value.TasksChanged -= JobOnTasksChanged; 85 // FillGanttChart(); 86 // } 87 87 88 private void JobDataParameterOnValueChanged(object sender, EventArgs e) {89 Content.JobData.ItemsAdded += JobsOnChanged;90 Content.JobData.ItemsRemoved += JobsOnRemoved;91 Content.JobData.ItemsReplaced += JobsOnChanged;92 Content.JobData.CollectionReset += JobsOnChanged;93 foreach (var job in Content.JobData) {94 job.TasksChanged += JobOnTasksChanged;95 }96 FillGanttChart();97 }88 // private void JobDataParameterOnValueChanged(object sender, EventArgs e) { 89 // Content.JobData.ItemsAdded += JobsOnChanged; 90 // Content.JobData.ItemsRemoved += JobsOnRemoved; 91 // Content.JobData.ItemsReplaced += JobsOnChanged; 92 // Content.JobData.CollectionReset += JobsOnChanged; 93 // foreach (var job in Content.JobData) { 94 // job.TasksChanged += JobOnTasksChanged; 95 // } 96 // FillGanttChart(); 97 // } 98 98 99 private void JobOnTasksChanged(object sender, EventArgs e) {100 FillGanttChart();101 }99 // private void JobOnTasksChanged(object sender, EventArgs e) { 100 // FillGanttChart(); 101 // } 102 102 103 private void FillGanttChart() {104 ganttChart.Reset();105 if (Content == null) return;106 int jobCount = 0;107 foreach (var j in Content.JobData) {108 double lastEndTime = 0;109 foreach (var t in Content.JobData[jobCount].Tasks) {110 int categoryNr = t.JobNr;111 string categoryName = "Job" + categoryNr;112 ganttChart.AddData(categoryName,113 categoryNr,114 t.TaskNr,115 lastEndTime + 1,116 lastEndTime + t.Duration,117 "Job" + t.JobNr + " - " + "Task#" + t.TaskNr);118 lastEndTime += t.Duration;119 }120 jobCount++;121 }122 }123 }124 }103 // private void FillGanttChart() { 104 // ganttChart.Reset(); 105 // if (Content == null) return; 106 // int jobCount = 0; 107 // foreach (var j in Content.JobData) { 108 // double lastEndTime = 0; 109 // foreach (var t in Content.JobData[jobCount].Tasks) { 110 // int categoryNr = t.JobNr; 111 // string categoryName = "Job" + categoryNr; 112 // ganttChart.AddData(categoryName, 113 // categoryNr, 114 // t.TaskNr, 115 // lastEndTime + 1, 116 // lastEndTime + t.Duration, 117 // "Job" + t.JobNr + " - " + "Task#" + t.TaskNr); 118 // lastEndTime += t.Duration; 119 // } 120 // jobCount++; 121 // } 122 // } 123 // } 124 //} -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/HeuristicLab.Problems.Scheduling-3.3.csproj
r13437 r13443 114 114 <Compile Include="Analyzers\BestSchedulingSolutionAnalyzer.cs" /> 115 115 <Compile Include="Analyzers\SchedulingAnalyzer.cs" /> 116 <Compile Include="Decoders\JSMForcingStrategy.cs" />117 <Compile Include="Decoders\JSMDecoder.cs" />118 <Compile Include="Decoders\JSMDecodingErrorPolicy.cs" />119 <Compile Include="Decoders\JSMDecodingErrorPolicyTypes.cs" />120 <Compile Include="Decoders\JSMForcingStrategyTypes.cs" />121 <Compile Include="Decoders\PRVDecoder.cs" />122 <Compile Include="Decoders\PWRDecoder.cs" />123 <Compile Include="Decoders\ScheduleDecoder.cs" />124 116 <Compile Include="Evaluators\MeanTardinessEvaluator.cs" /> 125 117 <Compile Include="Evaluators\MakespanEvaluator.cs" /> 126 118 <Compile Include="Evaluators\ScheduleEvaluator.cs" /> 127 119 <Compile Include="Interfaces\IJSSPOperator.cs" /> 128 <Compile Include="Interfaces\IScheduleDecoder.cs" />129 120 <Compile Include="Interfaces\IScheduleEvaluator.cs" /> 130 121 <Compile Include="Interfaces\ISchedulingEvaluator.cs" /> … … 210 201 <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project> 211 202 <Name>HeuristicLab.Problems.Instances-3.3</Name> 203 <Private>False</Private> 204 </ProjectReference> 205 <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj"> 206 <Project>{f4539fb6-4708-40c9-be64-0a1390aea197}</Project> 207 <Name>HeuristicLab.Random-3.3</Name> 212 208 <Private>False</Private> 213 209 </ProjectReference> -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/JobShopSchedulingProblem new.cs
r13437 r13443 26 26 using HeuristicLab.Data; 27 27 using HeuristicLab.Encodings.PermutationEncoding; 28 using HeuristicLab.Encodings.Schedule;29 28 using HeuristicLab.Encodings.ScheduleEncoding; 30 29 using HeuristicLab.Optimization; 31 30 using HeuristicLab.Parameters; 32 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 33 using HeuristicLab.PluginInfrastructure;34 32 using HeuristicLab.Problems.Instances; 35 33 … … 95 93 get { return (IFixedValueParameter<IntValue>)Parameters["Resources"]; } 96 94 } 97 public IValueParameter<IScheduleEvaluator> ScheduleEvaluatorParameter {98 get { return (IValueParameter<IScheduleEvaluator>)Parameters["ScheduleEvaluator"]; }99 }100 public OptionalValueParameter<IScheduleDecoder> ScheduleDecoderParameter {101 get { return (OptionalValueParameter<IScheduleDecoder>)Parameters["ScheduleDecoder"]; }102 }103 95 #endregion 104 96 … … 118 110 get { return ResourcesParameter.Value.Value; } 119 111 set { ResourcesParameter.Value.Value = value; } 120 }121 public IScheduleEvaluator ScheduleEvaluator {122 get { return ScheduleEvaluatorParameter.Value; }123 set { ScheduleEvaluatorParameter.Value = value; }124 }125 public IScheduleDecoder ScheduleDecoder {126 get { return ScheduleDecoderParameter.Value; }127 set { ScheduleDecoderParameter.Value = value; }128 112 } 129 113 #endregion … … 151 135 Parameters.Add(new FixedValueParameter<IntValue>("Jobs", "The number of jobs used in this JSSP instance.", new IntValue())); 152 136 Parameters.Add(new FixedValueParameter<IntValue>("Resources", "The number of resources used in this JSSP instance.", new IntValue())); 153 Parameters.Add(new ValueParameter<IScheduleEvaluator>("ScheduleEvaluator", "The evaluator used to determine the quality of a solution.", new MakespanEvaluator()));154 Parameters.Add(new OptionalValueParameter<IScheduleDecoder>("ScheduleDecoder", "The operator that decodes the representation and creates a schedule.", new JSMDecoder()));155 137 156 138 Encoding = new DirectScheduleEncoding(); … … 162 144 163 145 public override double Evaluate(ISchedule solution, IRandom random) { 164 //TODO change to decoder 165 var schedule = (Schedule)solution; 146 var schedule = Encoding.Decode(solution, JobData); 166 147 return MakespanEvaluator.GetMakespan(schedule); 167 148 } … … 194 175 } 195 176 private void ScheduleEvaluatorParameter_ValueChanged(object sender, EventArgs eventArgs) { 196 ScheduleEvaluator.QualityParameter.ActualNameChanged += ScheduleEvaluator_QualityParameter_ActualNameChanged;177 //ScheduleEvaluator.QualityParameter.ActualNameChanged += ScheduleEvaluator_QualityParameter_ActualNameChanged; 197 178 ParameterizeOperators(); 198 179 } … … 205 186 } 206 187 private void ScheduleDecoderParameter_ValueChanged(object sender, EventArgs eventArgs) { 207 if (ScheduleDecoder != null) ScheduleDecoder.ScheduleParameter.ActualNameChanged += ScheduleDecoder_ScheduleParameter_ActualNameChanged;188 //if (ScheduleDecoder != null) ScheduleDecoder.ScheduleParameter.ActualNameChanged += ScheduleDecoder_ScheduleParameter_ActualNameChanged; 208 189 ParameterizeOperators(); 209 190 } … … 222 203 223 204 private void ApplyEncoding() { 224 if (SolutionCreator.GetType() == typeof(JSMRandomCreator)) {225 Operators.AddRange(ApplicationManager.Manager.GetInstances<IJSMOperator>());226 ScheduleDecoder = new JSMDecoder();227 } else if (SolutionCreator.GetType() == typeof(PRVRandomCreator)) {228 Operators.AddRange(ApplicationManager.Manager.GetInstances<IPRVOperator>());229 ScheduleDecoder = new PRVDecoder();230 } else if (SolutionCreator.GetType() == typeof(PWRRandomCreator)) {231 Operators.AddRange(ApplicationManager.Manager.GetInstances<IPWROperator>());232 ScheduleDecoder = new PWRDecoder();233 } else if (SolutionCreator.GetType() == typeof(DirectScheduleRandomCreator)) {234 Operators.AddRange(ApplicationManager.Manager.GetInstances<IDirectScheduleOperator>());235 ScheduleDecoder = null;236 }205 //if (SolutionCreator.GetType() == typeof(JSMRandomCreator)) { 206 // Operators.AddRange(ApplicationManager.Manager.GetInstances<IJSMOperator>()); 207 // ScheduleDecoder = new JSMDecoder(); 208 //} else if (SolutionCreator.GetType() == typeof(PRVRandomCreator)) { 209 // Operators.AddRange(ApplicationManager.Manager.GetInstances<IPRVOperator>()); 210 // ScheduleDecoder = new PRVDecoder(); 211 //} else if (SolutionCreator.GetType() == typeof(PWRRandomCreator)) { 212 // Operators.AddRange(ApplicationManager.Manager.GetInstances<IPWROperator>()); 213 // ScheduleDecoder = new PWRDecoder(); 214 //} else if (SolutionCreator.GetType() == typeof(DirectScheduleRandomCreator)) { 215 // Operators.AddRange(ApplicationManager.Manager.GetInstances<IDirectScheduleOperator>()); 216 // ScheduleDecoder = null; 217 //} 237 218 } 238 219 … … 301 282 BestKnownQuality = data.BestKnownQuality ?? double.NaN; 302 283 if (data.BestKnownSchedule != null) { 303 var enc = new JSMEncoding(); 304 enc.JobSequenceMatrix = new ItemList<Permutation>(data.Resources); 284 var enc = new JSMEncoding(0); 305 285 for (int i = 0; i < data.Resources; i++) { 306 enc.JobSequenceMatrix [i] = new Permutation(PermutationTypes.Absolute, new int[data.Jobs]);286 enc.JobSequenceMatrix.Add(new Permutation(PermutationTypes.Absolute, new int[data.Jobs])); 307 287 for (int j = 0; j < data.Jobs; j++) { 308 288 enc.JobSequenceMatrix[i][j] = data.BestKnownSchedule[i, j]; 309 289 } 310 290 } 311 BestKnownSolution = new JSMDecoder().CreateScheduleFromEncoding(enc, jobData);312 if (ScheduleEvaluator is MeanTardinessEvaluator)313 BestKnownQuality = MeanTardinessEvaluator.GetMeanTardiness(BestKnownSolution, jobData);314 else if (ScheduleEvaluator is MakespanEvaluator)315 BestKnownQuality = MakespanEvaluator.GetMakespan(BestKnownSolution);291 BestKnownSolution = JSMDecoder.DecodeSchedule(enc, jobData, JSMDecodingErrorPolicyTypes.RandomPolicy, JSMForcingStrategyTypes.SwapForcing); 292 //if (ScheduleEvaluator is MeanTardinessEvaluator) 293 // BestKnownQuality = MeanTardinessEvaluator.GetMeanTardiness(BestKnownSolution, jobData); 294 //else if (ScheduleEvaluator is MakespanEvaluator) 295 // BestKnownQuality = MakespanEvaluator.GetMakespan(BestKnownSolution); 316 296 } 317 297 -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/JobShopSchedulingProblem.cs
r13437 r13443 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 23 using System.Drawing; 24 using System.Linq; 25 using HeuristicLab.Common; 26 using HeuristicLab.Core; 27 using HeuristicLab.Data; 28 using HeuristicLab.Encodings.PermutationEncoding; 29 using HeuristicLab.Encodings.ScheduleEncoding; 30 using HeuristicLab.Parameters; 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 32 using HeuristicLab.PluginInfrastructure; 33 using HeuristicLab.Problems.Instances; 34 35 namespace HeuristicLab.Problems.Scheduling { 36 [Item("Job Shop Scheduling Problem (JSSP)", "Represents a standard Job Shop Scheduling Problem")] 37 [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 120)] 38 [StorableClass] 39 public sealed class JobShopSchedulingProblem : SchedulingProblem, IProblemInstanceConsumer<JSSPData>, IProblemInstanceExporter<JSSPData>, IStorableContent { 40 #region Default Instance 41 private static readonly JSSPData DefaultInstance = new JSSPData() { 42 Jobs = 10, 43 Resources = 10, 44 BestKnownQuality = 930, 45 ProcessingTimes = new double[,] { 46 { 29, 78, 9, 36, 49, 11, 62, 56, 44, 21 }, 47 { 43, 90, 75, 11, 69, 28, 46, 46, 72, 30 }, 48 { 91, 85, 39, 74, 90, 10, 12, 89, 45, 33 }, 49 { 81, 95, 71, 99, 9, 52, 85, 98, 22, 43 }, 50 { 14, 6, 22, 61, 26, 69, 21, 49, 72, 53 }, 51 { 84, 2, 52, 95, 48, 72, 47, 65, 6, 25 }, 52 { 46, 37, 61, 13, 32, 21, 32, 89, 30, 55 }, 53 { 31, 86, 46, 74, 32, 88, 19, 48, 36, 79 }, 54 { 76, 69, 76, 51, 85, 11, 40, 89, 26, 74 }, 55 { 85, 13, 61, 7, 64, 76, 47, 52, 90, 45 } 56 }, 57 Demands = new int[,] { 58 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, 59 { 0, 2, 4, 9, 3, 1, 6, 5, 7, 8 }, 60 { 1, 0, 3, 2, 8, 5, 7, 6, 9, 4 }, 61 { 1, 2, 0, 4, 6, 8, 7, 3, 9, 5 }, 62 { 2, 0, 1, 5, 3, 4, 8, 7, 9, 6 }, 63 { 2, 1, 5, 3, 8, 9, 0, 6, 4, 7 }, 64 { 1, 0, 3, 2, 6, 5, 9, 8, 7, 4 }, 65 { 2, 0, 1, 5, 4, 6, 8, 9, 7, 3 }, 66 { 0, 1, 3, 5, 2, 9, 6, 7, 4, 8 }, 67 { 1, 0, 2, 6, 8, 9, 5, 3, 4, 7 } 68 } 69 }; 70 #endregion 71 72 public string Filename { get; set; } 73 public override Image ItemImage { 74 get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; } 75 } 76 77 #region Parameter Properties 78 public IValueParameter<ItemList<Job>> JobDataParameter { 79 get { return (IValueParameter<ItemList<Job>>)Parameters["JobData"]; } 80 } 81 public OptionalValueParameter<Schedule> BestKnownSolutionParameter { 82 get { return (OptionalValueParameter<Schedule>)Parameters["BestKnownSolution"]; } 83 } 84 85 public IFixedValueParameter<IntValue> JobsParameter { 86 get { return (IFixedValueParameter<IntValue>)Parameters["Jobs"]; } 87 } 88 public IFixedValueParameter<IntValue> ResourcesParameter { 89 get { return (IFixedValueParameter<IntValue>)Parameters["Resources"]; } 90 } 91 public IValueParameter<IScheduleEvaluator> ScheduleEvaluatorParameter { 92 get { return (IValueParameter<IScheduleEvaluator>)Parameters["ScheduleEvaluator"]; } 93 } 94 public OptionalValueParameter<IScheduleDecoder> ScheduleDecoderParameter { 95 get { return (OptionalValueParameter<IScheduleDecoder>)Parameters["ScheduleDecoder"]; } 96 } 97 #endregion 98 99 #region Properties 100 public ItemList<Job> JobData { 101 get { return JobDataParameter.Value; } 102 set { JobDataParameter.Value = value; } 103 } 104 public Schedule BestKnownSolution { 105 get { return BestKnownSolutionParameter.Value; } 106 set { BestKnownSolutionParameter.Value = value; } 107 } 108 public int Jobs { 109 get { return JobsParameter.Value.Value; } 110 set { JobsParameter.Value.Value = value; } 111 } 112 public int Resources { 113 get { return ResourcesParameter.Value.Value; } 114 set { ResourcesParameter.Value.Value = value; } 115 } 116 public IScheduleEvaluator ScheduleEvaluator { 117 get { return ScheduleEvaluatorParameter.Value; } 118 set { ScheduleEvaluatorParameter.Value = value; } 119 } 120 public IScheduleDecoder ScheduleDecoder { 121 get { return ScheduleDecoderParameter.Value; } 122 set { ScheduleDecoderParameter.Value = value; } 123 } 124 #endregion 125 126 [StorableConstructor] 127 private JobShopSchedulingProblem(bool deserializing) : base(deserializing) { } 128 private JobShopSchedulingProblem(JobShopSchedulingProblem original, Cloner cloner) 129 : base(original, cloner) { 130 RegisterEventHandlers(); 131 } 132 public JobShopSchedulingProblem() 133 : base(new SchedulingEvaluator(), new JSMRandomCreator()) { 134 Parameters.Add(new ValueParameter<ItemList<Job>>("JobData", "Jobdata defining the precedence relationships and the duration of the tasks in this JSSP-Instance.", new ItemList<Job>())); 135 Parameters.Add(new OptionalValueParameter<Schedule>("BestKnownSolution", "The best known solution of this JSSP instance.")); 136 137 Parameters.Add(new FixedValueParameter<IntValue>("Jobs", "The number of jobs used in this JSSP instance.", new IntValue())); 138 Parameters.Add(new FixedValueParameter<IntValue>("Resources", "The number of resources used in this JSSP instance.", new IntValue())); 139 Parameters.Add(new ValueParameter<IScheduleEvaluator>("ScheduleEvaluator", "The evaluator used to determine the quality of a solution.", new MakespanEvaluator())); 140 Parameters.Add(new OptionalValueParameter<IScheduleDecoder>("ScheduleDecoder", "The operator that decodes the representation and creates a schedule.", new JSMDecoder())); 141 142 EvaluatorParameter.GetsCollected = false; 143 EvaluatorParameter.Hidden = true; 144 ScheduleDecoderParameter.Hidden = true; 145 146 InitializeOperators(); 147 Load(DefaultInstance); 148 RegisterEventHandlers(); 149 } 150 151 public override IDeepCloneable Clone(Cloner cloner) { 152 return new JobShopSchedulingProblem(this, cloner); 153 } 154 155 [StorableHook(HookType.AfterDeserialization)] 156 private void AfterDeserialization() { 157 RegisterEventHandlers(); 158 } 159 160 private void RegisterEventHandlers() { 161 ScheduleEvaluatorParameter.ValueChanged += ScheduleEvaluatorParameter_ValueChanged; 162 ScheduleEvaluator.QualityParameter.ActualNameChanged += ScheduleEvaluator_QualityParameter_ActualNameChanged; 163 SolutionCreator.ScheduleParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged; 164 ScheduleDecoderParameter.ValueChanged += ScheduleDecoderParameter_ValueChanged; 165 if (ScheduleDecoder != null) ScheduleDecoder.ScheduleParameter.ActualNameChanged += ScheduleDecoder_ScheduleParameter_ActualNameChanged; 166 } 167 168 #region Events 169 protected override void OnSolutionCreatorChanged() { 170 SolutionCreator.ScheduleParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged; 171 InitializeOperators(); 172 } 173 protected override void OnEvaluatorChanged() { 174 base.OnEvaluatorChanged(); 175 ParameterizeOperators(); 176 } 177 private void ScheduleEvaluatorParameter_ValueChanged(object sender, EventArgs eventArgs) { 178 ScheduleEvaluator.QualityParameter.ActualNameChanged += ScheduleEvaluator_QualityParameter_ActualNameChanged; 179 ParameterizeOperators(); 180 } 181 private void ScheduleEvaluator_QualityParameter_ActualNameChanged(object sender, EventArgs eventArgs) { 182 ParameterizeOperators(); 183 } 184 185 private void SolutionCreator_SchedulingEncodingParameter_ActualNameChanged(object sender, EventArgs eventArgs) { 186 ParameterizeOperators(); 187 } 188 private void ScheduleDecoderParameter_ValueChanged(object sender, EventArgs eventArgs) { 189 if (ScheduleDecoder != null) ScheduleDecoder.ScheduleParameter.ActualNameChanged += ScheduleDecoder_ScheduleParameter_ActualNameChanged; 190 ParameterizeOperators(); 191 } 192 private void ScheduleDecoder_ScheduleParameter_ActualNameChanged(object sender, EventArgs eventArgs) { 193 ParameterizeOperators(); 194 } 195 #endregion 196 197 #region Problem Instance Handling 198 public void Load(JSSPData data) { 199 var jobData = new ItemList<Job>(data.Jobs); 200 for (int j = 0; j < data.Jobs; j++) { 201 var job = new Job(j, data.DueDates != null ? data.DueDates[j] : double.MaxValue); 202 for (int t = 0; t < data.Resources; t++) { 203 job.Tasks.Add(new Task(t, data.Demands[j, t], j, data.ProcessingTimes[j, t])); 204 } 205 jobData.Add(job); 206 } 207 208 BestKnownQuality = data.BestKnownQuality.HasValue ? new DoubleValue(data.BestKnownQuality.Value) : null; 209 if (data.BestKnownSchedule != null) { 210 var enc = new JSMEncoding(); 211 enc.JobSequenceMatrix = new ItemList<Permutation>(data.Resources); 212 for (int i = 0; i < data.Resources; i++) { 213 enc.JobSequenceMatrix[i] = new Permutation(PermutationTypes.Absolute, new int[data.Jobs]); 214 for (int j = 0; j < data.Jobs; j++) { 215 enc.JobSequenceMatrix[i][j] = data.BestKnownSchedule[i, j]; 216 } 217 } 218 BestKnownSolution = new JSMDecoder().CreateScheduleFromEncoding(enc, jobData); 219 if (ScheduleEvaluator is MeanTardinessEvaluator) 220 BestKnownQuality = new DoubleValue(MeanTardinessEvaluator.GetMeanTardiness(BestKnownSolution, jobData)); 221 else if (ScheduleEvaluator is MakespanEvaluator) 222 BestKnownQuality = new DoubleValue(MakespanEvaluator.GetMakespan(BestKnownSolution)); 223 } 224 225 JobData = jobData; 226 Jobs = data.Jobs; 227 Resources = data.Resources; 228 } 229 230 public JSSPData Export() { 231 var result = new JSSPData { 232 Name = Name, 233 Description = Description, 234 Jobs = Jobs, 235 Resources = Resources, 236 ProcessingTimes = new double[Jobs, Resources], 237 Demands = new int[Jobs, Resources], 238 DueDates = new double[Jobs] 239 }; 240 241 foreach (var job in JobData) { 242 var counter = 0; 243 result.DueDates[job.Index] = job.DueDate; 244 foreach (var task in job.Tasks) { 245 result.ProcessingTimes[task.JobNr, counter] = task.Duration; 246 result.Demands[task.JobNr, counter] = task.ResourceNr; 247 counter++; 248 } 249 } 250 return result; 251 } 252 #endregion 253 254 #region Helpers 255 private void InitializeOperators() { 256 Operators.Clear(); 257 ApplyEncoding(); 258 Operators.Add(new BestSchedulingSolutionAnalyzer()); 259 ParameterizeOperators(); 260 } 261 262 private void ApplyEncoding() { 263 if (SolutionCreator.GetType() == typeof(JSMRandomCreator)) { 264 Operators.AddRange(ApplicationManager.Manager.GetInstances<IJSMOperator>()); 265 ScheduleDecoder = new JSMDecoder(); 266 } else if (SolutionCreator.GetType() == typeof(PRVRandomCreator)) { 267 Operators.AddRange(ApplicationManager.Manager.GetInstances<IPRVOperator>()); 268 ScheduleDecoder = new PRVDecoder(); 269 } else if (SolutionCreator.GetType() == typeof(PWRRandomCreator)) { 270 Operators.AddRange(ApplicationManager.Manager.GetInstances<IPWROperator>()); 271 ScheduleDecoder = new PWRDecoder(); 272 } else if (SolutionCreator.GetType() == typeof(DirectScheduleRandomCreator)) { 273 Operators.AddRange(ApplicationManager.Manager.GetInstances<IDirectScheduleOperator>()); 274 ScheduleDecoder = null; 275 } 276 } 277 278 private void ParameterizeOperators() { 279 Evaluator.ScheduleDecoderParameter.ActualName = ScheduleDecoderParameter.Name; 280 Evaluator.ScheduleDecoderParameter.Hidden = true; 281 Evaluator.ScheduleEvaluatorParameter.ActualName = ScheduleEvaluatorParameter.Name; 282 Evaluator.ScheduleEvaluatorParameter.Hidden = true; 283 Evaluator.QualityParameter.ActualName = ScheduleEvaluator.QualityParameter.ActualName; 284 Evaluator.QualityParameter.Hidden = true; 285 286 if (ScheduleDecoder != null) 287 ScheduleDecoder.ScheduleEncodingParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName; 288 289 if (ScheduleDecoder != null) { 290 ScheduleEvaluator.ScheduleParameter.ActualName = ScheduleDecoder.ScheduleParameter.ActualName; 291 ScheduleEvaluator.ScheduleParameter.Hidden = true; 292 } else if (SolutionCreator is DirectScheduleRandomCreator) { 293 var directEvaluator = (DirectScheduleRandomCreator)SolutionCreator; 294 ScheduleEvaluator.ScheduleParameter.ActualName = directEvaluator.ScheduleParameter.ActualName; 295 ScheduleEvaluator.ScheduleParameter.Hidden = true; 296 } else { 297 ScheduleEvaluator.ScheduleParameter.ActualName = ScheduleEvaluator.ScheduleParameter.Name; 298 ScheduleEvaluator.ScheduleParameter.Hidden = false; 299 } 300 301 foreach (var op in Operators.OfType<IScheduleManipulator>()) { 302 op.ScheduleParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName; 303 op.ScheduleParameter.Hidden = true; 304 } 305 306 foreach (var op in Operators.OfType<IScheduleCrossover>()) { 307 op.ChildParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName; 308 op.ChildParameter.Hidden = true; 309 op.ParentsParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName; 310 op.ParentsParameter.Hidden = true; 311 } 312 313 foreach (var op in Operators.OfType<BestSchedulingSolutionAnalyzer>()) { 314 op.QualityParameter.ActualName = ScheduleEvaluator.QualityParameter.ActualName; 315 if (ScheduleDecoder != null) { 316 op.ScheduleParameter.ActualName = ScheduleDecoder.ScheduleParameter.ActualName; 317 op.ScheduleParameter.Hidden = true; 318 } else if (SolutionCreator is DirectScheduleRandomCreator) { 319 op.ScheduleParameter.ActualName = ((DirectScheduleRandomCreator)SolutionCreator).ScheduleParameter.ActualName; 320 op.ScheduleParameter.Hidden = true; 321 } else { 322 op.ScheduleParameter.ActualName = op.ScheduleParameter.Name; 323 op.ScheduleParameter.Hidden = false; 324 } 325 } 326 } 327 #endregion 328 329 } 330 } 1 //#region License Information 2 ///* HeuristicLab 3 // * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 // * 5 // * This file is part of HeuristicLab. 6 // * 7 // * HeuristicLab is free software: you can redistribute it and/or modify 8 // * it under the terms of the GNU General Public License as published by 9 // * the Free Software Foundation, either version 3 of the License, or 10 // * (at your option) any later version. 11 // * 12 // * HeuristicLab is distributed in the hope that it will be useful, 13 // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // * GNU General Public License for more details. 16 // * 17 // * You should have received a copy of the GNU General Public License 18 // * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 // */ 20 //#endregion 21 22 //using System; 23 //using System.Drawing; 24 //using System.Linq; 25 //using HeuristicLab.Common; 26 //using HeuristicLab.Core; 27 //using HeuristicLab.Data; 28 //using HeuristicLab.Encodings.PermutationEncoding; 29 //using HeuristicLab.Encodings.ScheduleEncoding; 30 //using HeuristicLab.Parameters; 31 //using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 32 //using HeuristicLab.PluginInfrastructure; 33 //using HeuristicLab.Problems.Instances; 34 35 //namespace HeuristicLab.Problems.Scheduling { 36 // [Item("Job Shop Scheduling Problem (JSSP)", "Represents a standard Job Shop Scheduling Problem")] 37 // [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 120)] 38 // [StorableClass] 39 // public sealed class JobShopSchedulingProblem : SchedulingProblem, IProblemInstanceConsumer<JSSPData>, IProblemInstanceExporter<JSSPData>, IStorableContent { 40 // #region Default Instance 41 // private static readonly JSSPData DefaultInstance = new JSSPData() { 42 // Jobs = 10, 43 // Resources = 10, 44 // BestKnownQuality = 930, 45 // ProcessingTimes = new double[,] { 46 // { 29, 78, 9, 36, 49, 11, 62, 56, 44, 21 }, 47 // { 43, 90, 75, 11, 69, 28, 46, 46, 72, 30 }, 48 // { 91, 85, 39, 74, 90, 10, 12, 89, 45, 33 }, 49 // { 81, 95, 71, 99, 9, 52, 85, 98, 22, 43 }, 50 // { 14, 6, 22, 61, 26, 69, 21, 49, 72, 53 }, 51 // { 84, 2, 52, 95, 48, 72, 47, 65, 6, 25 }, 52 // { 46, 37, 61, 13, 32, 21, 32, 89, 30, 55 }, 53 // { 31, 86, 46, 74, 32, 88, 19, 48, 36, 79 }, 54 // { 76, 69, 76, 51, 85, 11, 40, 89, 26, 74 }, 55 // { 85, 13, 61, 7, 64, 76, 47, 52, 90, 45 } 56 // }, 57 // Demands = new int[,] { 58 // { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, 59 // { 0, 2, 4, 9, 3, 1, 6, 5, 7, 8 }, 60 // { 1, 0, 3, 2, 8, 5, 7, 6, 9, 4 }, 61 // { 1, 2, 0, 4, 6, 8, 7, 3, 9, 5 }, 62 // { 2, 0, 1, 5, 3, 4, 8, 7, 9, 6 }, 63 // { 2, 1, 5, 3, 8, 9, 0, 6, 4, 7 }, 64 // { 1, 0, 3, 2, 6, 5, 9, 8, 7, 4 }, 65 // { 2, 0, 1, 5, 4, 6, 8, 9, 7, 3 }, 66 // { 0, 1, 3, 5, 2, 9, 6, 7, 4, 8 }, 67 // { 1, 0, 2, 6, 8, 9, 5, 3, 4, 7 } 68 // } 69 // }; 70 // #endregion 71 72 // public string Filename { get; set; } 73 // public override Image ItemImage { 74 // get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; } 75 // } 76 77 // #region Parameter Properties 78 // public IValueParameter<ItemList<Job>> JobDataParameter { 79 // get { return (IValueParameter<ItemList<Job>>)Parameters["JobData"]; } 80 // } 81 // public OptionalValueParameter<Schedule> BestKnownSolutionParameter { 82 // get { return (OptionalValueParameter<Schedule>)Parameters["BestKnownSolution"]; } 83 // } 84 85 // public IFixedValueParameter<IntValue> JobsParameter { 86 // get { return (IFixedValueParameter<IntValue>)Parameters["Jobs"]; } 87 // } 88 // public IFixedValueParameter<IntValue> ResourcesParameter { 89 // get { return (IFixedValueParameter<IntValue>)Parameters["Resources"]; } 90 // } 91 // public IValueParameter<IScheduleEvaluator> ScheduleEvaluatorParameter { 92 // get { return (IValueParameter<IScheduleEvaluator>)Parameters["ScheduleEvaluator"]; } 93 // } 94 // public OptionalValueParameter<IScheduleDecoder> ScheduleDecoderParameter { 95 // get { return (OptionalValueParameter<IScheduleDecoder>)Parameters["ScheduleDecoder"]; } 96 // } 97 // #endregion 98 99 // #region Properties 100 // public ItemList<Job> JobData { 101 // get { return JobDataParameter.Value; } 102 // set { JobDataParameter.Value = value; } 103 // } 104 // public Schedule BestKnownSolution { 105 // get { return BestKnownSolutionParameter.Value; } 106 // set { BestKnownSolutionParameter.Value = value; } 107 // } 108 // public int Jobs { 109 // get { return JobsParameter.Value.Value; } 110 // set { JobsParameter.Value.Value = value; } 111 // } 112 // public int Resources { 113 // get { return ResourcesParameter.Value.Value; } 114 // set { ResourcesParameter.Value.Value = value; } 115 // } 116 // public IScheduleEvaluator ScheduleEvaluator { 117 // get { return ScheduleEvaluatorParameter.Value; } 118 // set { ScheduleEvaluatorParameter.Value = value; } 119 // } 120 // public IScheduleDecoder ScheduleDecoder { 121 // get { return ScheduleDecoderParameter.Value; } 122 // set { ScheduleDecoderParameter.Value = value; } 123 // } 124 // #endregion 125 126 // [StorableConstructor] 127 // private JobShopSchedulingProblem(bool deserializing) : base(deserializing) { } 128 // private JobShopSchedulingProblem(JobShopSchedulingProblem original, Cloner cloner) 129 // : base(original, cloner) { 130 // RegisterEventHandlers(); 131 // } 132 // public JobShopSchedulingProblem() 133 // : base(new SchedulingEvaluator(), new JSMRandomCreator()) { 134 // Parameters.Add(new ValueParameter<ItemList<Job>>("JobData", "Jobdata defining the precedence relationships and the duration of the tasks in this JSSP-Instance.", new ItemList<Job>())); 135 // Parameters.Add(new OptionalValueParameter<Schedule>("BestKnownSolution", "The best known solution of this JSSP instance.")); 136 137 // Parameters.Add(new FixedValueParameter<IntValue>("Jobs", "The number of jobs used in this JSSP instance.", new IntValue())); 138 // Parameters.Add(new FixedValueParameter<IntValue>("Resources", "The number of resources used in this JSSP instance.", new IntValue())); 139 // Parameters.Add(new ValueParameter<IScheduleEvaluator>("ScheduleEvaluator", "The evaluator used to determine the quality of a solution.", new MakespanEvaluator())); 140 // Parameters.Add(new OptionalValueParameter<IScheduleDecoder>("ScheduleDecoder", "The operator that decodes the representation and creates a schedule.", new JSMDecoder())); 141 142 // EvaluatorParameter.GetsCollected = false; 143 // EvaluatorParameter.Hidden = true; 144 // ScheduleDecoderParameter.Hidden = true; 145 146 // InitializeOperators(); 147 // Load(DefaultInstance); 148 // RegisterEventHandlers(); 149 // } 150 151 // public override IDeepCloneable Clone(Cloner cloner) { 152 // return new JobShopSchedulingProblem(this, cloner); 153 // } 154 155 // [StorableHook(HookType.AfterDeserialization)] 156 // private void AfterDeserialization() { 157 // RegisterEventHandlers(); 158 // } 159 160 // private void RegisterEventHandlers() { 161 // ScheduleEvaluatorParameter.ValueChanged += ScheduleEvaluatorParameter_ValueChanged; 162 // ScheduleEvaluator.QualityParameter.ActualNameChanged += ScheduleEvaluator_QualityParameter_ActualNameChanged; 163 // SolutionCreator.ScheduleParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged; 164 // ScheduleDecoderParameter.ValueChanged += ScheduleDecoderParameter_ValueChanged; 165 // if (ScheduleDecoder != null) ScheduleDecoder.ScheduleParameter.ActualNameChanged += ScheduleDecoder_ScheduleParameter_ActualNameChanged; 166 // } 167 168 // #region Events 169 // protected override void OnSolutionCreatorChanged() { 170 // SolutionCreator.ScheduleParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged; 171 // InitializeOperators(); 172 // } 173 // protected override void OnEvaluatorChanged() { 174 // base.OnEvaluatorChanged(); 175 // ParameterizeOperators(); 176 // } 177 // private void ScheduleEvaluatorParameter_ValueChanged(object sender, EventArgs eventArgs) { 178 // ScheduleEvaluator.QualityParameter.ActualNameChanged += ScheduleEvaluator_QualityParameter_ActualNameChanged; 179 // ParameterizeOperators(); 180 // } 181 // private void ScheduleEvaluator_QualityParameter_ActualNameChanged(object sender, EventArgs eventArgs) { 182 // ParameterizeOperators(); 183 // } 184 185 // private void SolutionCreator_SchedulingEncodingParameter_ActualNameChanged(object sender, EventArgs eventArgs) { 186 // ParameterizeOperators(); 187 // } 188 // private void ScheduleDecoderParameter_ValueChanged(object sender, EventArgs eventArgs) { 189 // if (ScheduleDecoder != null) ScheduleDecoder.ScheduleParameter.ActualNameChanged += ScheduleDecoder_ScheduleParameter_ActualNameChanged; 190 // ParameterizeOperators(); 191 // } 192 // private void ScheduleDecoder_ScheduleParameter_ActualNameChanged(object sender, EventArgs eventArgs) { 193 // ParameterizeOperators(); 194 // } 195 // #endregion 196 197 // #region Problem Instance Handling 198 // public void Load(JSSPData data) { 199 // var jobData = new ItemList<Job>(data.Jobs); 200 // for (int j = 0; j < data.Jobs; j++) { 201 // var job = new Job(j, data.DueDates != null ? data.DueDates[j] : double.MaxValue); 202 // for (int t = 0; t < data.Resources; t++) { 203 // job.Tasks.Add(new Task(t, data.Demands[j, t], j, data.ProcessingTimes[j, t])); 204 // } 205 // jobData.Add(job); 206 // } 207 208 // BestKnownQuality = data.BestKnownQuality.HasValue ? new DoubleValue(data.BestKnownQuality.Value) : null; 209 // if (data.BestKnownSchedule != null) { 210 // var enc = new JSMEncoding(0); 211 // for (int i = 0; i < data.Resources; i++) { 212 // enc.JobSequenceMatrix.Add(new Permutation(PermutationTypes.Absolute, new int[data.Jobs])); 213 // for (int j = 0; j < data.Jobs; j++) { 214 // enc.JobSequenceMatrix[i][j] = data.BestKnownSchedule[i, j]; 215 // } 216 // } 217 // BestKnownSolution = JSMDecoder.DecodeSchedule(enc, jobData, JSMDecodingErrorPolicyTypes.RandomPolicy, JSMForcingStrategyTypes.SwapForcing); 218 // if (ScheduleEvaluator is MeanTardinessEvaluator) 219 // BestKnownQuality = new DoubleValue(MeanTardinessEvaluator.GetMeanTardiness(BestKnownSolution, jobData)); 220 // else if (ScheduleEvaluator is MakespanEvaluator) 221 // BestKnownQuality = new DoubleValue(MakespanEvaluator.GetMakespan(BestKnownSolution)); 222 // } 223 224 // JobData = jobData; 225 // Jobs = data.Jobs; 226 // Resources = data.Resources; 227 // } 228 229 // public JSSPData Export() { 230 // var result = new JSSPData { 231 // Name = Name, 232 // Description = Description, 233 // Jobs = Jobs, 234 // Resources = Resources, 235 // ProcessingTimes = new double[Jobs, Resources], 236 // Demands = new int[Jobs, Resources], 237 // DueDates = new double[Jobs] 238 // }; 239 240 // foreach (var job in JobData) { 241 // var counter = 0; 242 // result.DueDates[job.Index] = job.DueDate; 243 // foreach (var task in job.Tasks) { 244 // result.ProcessingTimes[task.JobNr, counter] = task.Duration; 245 // result.Demands[task.JobNr, counter] = task.ResourceNr; 246 // counter++; 247 // } 248 // } 249 // return result; 250 // } 251 // #endregion 252 253 // #region Helpers 254 // private void InitializeOperators() { 255 // Operators.Clear(); 256 // ApplyEncoding(); 257 // Operators.Add(new BestSchedulingSolutionAnalyzer()); 258 // ParameterizeOperators(); 259 // } 260 261 // private void ApplyEncoding() { 262 // if (SolutionCreator.GetType() == typeof(JSMRandomCreator)) { 263 // Operators.AddRange(ApplicationManager.Manager.GetInstances<IJSMOperator>()); 264 // ScheduleDecoder = new JSMDecoder(); 265 // } else if (SolutionCreator.GetType() == typeof(PRVRandomCreator)) { 266 // Operators.AddRange(ApplicationManager.Manager.GetInstances<IPRVOperator>()); 267 // ScheduleDecoder = new PRVDecoder(); 268 // } else if (SolutionCreator.GetType() == typeof(PWRRandomCreator)) { 269 // Operators.AddRange(ApplicationManager.Manager.GetInstances<IPWROperator>()); 270 // ScheduleDecoder = new PWRDecoder(); 271 // } else if (SolutionCreator.GetType() == typeof(DirectScheduleRandomCreator)) { 272 // Operators.AddRange(ApplicationManager.Manager.GetInstances<IDirectScheduleOperator>()); 273 // ScheduleDecoder = null; 274 // } 275 // } 276 277 // private void ParameterizeOperators() { 278 // Evaluator.ScheduleDecoderParameter.ActualName = ScheduleDecoderParameter.Name; 279 // Evaluator.ScheduleDecoderParameter.Hidden = true; 280 // Evaluator.ScheduleEvaluatorParameter.ActualName = ScheduleEvaluatorParameter.Name; 281 // Evaluator.ScheduleEvaluatorParameter.Hidden = true; 282 // Evaluator.QualityParameter.ActualName = ScheduleEvaluator.QualityParameter.ActualName; 283 // Evaluator.QualityParameter.Hidden = true; 284 285 // if (ScheduleDecoder != null) 286 // ScheduleDecoder.ScheduleEncodingParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName; 287 288 // if (ScheduleDecoder != null) { 289 // ScheduleEvaluator.ScheduleParameter.ActualName = ScheduleDecoder.ScheduleParameter.ActualName; 290 // ScheduleEvaluator.ScheduleParameter.Hidden = true; 291 // } else if (SolutionCreator is DirectScheduleRandomCreator) { 292 // var directEvaluator = (DirectScheduleRandomCreator)SolutionCreator; 293 // ScheduleEvaluator.ScheduleParameter.ActualName = directEvaluator.ScheduleParameter.ActualName; 294 // ScheduleEvaluator.ScheduleParameter.Hidden = true; 295 // } else { 296 // ScheduleEvaluator.ScheduleParameter.ActualName = ScheduleEvaluator.ScheduleParameter.Name; 297 // ScheduleEvaluator.ScheduleParameter.Hidden = false; 298 // } 299 300 // foreach (var op in Operators.OfType<IScheduleManipulator>()) { 301 // op.ScheduleParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName; 302 // op.ScheduleParameter.Hidden = true; 303 // } 304 305 // foreach (var op in Operators.OfType<IScheduleCrossover>()) { 306 // op.ChildParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName; 307 // op.ChildParameter.Hidden = true; 308 // op.ParentsParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName; 309 // op.ParentsParameter.Hidden = true; 310 // } 311 312 // foreach (var op in Operators.OfType<BestSchedulingSolutionAnalyzer>()) { 313 // op.QualityParameter.ActualName = ScheduleEvaluator.QualityParameter.ActualName; 314 // if (ScheduleDecoder != null) { 315 // op.ScheduleParameter.ActualName = ScheduleDecoder.ScheduleParameter.ActualName; 316 // op.ScheduleParameter.Hidden = true; 317 // } else if (SolutionCreator is DirectScheduleRandomCreator) { 318 // op.ScheduleParameter.ActualName = ((DirectScheduleRandomCreator)SolutionCreator).ScheduleParameter.ActualName; 319 // op.ScheduleParameter.Hidden = true; 320 // } else { 321 // op.ScheduleParameter.ActualName = op.ScheduleParameter.Name; 322 // op.ScheduleParameter.Hidden = false; 323 // } 324 // } 325 // } 326 // #endregion 327 328 // } 329 //} -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/SchedulingProblem.cs
r12012 r13443 1 #region License Information2 / * HeuristicLab3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 *5 * This file is part of HeuristicLab.6 *7 * HeuristicLab is free software: you can redistribute it and/or modify8 * it under the terms of the GNU General Public License as published by9 * the Free Software Foundation, either version 3 of the License, or10 * (at your option) any later version.11 *12 * HeuristicLab is distributed in the hope that it will be useful,13 * but WITHOUT ANY WARRANTY; without even the implied warranty of14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 * GNU General Public License for more details.16 *17 * You should have received a copy of the GNU General Public License18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.19 */20 #endregion1 //#region License Information 2 ///* HeuristicLab 3 // * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 // * 5 // * This file is part of HeuristicLab. 6 // * 7 // * HeuristicLab is free software: you can redistribute it and/or modify 8 // * it under the terms of the GNU General Public License as published by 9 // * the Free Software Foundation, either version 3 of the License, or 10 // * (at your option) any later version. 11 // * 12 // * HeuristicLab is distributed in the hope that it will be useful, 13 // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // * GNU General Public License for more details. 16 // * 17 // * You should have received a copy of the GNU General Public License 18 // * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 // */ 20 //#endregion 21 21 22 using HeuristicLab.Common;23 using HeuristicLab.Core;24 using HeuristicLab.Encodings.ScheduleEncoding;25 using HeuristicLab.Optimization;26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;22 //using HeuristicLab.Common; 23 //using HeuristicLab.Core; 24 //using HeuristicLab.Encodings.ScheduleEncoding; 25 //using HeuristicLab.Optimization; 26 //using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 28 namespace HeuristicLab.Problems.Scheduling {29 [Item("SchedulingProblem", "Abstract class that represents a Scheduling Problem")]30 [StorableClass]31 public abstract class SchedulingProblem : SingleObjectiveHeuristicOptimizationProblem<ISchedulingEvaluator, IScheduleCreator> {32 [StorableConstructor]33 protected SchedulingProblem(bool deserializing) : base(deserializing) { }34 protected SchedulingProblem(SchedulingProblem original, Cloner cloner) : base(original, cloner) { }35 protected SchedulingProblem(ISchedulingEvaluator evaluator, IScheduleCreator creator) : base(evaluator, creator) { }36 }37 }28 //namespace HeuristicLab.Problems.Scheduling { 29 // [Item("SchedulingProblem", "Abstract class that represents a Scheduling Problem")] 30 // [StorableClass] 31 // public abstract class SchedulingProblem : SingleObjectiveHeuristicOptimizationProblem<ISchedulingEvaluator, IScheduleCreator> { 32 // [StorableConstructor] 33 // protected SchedulingProblem(bool deserializing) : base(deserializing) { } 34 // protected SchedulingProblem(SchedulingProblem original, Cloner cloner) : base(original, cloner) { } 35 // protected SchedulingProblem(ISchedulingEvaluator evaluator, IScheduleCreator creator) : base(evaluator, creator) { } 36 // } 37 //}
Note: See TracChangeset
for help on using the changeset viewer.