Changeset 8887 for trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators
- Timestamp:
- 11/11/12 22:57:09 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMManipulator.cs
r8603 r8887 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 27 28 [Item("JSMManipulator", "An operator which manipulates a JSM representation.")] 28 29 [StorableClass] 29 public abstract class JSMManipulator : ScheduleManipulator <JSMEncoding>, IJSMOperator {30 public abstract class JSMManipulator : ScheduleManipulator, IJSMOperator { 30 31 [StorableConstructor] 31 32 protected JSMManipulator(bool deserializing) : base(deserializing) { } … … 36 37 } 37 38 38 protected abstract void Manipulate(IRandom random, JSMEncoding individual); 39 39 protected abstract void Manipulate(IRandom random, IScheduleEncoding individual); 40 40 41 41 public override IOperation Apply() { 42 JSMEncoding solution = ScheduleEncodingParameter.ActualValue; 42 var solution = ScheduleEncodingParameter.ActualValue as JSMEncoding; 43 if (solution == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type JSMEncoding."); 43 44 Manipulate(RandomParameter.ActualValue, solution); 44 45 return base.Apply(); -
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMShiftChangeManipulator.cs
r8603 r8887 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 28 29 29 30 namespace HeuristicLab.Encodings.ScheduleEncoding.JobSequenceMatrix { 30 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] 33 33 public class JSMShiftChangeManipulator : JSMManipulator { 34 34 35 [StorableConstructor] 35 36 protected JSMShiftChangeManipulator(bool deserializing) : base(deserializing) { } 36 protected JSMShiftChangeManipulator(JSMShiftChangeManipulator original, Cloner cloner) 37 : base(original, cloner) {38 } 37 protected JSMShiftChangeManipulator(JSMShiftChangeManipulator original, Cloner cloner) : base(original, cloner) { } 38 public JSMShiftChangeManipulator() : base() { } 39 39 40 public override IDeepCloneable Clone(Cloner cloner) { 40 41 return new JSMShiftChangeManipulator(this, cloner); 41 42 } 42 43 public JSMShiftChangeManipulator() : base() { }44 45 43 46 44 public static void Apply(IRandom random, JSMEncoding individual) { … … 65 63 } 66 64 67 protected override void Manipulate(IRandom random, JSMEncoding individual) { 68 Apply(random, individual); 65 protected override void Manipulate(IRandom random, IScheduleEncoding encoding) { 66 var solution = encoding as JSMEncoding; 67 if (solution == null) throw new InvalidOperationException("Encoding is not of type JSMEncoding"); 68 Apply(random, solution); 69 69 } 70 70 } -
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMSwapManipulator.cs
r8603 r8887 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 26 27 27 28 namespace HeuristicLab.Encodings.ScheduleEncoding.JobSequenceMatrix { 28 29 29 [Item("JSMSwapManipulator", "Represents a manipulation operation swapping parts of the individual.")] 30 30 [StorableClass] 31 31 public class JSMSwapManipulator : JSMManipulator { 32 32 33 [StorableConstructor] 33 34 protected JSMSwapManipulator(bool deserializing) : base(deserializing) { } 34 protected JSMSwapManipulator(JSMSwapManipulator original, Cloner cloner) 35 : base(original, cloner) {36 } 35 protected JSMSwapManipulator(JSMSwapManipulator original, Cloner cloner) : base(original, cloner) { } 36 public JSMSwapManipulator() : base() { } 37 37 38 public override IDeepCloneable Clone(Cloner cloner) { 38 39 return new JSMSwapManipulator(this, cloner); 39 40 } 40 41 public JSMSwapManipulator() : base() { }42 43 41 44 42 public static void Apply(IRandom random, JSMEncoding individual) { … … 52 50 } 53 51 54 protected override void Manipulate(IRandom random, JSMEncoding individual) { 55 Apply(random, individual); 52 protected override void Manipulate(IRandom random, IScheduleEncoding individual) { 53 var solution = individual as JSMEncoding; 54 if (solution == null) throw new InvalidOperationException("Encoding is not of type JSMEncoding"); 55 Apply(random, solution); 56 56 } 57 57 }
Note: See TracChangeset
for help on using the changeset viewer.