- Timestamp:
- 11/11/12 22:57:09 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVCrossover.cs
r8603 r8887 27 27 [Item("PRVCrossover", "An operator which crosses two PRV representations.")] 28 28 [StorableClass] 29 public abstract class PRVCrossover : ScheduleCrossover<PRVEncoding>, IPRVOperator { 29 public abstract class PRVCrossover : ScheduleCrossover, IPRVOperator { 30 30 31 [StorableConstructor] 31 32 protected PRVCrossover(bool deserializing) : base(deserializing) { } … … 37 38 } 38 39 39 40 40 public abstract PRVEncoding Cross(IRandom random, PRVEncoding parent1, PRVEncoding parent2); 41 41 42 42 public override IOperation Apply() { 43 ItemArray<PRVEncoding>parents = ParentsParameter.ActualValue;43 var parents = ParentsParameter.ActualValue; 44 44 ChildParameter.ActualValue = 45 45 Cross(RandomParameter.ActualValue, parents[0] as PRVEncoding, parents[1] as PRVEncoding); -
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVDiscreteCrossover.cs
r8603 r8887 29 29 [StorableClass] 30 30 public class PRVDiscreteCrossover : PRVCrossover { 31 31 32 [StorableConstructor] 32 33 protected PRVDiscreteCrossover(bool deserializing) : base(deserializing) { } 33 protected PRVDiscreteCrossover(PRVDiscreteCrossover original, Cloner cloner) 34 : base(original, cloner) {35 } 34 protected PRVDiscreteCrossover(PRVDiscreteCrossover original, Cloner cloner) : base(original, cloner) { } 35 public PRVDiscreteCrossover() : base() { } 36 36 37 public override IDeepCloneable Clone(Cloner cloner) { 37 38 return new PRVDiscreteCrossover(this, cloner); 38 39 } 39 public PRVDiscreteCrossover() : base() { }40 41 40 42 41 public static PRVEncoding Apply(IRandom random, PRVEncoding parent1, PRVEncoding parent2) { 43 42 return new PRVEncoding(DiscreteCrossover.Apply(random, new ItemArray<IntegerVector>(new IntegerVector[] { parent1.PriorityRulesVector, parent2.PriorityRulesVector })), parent1.NrOfRules); 44 43 } 44 45 45 public override PRVEncoding Cross(IRandom random, PRVEncoding parent1, PRVEncoding parent2) { 46 46 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVSinglePointCrossover.cs
r8603 r8887 29 29 [StorableClass] 30 30 public class PRVSinglePointCrossover : PRVCrossover { 31 31 32 [StorableConstructor] 32 33 protected PRVSinglePointCrossover(bool deserializing) : base(deserializing) { } 33 protected PRVSinglePointCrossover(PRVSinglePointCrossover original, Cloner cloner) 34 : base(original, cloner) {35 } 34 protected PRVSinglePointCrossover(PRVSinglePointCrossover original, Cloner cloner) : base(original, cloner) { } 35 public PRVSinglePointCrossover() : base() { } 36 36 37 public override IDeepCloneable Clone(Cloner cloner) { 37 38 return new PRVSinglePointCrossover(this, cloner); 38 39 } 39 public PRVSinglePointCrossover() : base() { }40 40 41 41 public static PRVEncoding Apply(IRandom random, PRVEncoding parent1, PRVEncoding parent2) { -
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVManipulator.cs
r8603 r8887 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 27 28 [Item("PRVManipulator", "An operator which manipulates a PRV representation.")] 28 29 [StorableClass] 29 public abstract class PRVManipulator : ScheduleManipulator <PRVEncoding>, IPRVOperator {30 public abstract class PRVManipulator : ScheduleManipulator, IPRVOperator { 30 31 [StorableConstructor] 31 32 protected PRVManipulator(bool deserializing) : base(deserializing) { } … … 36 37 } 37 38 39 protected abstract void Manipulate(IRandom random, PRVEncoding individual); 38 40 39 protected abstract void Manipulate(IRandom random, PRVEncoding individual);40 41 public override IOperation Apply() { 41 PRVEncoding solution = ScheduleEncodingParameter.ActualValue; 42 var solution = ScheduleEncodingParameter.ActualValue as PRVEncoding; 43 if (solution == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type PRVEncoding."); 42 44 Manipulate(RandomParameter.ActualValue, solution); 43 45 return base.Apply(); -
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVUniformOnePositionManipulator.cs
r8882 r8887 27 27 28 28 namespace HeuristicLab.Encodings.ScheduleEncoding.PriorityRulesVector { 29 30 29 [Item("PRVUniformOnePositionManipulator", "Represents a manipulation operation inserting parts of the individual at another position.")] 31 30 [StorableClass] 32 31 public class PRVUniformOnePositionManipulator : PRVManipulator { 32 33 33 [StorableConstructor] 34 34 protected PRVUniformOnePositionManipulator(bool deserializing) : base(deserializing) { } 35 protected PRVUniformOnePositionManipulator(PRVUniformOnePositionManipulator original, Cloner cloner) 36 : base(original, cloner) {37 } 35 protected PRVUniformOnePositionManipulator(PRVUniformOnePositionManipulator original, Cloner cloner) : base(original, cloner) { } 36 public PRVUniformOnePositionManipulator() : base() { } 37 38 38 public override IDeepCloneable Clone(Cloner cloner) { 39 39 return new PRVUniformOnePositionManipulator(this, cloner); 40 40 } 41 public PRVUniformOnePositionManipulator() : base() { }42 43 41 44 42 public static void Apply(IRandom random, PRVEncoding individual) { -
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVEncoding.cs
r8603 r8887 42 42 } 43 43 44 45 44 [StorableConstructor] 46 45 protected PRVEncoding(bool deserializing) : base(deserializing) { } … … 49 48 this.nrOfRules = cloner.Clone(original.NrOfRules); 50 49 this.PriorityRulesVector = cloner.Clone(original.PriorityRulesVector); 51 }52 public override IDeepCloneable Clone(Cloner cloner) {53 return new PRVEncoding(this, cloner);54 50 } 55 51 public PRVEncoding(int nrOfRules) … … 69 65 } 70 66 67 public override IDeepCloneable Clone(Cloner cloner) { 68 return new PRVEncoding(this, cloner); 69 } 71 70 72 71 public override string ToString() { -
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVRandomCreator.cs
r8603 r8887 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 28 29 30 29 namespace HeuristicLab.Encodings.ScheduleEncoding.PriorityRulesVector { 31 30 [Item("PriorityRulesRandomCreator", "Creator class used to create PRV encoding objects for scheduling problems.")] 32 31 [StorableClass] 33 public class PRVRandomCreator : ScheduleCreator<PRVEncoding>, IStochasticOperator { 32 public class PRVRandomCreator : ScheduleCreator, IStochasticOperator { 33 34 34 [Storable] 35 35 public IntValue NrOfRules { get; set; } … … 45 45 } 46 46 47 48 47 [StorableConstructor] 49 48 protected PRVRandomCreator(bool deserializing) : base(deserializing) { } … … 51 50 : base(original, cloner) { 52 51 this.NrOfRules = cloner.Clone(original.NrOfRules); 53 }54 public override IDeepCloneable Clone(Cloner cloner) {55 return new PRVRandomCreator(this, cloner);56 52 } 57 53 public PRVRandomCreator() … … 64 60 } 65 61 62 public override IDeepCloneable Clone(Cloner cloner) { 63 return new PRVRandomCreator(this, cloner); 64 } 65 66 66 public static PRVEncoding Apply(int jobs, int resources, IRandom random, IntValue nrOfRules) { 67 67 return new PRVEncoding(jobs * resources, random, 0, nrOfRules.Value, nrOfRules); 68 68 } 69 69 70 protected override PRVEncoding CreateSolution() {70 protected override IScheduleEncoding CreateSolution() { 71 71 return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue, NrOfRules); 72 72 }
Note: See TracChangeset
for help on using the changeset viewer.