Changeset 13443 for branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators
- Timestamp:
- 12/08/15 14:31:05 (9 years ago)
- Location:
- branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.