- Timestamp:
- 12/06/15 15:33:25 (9 years ago)
- Location:
- branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3
- Files:
-
- 6 added
- 32 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/GTAlgorithmUtils.cs
r13436 r13437 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using HeuristicLab.Core; 24 25 … … 26 27 public static class GTAlgorithmUtils { 27 28 28 public static ItemList<Task> GetEarliestNotScheduledTasks(I temList<Job> jobData) {29 public static ItemList<Task> GetEarliestNotScheduledTasks(IEnumerable<Job> jobData) { 29 30 ItemList<Task> result = new ItemList<Task>(); 30 31 foreach (Job j in jobData) { … … 38 39 return result; 39 40 } 40 public static Task GetTaskWithMinimalEC(I temList<Task> earliestTasksList, Schedule schedule) {41 public static Task GetTaskWithMinimalEC(IEnumerable<Task> earliestTasksList, Schedule schedule) { 41 42 double minEct = double.MaxValue; 42 43 Task result = null; … … 50 51 return result; 51 52 } 52 public static ItemList<Task> GetConflictSetForTask(Task conflictedTask, I temList<Task> earliestTasksList, ItemList<Job> jobData, Schedule schedule) {53 public static ItemList<Task> GetConflictSetForTask(Task conflictedTask, IEnumerable<Task> earliestTasksList, Schedule schedule) { 53 54 ItemList<Task> result = new ItemList<Task>(); 54 55 double conflictedCompletionTime = ComputeEarliestCompletionTime(conflictedTask, schedule); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/HeuristicLab.Encodings.ScheduleEncoding-3.3.csproj
r13435 r13437 123 123 <Compile Include="Interfaces\IScheduleCrossover.cs" /> 124 124 <Compile Include="Interfaces\ISchedule.cs" /> 125 <Compile Include="Interfaces\IScheduleEncoding.cs" /> 125 126 <Compile Include="Interfaces\IScheduleManipulator.cs" /> 126 127 <Compile Include="Interfaces\IScheduleOperator.cs" /> … … 129 130 <Compile Include="JobSequenceMatrix\Crossovers\JSMOXCrossover.cs" /> 130 131 <Compile Include="JobSequenceMatrix\Crossovers\JSMSXXCrossover.cs" /> 132 <Compile Include="JobSequenceMatrix\JobSequenceMatrixEncoding.cs" /> 131 133 <Compile Include="JobSequenceMatrix\JSMEncoding.cs" /> 132 134 <Compile Include="JobSequenceMatrix\JSMRandomCreator.cs" /> … … 139 141 <Compile Include="PermutationWithRepetition\Manipulators\PWRManipulator.cs" /> 140 142 <Compile Include="PermutationWithRepetition\Manipulators\PWRInsertionManipulator.cs" /> 143 <Compile Include="PermutationWithRepetition\PermutationWithRepetitionEncoding.cs" /> 141 144 <Compile Include="PermutationWithRepetition\PWREncoding.cs" /> 142 145 <Compile Include="PermutationWithRepetition\PWRRandomCreator.cs" /> … … 147 150 <Compile Include="PriorityRulesVector\Manipulators\PRVManipulator.cs" /> 148 151 <Compile Include="PriorityRulesVector\Manipulators\PRVUniformOnePositionManipulator.cs" /> 152 <Compile Include="PriorityRulesVector\PriorityRulesVectorEncoding.cs" /> 149 153 <Compile Include="PriorityRulesVector\PRVEncoding.cs" /> 150 154 <Compile Include="PriorityRulesVector\PRVRandomCreator.cs" /> 151 155 <Compile Include="Properties\AssemblyInfo.cs" /> 156 <Compile Include="ScheduleEncoding.cs" /> 152 157 <Compile Include="ScheduleEncoding\Crossovers\DirectScheduleCrossover.cs" /> 153 158 <Compile Include="ScheduleEncoding\Crossovers\DirectScheduleGTCrossover.cs" /> 154 <Compile Include="ScheduleEncoding\GTAlgorithmUtils.cs" /> 155 <Compile Include="ScheduleEncoding\Job.cs" /> 159 <Compile Include="GTAlgorithmUtils.cs" /> 160 <Compile Include="Job.cs" /> 161 <Compile Include="ScheduleEncoding\DirectScheduleEncoding.cs" /> 156 162 <Compile Include="ScheduleEncoding\Manipulators\DirectScheduleManipulator.cs" /> 157 163 <Compile Include="ScheduleEncoding\DirectScheduleRandomCreator.cs" /> … … 161 167 <Compile Include="ScheduleCreator.cs" /> 162 168 <Compile Include="ScheduleCrossover.cs" /> 163 <Compile Include=" ScheduleEncoding\Task.cs" />169 <Compile Include="Task.cs" /> 164 170 <Compile Include="ScheduleManipulator.cs" /> 165 171 </ItemGroup> -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IDirectScheduleOperator.cs
r12012 r13437 24 24 namespace HeuristicLab.Encodings.ScheduleEncoding { 25 25 public interface IDirectScheduleOperator : IOperator { 26 ILookupParameter<ItemList<Job>> JobDataParameter { get; } 26 27 } 27 28 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/ISchedule.cs
r13435 r13437 20 20 #endregion 21 21 22 using HeuristicLab. Core;22 using HeuristicLab.Optimization; 23 23 24 24 namespace HeuristicLab.Encodings.ScheduleEncoding { 25 public interface ISchedule : I Item{25 public interface ISchedule : ISolution { 26 26 } 27 27 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleCreator.cs
r13435 r13437 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Data; 23 24 using HeuristicLab.Optimization; 24 25 25 26 namespace HeuristicLab.Encodings.ScheduleEncoding { 26 public interface IScheduleCreator : ISolutionCreator , IScheduleOperator {27 public interface IScheduleCreator : ISolutionCreator<ISchedule>, IScheduleOperator { 27 28 ILookupParameter<ISchedule> ScheduleParameter { get; } 29 IValueLookupParameter<IntValue> JobsParameter { get; } 30 IValueLookupParameter<IntValue> ResourcesParameter { get; } 28 31 } 29 32 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMCrossover.cs
r12012 r13437 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 25 26 namespace HeuristicLab.Encodings.ScheduleEncoding .JobSequenceMatrix{26 namespace HeuristicLab.Encodings.ScheduleEncoding { 27 27 [Item("JSMCrossover", "An operator which crosses two JSM representations.")] 28 28 [StorableClass] … … 32 32 protected JSMCrossover(bool deserializing) : base(deserializing) { } 33 33 protected JSMCrossover(JSMCrossover original, Cloner cloner) : base(original, cloner) { } 34 public JSMCrossover() 35 : base() { 36 ParentsParameter.ActualName = "JobSequenceMatrix"; 37 ChildParameter.ActualName = "JobSequenceMatrix"; 38 } 34 35 public JSMCrossover() : base() { } 39 36 40 37 public abstract JSMEncoding Cross(IRandom random, JSMEncoding parent1, JSMEncoding parent2); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMJOXCrossover.cs
r12012 r13437 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 28 namespace HeuristicLab.Encodings.ScheduleEncoding .JobSequenceMatrix{28 namespace HeuristicLab.Encodings.ScheduleEncoding { 29 29 [Item("JSMJobbasedOrderCrossover", "Represents a crossover operation swapping subsequences of the parents to generate offspring.")] 30 30 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMOXCrossover.cs
r12012 r13437 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 25 26 namespace HeuristicLab.Encodings.ScheduleEncoding .JobSequenceMatrix{26 namespace HeuristicLab.Encodings.ScheduleEncoding { 27 27 [Item("JSMOrderCrossover", "Represents a crossover operation swapping sequences of the parents to generate offspring.")] 28 28 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMSXXCrossover.cs
r12012 r13437 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 27 namespace HeuristicLab.Encodings.ScheduleEncoding .JobSequenceMatrix{27 namespace HeuristicLab.Encodings.ScheduleEncoding { 28 28 [Item("JSMSubsequenceExchangeCrossover", "Represents a crossover operation identifiying and exchanging equal subsequences of the parents to generate offspring.")] 29 29 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JSMEncoding.cs
r13435 r13437 20 20 #endregion 21 21 22 using System;23 22 using System.Text; 24 23 using HeuristicLab.Common; … … 27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 29 namespace HeuristicLab.Encodings.ScheduleEncoding .JobSequenceMatrix{28 namespace HeuristicLab.Encodings.ScheduleEncoding { 30 29 [Item("JobSequenceMatrixEncoding", "Represents an encoding for a scheduling Problem using a list of job sequences to deliver scheduleinformation.")] 31 30 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JSMRandomCreator.cs
r13435 r13437 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data;25 24 using HeuristicLab.Encodings.PermutationEncoding; 26 25 using HeuristicLab.Optimization; … … 28 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 28 30 namespace HeuristicLab.Encodings.ScheduleEncoding .JobSequenceMatrix{29 namespace HeuristicLab.Encodings.ScheduleEncoding { 31 30 [Item("JobSequenceMatrixCreator", "Creator class used to create Job Sequence Matrix solutions for standard JobShop scheduling problems.")] 32 31 [StorableClass] … … 35 34 public ILookupParameter<IRandom> RandomParameter { 36 35 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 37 }38 public IValueLookupParameter<IntValue> JobsParameter {39 get { return (IValueLookupParameter<IntValue>)Parameters["Jobs"]; }40 }41 public IValueLookupParameter<IntValue> ResourcesParameter {42 get { return (IValueLookupParameter<IntValue>)Parameters["Resources"]; }43 36 } 44 37 … … 49 42 : base() { 50 43 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator.")); 51 Parameters.Add(new ValueLookupParameter<IntValue>("Jobs", "The number of jobs handled in this problem instance."));52 Parameters.Add(new ValueLookupParameter<IntValue>("Resources", "The number of resources used in this problem instance."));53 54 ScheduleParameter.ActualName = "JobSequenceMatrix";55 44 } 56 45 -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMManipulator.cs
r13435 r13437 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 27 namespace HeuristicLab.Encodings.ScheduleEncoding .JobSequenceMatrix{27 namespace HeuristicLab.Encodings.ScheduleEncoding { 28 28 [Item("JSMManipulator", "An operator which manipulates a JSM representation.")] 29 29 [StorableClass] … … 32 32 protected JSMManipulator(bool deserializing) : base(deserializing) { } 33 33 protected JSMManipulator(JSMManipulator original, Cloner cloner) : base(original, cloner) { } 34 public JSMManipulator() 35 : base() { 36 ScheduleParameter.ActualName = "JobSequenceMatrix"; 37 } 34 public JSMManipulator() : base() { } 38 35 39 36 protected abstract void Manipulate(IRandom random, ISchedule individual); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMShiftChangeManipulator.cs
r13435 r13437 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 29 30 namespace HeuristicLab.Encodings.ScheduleEncoding .JobSequenceMatrix{30 namespace HeuristicLab.Encodings.ScheduleEncoding { 31 31 [Item("JSMShiftChangeManipulator", "Represents a manipulation operation where the operations of a randomly determined job are shifted in one direction for all resources.")] 32 32 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMSwapManipulator.cs
r13435 r13437 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 28 namespace HeuristicLab.Encodings.ScheduleEncoding .JobSequenceMatrix{28 namespace HeuristicLab.Encodings.ScheduleEncoding { 29 29 [Item("JSMSwapManipulator", "Represents a manipulation operation swapping parts of the individual.")] 30 30 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Crossovers/PWRCrossover.cs
r12012 r13437 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 25 26 namespace HeuristicLab.Encodings.ScheduleEncoding .PermutationWithRepetition{26 namespace HeuristicLab.Encodings.ScheduleEncoding { 27 27 [Item("PWRCrossover", "An operator which crosses two JSM representations.")] 28 28 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Crossovers/PWRGOXCrossover.cs
r12012 r13437 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 28 29 namespace HeuristicLab.Encodings.ScheduleEncoding .PermutationWithRepetition{29 namespace HeuristicLab.Encodings.ScheduleEncoding { 30 30 [Item("PWRGeneralizationOrderCrossover", "Represents a crossover operation swapping sequences of the parents to generate offspring.")] 31 31 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Crossovers/PWRPPXCrossover.cs
r12012 r13437 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 28 29 namespace HeuristicLab.Encodings.ScheduleEncoding .PermutationWithRepetition{29 namespace HeuristicLab.Encodings.ScheduleEncoding { 30 30 [Item("PWRPPXCrossover", "Represents a crossover operation swapping sequences of the parents to generate offspring.")] 31 31 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Manipulators/PWRInsertionManipulator.cs
r12012 r13437 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 28 29 namespace HeuristicLab.Encodings.ScheduleEncoding .PermutationWithRepetition{29 namespace HeuristicLab.Encodings.ScheduleEncoding { 30 30 [Item("PWRInsertionManipulator", "Represents a manipulation operation inserting parts of the individual at another position.")] 31 31 [StorableClass] … … 43 43 int cutIndex = random.Next(individual.PermutationWithRepetition.Length); 44 44 int insertIndex = random.Next(individual.PermutationWithRepetition.Length); 45 List<int> perm = ((IntegerVector)(individual.PermutationWithRepetition.Clone())).ToList <int>();45 List<int> perm = ((IntegerVector)(individual.PermutationWithRepetition.Clone())).ToList(); 46 46 int aux = perm[cutIndex]; 47 47 if (cutIndex > insertIndex) { -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Manipulators/PWRManipulator.cs
r13435 r13437 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 27 namespace HeuristicLab.Encodings.ScheduleEncoding .PermutationWithRepetition{27 namespace HeuristicLab.Encodings.ScheduleEncoding { 28 28 [Item("PWRManipulator", "An operator which manipulates a PWR representation.")] 29 29 [StorableClass] … … 33 33 protected PWRManipulator(bool deserializing) : base(deserializing) { } 34 34 protected PWRManipulator(PWRManipulator original, Cloner cloner) : base(original, cloner) { } 35 public PWRManipulator() 36 : base() { 37 ScheduleParameter.ActualName = "PermutationWithRepetition"; 38 } 35 public PWRManipulator() : base() { } 39 36 40 37 protected abstract void Manipulate(IRandom random, PWREncoding individual); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWREncoding.cs
r13435 r13437 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 28 namespace HeuristicLab.Encodings.ScheduleEncoding .PermutationWithRepetition{28 namespace HeuristicLab.Encodings.ScheduleEncoding { 29 29 [Item("PermutationWithRepetitionEncoding", "Represents a encoding for a standard JobShop Scheduling Problem.")] 30 30 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWRRandomCreator.cs
r13435 r13437 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data;25 24 using HeuristicLab.Optimization; 26 25 using HeuristicLab.Parameters; 27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 29 namespace HeuristicLab.Encodings.ScheduleEncoding .PermutationWithRepetition{28 namespace HeuristicLab.Encodings.ScheduleEncoding { 30 29 [Item("PermutationWithRepetitionRandomCreator", "Creates PWR-individuals at random.")] 31 30 [StorableClass] … … 34 33 public ILookupParameter<IRandom> RandomParameter { 35 34 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 36 }37 public IValueLookupParameter<IntValue> JobsParameter {38 get { return (IValueLookupParameter<IntValue>)Parameters["Jobs"]; }39 }40 public IValueLookupParameter<IntValue> ResourcesParameter {41 get { return (IValueLookupParameter<IntValue>)Parameters["Resources"]; }42 35 } 43 36 … … 48 41 : base() { 49 42 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator.")); 50 Parameters.Add(new ValueLookupParameter<IntValue>("Jobs", "The number of jobs handled in this problem instance."));51 Parameters.Add(new ValueLookupParameter<IntValue>("Resources", "The number of resources used in this problem instance."));52 53 ScheduleParameter.ActualName = "PermutationWithRepetition";54 43 } 55 44 -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVCrossover.cs
r12012 r13437 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 25 26 namespace HeuristicLab.Encodings.ScheduleEncoding .PriorityRulesVector{26 namespace HeuristicLab.Encodings.ScheduleEncoding { 27 27 [Item("PRVCrossover", "An operator which crosses two PRV representations.")] 28 28 [StorableClass] … … 32 32 protected PRVCrossover(bool deserializing) : base(deserializing) { } 33 33 protected PRVCrossover(PRVCrossover original, Cloner cloner) : base(original, cloner) { } 34 public PRVCrossover() 35 : base() { 36 ParentsParameter.ActualName = "PriorityRulesVector"; 37 ChildParameter.ActualName = "PriorityRulesVector"; 38 } 34 public PRVCrossover() : base() { } 39 35 40 36 public abstract PRVEncoding Cross(IRandom random, PRVEncoding parent1, PRVEncoding parent2); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVDiscreteCrossover.cs
r12012 r13437 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 27 namespace HeuristicLab.Encodings.ScheduleEncoding .PriorityRulesVector{27 namespace HeuristicLab.Encodings.ScheduleEncoding { 28 28 [Item("PRVDiscreteCrossover", "Represents a crossover operation swapping sequences of the parents to generate offspring.")] 29 29 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVSinglePointCrossover.cs
r12012 r13437 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 27 namespace HeuristicLab.Encodings.ScheduleEncoding .PriorityRulesVector{27 namespace HeuristicLab.Encodings.ScheduleEncoding { 28 28 [Item("PRVSinglePointCrossover", "Represents a crossover operation swapping sequences of the parents to generate offspring.")] 29 29 [StorableClass] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVManipulator.cs
r13435 r13437 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 27 namespace HeuristicLab.Encodings.ScheduleEncoding .PriorityRulesVector{27 namespace HeuristicLab.Encodings.ScheduleEncoding { 28 28 [Item("PRVManipulator", "An operator which manipulates a PRV representation.")] 29 29 [StorableClass] … … 32 32 protected PRVManipulator(bool deserializing) : base(deserializing) { } 33 33 protected PRVManipulator(PRVManipulator original, Cloner cloner) : base(original, cloner) { } 34 public PRVManipulator() 35 : base() { 36 ScheduleParameter.ActualName = "PriorityRulesVector"; 37 } 34 public PRVManipulator() : base() { } 38 35 39 36 protected abstract void Manipulate(IRandom random, PRVEncoding individual); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVUniformOnePositionManipulator.cs
r12012 r13437 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 28 namespace HeuristicLab.Encodings.ScheduleEncoding .PriorityRulesVector{28 namespace HeuristicLab.Encodings.ScheduleEncoding { 29 29 [Item("PRVUniformOnePositionManipulator", "Represents a manipulation operation inserting parts of the individual at another position.")] 30 30 [StorableClass] … … 41 41 42 42 public static void Apply(IRandom random, PRVEncoding individual) { 43 UniformOnePositionManipulator.Apply(random, individual.PriorityRulesVector, new IntMatrix(new int[,] { { 0, individual.NrOfRules .Value} }));43 UniformOnePositionManipulator.Apply(random, individual.PriorityRulesVector, new IntMatrix(new int[,] { { 0, individual.NrOfRules } })); 44 44 } 45 45 -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVEncoding.cs
r13435 r13437 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Data;26 25 using HeuristicLab.Encodings.IntegerVectorEncoding; 27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 29 namespace HeuristicLab.Encodings.ScheduleEncoding .PriorityRulesVector{28 namespace HeuristicLab.Encodings.ScheduleEncoding { 30 29 [Item("PriorityRulesVectorEncoding", "Represents an encoding for a Scheduling Problem.")] 31 30 [StorableClass] … … 35 34 36 35 [Storable] 37 private IntValue nrOfRules; 38 public IntValue NrOfRules { 39 get { 40 return nrOfRules; 41 } 42 } 36 public int NrOfRules { get; private set; } 43 37 44 38 [StorableConstructor] … … 46 40 protected PRVEncoding(PRVEncoding original, Cloner cloner) 47 41 : base(original, cloner) { 48 this. nrOfRules = cloner.Clone(original.NrOfRules);42 this.NrOfRules = original.NrOfRules; 49 43 this.PriorityRulesVector = cloner.Clone(original.PriorityRulesVector); 50 44 } 51 45 public PRVEncoding(int nrOfRules) 52 46 : base() { 53 this. nrOfRules = new IntValue(nrOfRules);47 this.NrOfRules = nrOfRules; 54 48 this.PriorityRulesVector = new IntegerVector(); 55 49 } 56 public PRVEncoding(IntegerVector iv, IntValuenrOfRules)50 public PRVEncoding(IntegerVector iv, int nrOfRules) 57 51 : base() { 58 this. nrOfRules = (IntValue)nrOfRules.Clone();52 this.NrOfRules = nrOfRules; 59 53 this.PriorityRulesVector = (IntegerVector)iv.Clone(); 60 54 } 61 public PRVEncoding(int length, IRandom random, int min, int max, IntValuenrOfRules)55 public PRVEncoding(int length, IRandom random, int min, int max, int nrOfRules) 62 56 : base() { 63 this. nrOfRules = (IntValue)nrOfRules.Clone();57 this.NrOfRules = nrOfRules; 64 58 this.PriorityRulesVector = new IntegerVector(length, random, min, max); 65 59 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVRandomCreator.cs
r13435 r13437 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data;25 24 using HeuristicLab.Optimization; 26 25 using HeuristicLab.Parameters; 27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 29 namespace HeuristicLab.Encodings.ScheduleEncoding .PriorityRulesVector{28 namespace HeuristicLab.Encodings.ScheduleEncoding { 30 29 [Item("PriorityRulesRandomCreator", "Creator class used to create PRV encoding objects for scheduling problems.")] 31 30 [StorableClass] … … 33 32 34 33 [Storable] 35 public IntValueNrOfRules { get; set; }34 public int NrOfRules { get; set; } 36 35 37 36 public ILookupParameter<IRandom> RandomParameter { 38 37 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 39 }40 public IValueLookupParameter<IntValue> JobsParameter {41 get { return (IValueLookupParameter<IntValue>)Parameters["Jobs"]; }42 }43 public IValueLookupParameter<IntValue> ResourcesParameter {44 get { return (IValueLookupParameter<IntValue>)Parameters["Resources"]; }45 38 } 46 39 … … 49 42 protected PRVRandomCreator(PRVRandomCreator original, Cloner cloner) 50 43 : base(original, cloner) { 51 this.NrOfRules = cloner.Clone(original.NrOfRules);44 this.NrOfRules = original.NrOfRules; 52 45 } 53 public PRVRandomCreator()54 : base() {55 NrOfRules = new IntValue(10);56 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator."));57 Parameters.Add(new ValueLookupParameter<IntValue>("Jobs", "The number of jobs handled in this problem instance."));58 Parameters.Add(new ValueLookupParameter<IntValue>("Resources", "The number of resources used in this problem instance."));59 ScheduleParameter.ActualName = "PriorityRulesVector";60 }61 62 46 public override IDeepCloneable Clone(Cloner cloner) { 63 47 return new PRVRandomCreator(this, cloner); 64 48 } 65 49 66 public static PRVEncoding Apply(int jobs, int resources, IRandom random, IntValue nrOfRules) { 67 return new PRVEncoding(jobs * resources, random, 0, nrOfRules.Value, nrOfRules); 50 public PRVRandomCreator() 51 : base() { 52 NrOfRules = 10; 53 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator.")); 54 } 55 56 public static PRVEncoding Apply(int jobs, int resources, IRandom random, int nrOfRules) { 57 return new PRVEncoding(jobs * resources, random, 0, nrOfRules, nrOfRules); 68 58 } 69 59 … … 71 61 return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue, NrOfRules); 72 62 } 73 74 75 63 } 76 64 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleCreator.cs
r13435 r13437 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 24 25 using HeuristicLab.Operators; 25 26 using HeuristicLab.Parameters; … … 34 35 get { return (ILookupParameter<ISchedule>)Parameters["Schedule"]; } 35 36 } 37 public IValueLookupParameter<IntValue> JobsParameter { 38 get { return (IValueLookupParameter<IntValue>)Parameters["Jobs"]; } 39 } 40 public IValueLookupParameter<IntValue> ResourcesParameter { 41 get { return (IValueLookupParameter<IntValue>)Parameters["Resources"]; } 42 } 36 43 37 44 [StorableConstructor] … … 40 47 public ScheduleCreator() 41 48 : base() { 42 Parameters.Add(new LookupParameter<ISchedule>("Schedule", "The new scheduling solutioncandidate.")); 49 Parameters.Add(new LookupParameter<ISchedule>("Schedule", "The new scheduling solution candidate.")); 50 Parameters.Add(new ValueLookupParameter<IntValue>("Jobs", "The number of jobs handled in this problem instance.")); 51 Parameters.Add(new ValueLookupParameter<IntValue>("Resources", "The number of resources used in this problem instance.")); 43 52 } 44 53 -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Crossovers/DirectScheduleCrossover.cs
r12012 r13437 29 29 [StorableClass] 30 30 public abstract class DirectScheduleCrossover : ScheduleCrossover, IDirectScheduleOperator { 31 public ILookupParameter<ItemList<Job>> JobDataParameter { 32 get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; } 33 } 34 31 35 [StorableConstructor] 32 36 protected DirectScheduleCrossover(bool deserializing) : base(deserializing) { } … … 34 38 public DirectScheduleCrossover() 35 39 : base() { 36 ParentsParameter.ActualName = "Schedule";37 ChildParameter.ActualName = "Schedule";38 40 Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the JSSP - Instance.")); 39 }40 41 public ILookupParameter<ItemList<Job>> JobDataParameter {42 get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; }43 41 } 44 42 -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Crossovers/DirectScheduleGTCrossover.cs
r12012 r13437 64 64 Task minimal = GTAlgorithmUtils.GetTaskWithMinimalEC(earliestTasksList, child); 65 65 int conflictedResourceNr = minimal.ResourceNr; 66 Resource conflictedResource = child.Resources[conflictedResourceNr];67 66 68 67 //STEP 2 - Compute a conflict set of all operations that can be scheduled on the conflicted resource 69 ItemList<Task> conflictSet = GTAlgorithmUtils.GetConflictSetForTask(minimal, earliestTasksList, jobData,child);68 ItemList<Task> conflictSet = GTAlgorithmUtils.GetConflictSetForTask(minimal, earliestTasksList, child); 70 69 71 70 //STEP 3 - Select a task from the conflict set 72 int progressOnResource = conflictedResource.Tasks.Count;73 71 Task selectedTask = null; 74 72 if (random.NextDouble() < mutProp) { … … 77 75 } else { 78 76 //Crossover 79 selectedTask = SelectTaskFromConflictSet(conflictSet, ((random.Next(2) == 0) ? parent1 : parent2), conflictedResourceNr , progressOnResource);77 selectedTask = SelectTaskFromConflictSet(conflictSet, ((random.Next(2) == 0) ? parent1 : parent2), conflictedResourceNr); 80 78 } 81 79 … … 92 90 } 93 91 94 private static Task SelectTaskFromConflictSet(ItemList<Task> conflictSet, Schedule usedParent, int conflictedResourceNr , int progressOnResource) {92 private static Task SelectTaskFromConflictSet(ItemList<Task> conflictSet, Schedule usedParent, int conflictedResourceNr) { 95 93 //Apply Crossover 96 94 foreach (ScheduledTask st in usedParent.Resources[conflictedResourceNr].Tasks) { -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/DirectScheduleRandomCreator.cs
r13435 r13437 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Data;26 using HeuristicLab.Encodings.ScheduleEncoding.PermutationWithRepetition;27 25 using HeuristicLab.Optimization; 28 26 using HeuristicLab.Parameters; … … 33 31 [Item("DirectScheduleRandomCreator", "Creator class used to create schedule encoding objects.")] 34 32 [StorableClass] 35 public class DirectScheduleRandomCreator : ScheduleCreator, IStochasticOperator {33 public class DirectScheduleRandomCreator : ScheduleCreator, IStochasticOperator, IDirectScheduleOperator { 36 34 37 35 public ILookupParameter<IRandom> RandomParameter { 38 36 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 39 37 } 40 public IValueLookupParameter<IntValue> JobsParameter {41 get { return (IValueLookupParameter<IntValue>)Parameters["Jobs"]; }42 }43 public IValueLookupParameter<IntValue> ResourcesParameter {44 get { return (IValueLookupParameter<IntValue>)Parameters["Resources"]; }45 }46 38 public ILookupParameter<ItemList<Job>> JobDataParameter { 47 39 get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; } 48 40 } 49 50 41 51 42 [StorableConstructor] … … 60 51 : base() { 61 52 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator.")); 62 Parameters.Add(new ValueLookupParameter<IntValue>("Jobs", "The number of jobs handled in this problem instance."));63 Parameters.Add(new ValueLookupParameter<IntValue>("Resources", "The number of resources used in this problem instance."));64 53 Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the JSSP - Instance.")); 65 ScheduleParameter.ActualName = "Schedule";66 54 } 67 55 … … 89 77 new PWREncoding(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue), 90 78 jobData); 91 } catch { 79 } 80 catch { 92 81 throw new Exception("ScheduleRandomCreator needs JobData parameter from a JSSP-Instance to create Schedule-Instances!"); 93 82 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Manipulators/DirectScheduleManipulator.cs
r13435 r13437 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Parameters; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 27 … … 29 30 [StorableClass] 30 31 public abstract class DirectScheduleManipulator : ScheduleManipulator, IDirectScheduleOperator { 32 public ILookupParameter<ItemList<Job>> JobDataParameter { 33 get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; } 34 } 31 35 32 36 [StorableConstructor] 33 37 protected DirectScheduleManipulator(bool deserializing) : base(deserializing) { } 34 38 protected DirectScheduleManipulator(DirectScheduleManipulator original, Cloner cloner) : base(original, cloner) { } 39 35 40 public DirectScheduleManipulator() 36 41 : base() { 37 ScheduleParameter.ActualName = "Schedule";42 Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the JSSP - Instance.")); 38 43 } 39 44 … … 42 47 public override IOperation InstrumentedApply() { 43 48 var schedule = ScheduleParameter.ActualValue as Schedule; 44 if (schedule == null) throw new InvalidOperationException("Schedule Encodingwas not found or is not of type Schedule.");49 if (schedule == null) throw new InvalidOperationException("Schedule was not found or is not of type Schedule."); 45 50 Manipulate(RandomParameter.ActualValue, schedule); 46 51 return base.InstrumentedApply();
Note: See TracChangeset
for help on using the changeset viewer.