Changeset 17461 for branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector
- Timestamp:
- 02/28/20 16:23:01 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector
- Files:
-
- 1 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVCrossover.cs
r17226 r17461 34 34 public PRVCrossover() : base() { } 35 35 36 public abstract PRV Encoding Cross(IRandom random, PRVEncoding parent1, PRVEncodingparent2);36 public abstract PRV Cross(IRandom random, PRV parent1, PRV parent2); 37 37 38 38 public override IOperation InstrumentedApply() { 39 39 var parents = ParentsParameter.ActualValue; 40 40 ChildParameter.ActualValue = 41 Cross(RandomParameter.ActualValue, parents[0] as PRV Encoding, parents[1] as PRVEncoding);41 Cross(RandomParameter.ActualValue, parents[0] as PRV, parents[1] as PRV); 42 42 return base.InstrumentedApply(); 43 43 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVDiscreteCrossover.cs
r17226 r17461 39 39 } 40 40 41 public static PRV Encoding Apply(IRandom random, PRVEncoding parent1, PRVEncodingparent2) {41 public static PRV Apply(IRandom random, PRV parent1, PRV parent2) { 42 42 var randomSeed = random.Next(); 43 43 var integerVector = DiscreteCrossover.Apply(random, new ItemArray<IntegerVector>(new[] { parent1.PriorityRulesVector, parent2.PriorityRulesVector })); 44 return new PRV Encoding(integerVector, randomSeed);44 return new PRV(integerVector, randomSeed); 45 45 } 46 46 47 public override PRV Encoding Cross(IRandom random, PRVEncoding parent1, PRVEncodingparent2) {47 public override PRV Cross(IRandom random, PRV parent1, PRV parent2) { 48 48 return Apply(random, parent1, parent2); 49 49 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVSinglePointCrossover.cs
r17226 r17461 39 39 } 40 40 41 public static PRV Encoding Apply(IRandom random, PRVEncoding parent1, PRVEncodingparent2) {41 public static PRV Apply(IRandom random, PRV parent1, PRV parent2) { 42 42 var randomSeed = random.Next(); 43 43 var integerVector = SinglePointCrossover.Apply(random, parent1.PriorityRulesVector, parent2.PriorityRulesVector); 44 return new PRV Encoding(integerVector, randomSeed);44 return new PRV(integerVector, randomSeed); 45 45 } 46 46 47 public override PRV Encoding Cross(IRandom random, PRVEncoding parent1, PRVEncodingparent2) {47 public override PRV Cross(IRandom random, PRV parent1, PRV parent2) { 48 48 return Apply(random, parent1, parent2); 49 49 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Decoder/PRVDecoder.cs
r16725 r17461 29 29 [Item("JobSequencingMatrixDecoder", "Applies the GifflerThompson algorithm to create an active schedule from a JobSequencing Matrix.")] 30 30 [StorableType("2D059957-AC7C-4B33-BADE-96706AEBAF29")] 31 public class PRVDecoder : ScheduleDecoder<PRV Encoding>{31 public class PRVDecoder : ScheduleDecoder<PRV>, IPRVOperator { 32 32 #region Priority Rules 33 33 //smallest number of remaining tasks … … 187 187 } 188 188 189 public override Schedule DecodeSchedule(PRV Encodingencoding, ItemList<Job> jobData) {189 public override Schedule DecodeSchedule(PRV encoding, ItemList<Job> jobData) { 190 190 return Decode(encoding, jobData); 191 191 } 192 192 193 public static Schedule Decode(PRV Encodingsolution, ItemList<Job> jobData) {193 public static Schedule Decode(PRV solution, ItemList<Job> jobData) { 194 194 var random = new FastRandom(solution.RandomSeed); 195 195 var jobs = (ItemList<Job>)jobData.Clone(); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVManipulator.cs
r17226 r17461 46 46 } 47 47 48 protected abstract void Manipulate(IRandom random, PRV Encodingindividual, int numberOfRules);48 protected abstract void Manipulate(IRandom random, PRV individual, int numberOfRules); 49 49 50 50 public override IOperation InstrumentedApply() { 51 var solution = ScheduleParameter.ActualValue as PRV Encoding;51 var solution = ScheduleParameter.ActualValue as PRV; 52 52 if (solution == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type PRVEncoding."); 53 53 Manipulate(RandomParameter.ActualValue, solution, NumberOfRulesParameter.ActualValue.Value); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVUniformOnePositionManipulator.cs
r17226 r17461 40 40 } 41 41 42 public static void Apply(IRandom random, PRV Encodingindividual, int numberOfRules) {42 public static void Apply(IRandom random, PRV individual, int numberOfRules) { 43 43 UniformOnePositionManipulator.Apply(random, individual.PriorityRulesVector, new IntMatrix(new int[,] { { 0, numberOfRules } })); 44 44 } 45 45 46 protected override void Manipulate(IRandom random, PRV Encodingindividual, int numberOfRules) {46 protected override void Manipulate(IRandom random, PRV individual, int numberOfRules) { 47 47 Apply(random, individual, numberOfRules); 48 48 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVRandomCreator.cs
r17226 r17461 29 29 [Item("PriorityRulesRandomCreator", "Creator class used to create PRV encoding objects for scheduling problems.")] 30 30 [StorableType("5FF2A11E-86F9-4A8B-8E1C-713D6801506C")] 31 public class PRVRandomCreator : ScheduleCreator<PRV Encoding>, IStochasticOperator {31 public class PRVRandomCreator : ScheduleCreator<PRV>, IStochasticOperator { 32 32 33 33 [Storable] … … 54 54 } 55 55 56 public static PRV EncodingApply(int jobs, int resources, IRandom random, int nrOfRules) {57 return new PRV Encoding(jobs * resources, random, 0, nrOfRules);56 public static PRV Apply(int jobs, int resources, IRandom random, int nrOfRules) { 57 return new PRV(jobs * resources, random, 0, nrOfRules); 58 58 } 59 59 60 protected override PRV EncodingCreateSolution() {60 protected override PRV CreateSolution() { 61 61 return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue, NrOfRules); 62 62 } -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PriorityRulesVectorEncoding.cs
r16725 r17461 34 34 namespace HeuristicLab.Encodings.ScheduleEncoding { 35 35 [StorableType("9C419EE5-F3A8-4F06-8263-7D37D3AE1C72")] 36 public sealed class PriorityRulesVectorEncoding : ScheduleEncoding<PRV Encoding> {36 public sealed class PriorityRulesVectorEncoding : ScheduleEncoding<PRV> { 37 37 38 38 private IFixedValueParameter<IntValue> numberOfRulesParameter; … … 60 60 61 61 public PriorityRulesVectorEncoding() 62 : base( ) {62 : base("PRV") { 63 63 //TODO change to meaningful value 64 64 numberOfRulesParameter = new FixedValueParameter<IntValue>(Name + ".NumberOfRules", new IntValue(10));
Note: See TracChangeset
for help on using the changeset viewer.