Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/08/15 14:31:05 (9 years ago)
Author:
mkommend
Message:

#2521: Adapted decoders for SchedulingProblem.

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  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Data;
     26using HeuristicLab.Parameters;
    2527using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2628
     
    2830  [Item("PRVManipulator", "An operator which manipulates a PRV representation.")]
    2931  [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
    3139    [StorableConstructor]
    3240    protected PRVManipulator(bool deserializing) : base(deserializing) { }
    3341    protected PRVManipulator(PRVManipulator original, Cloner cloner) : base(original, cloner) { }
    34     public PRVManipulator() : base() { }
    3542
    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);
    3749
    3850    public override IOperation InstrumentedApply() {
    3951      var solution = ScheduleParameter.ActualValue as PRVEncoding;
    4052      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);
    4254      return base.InstrumentedApply();
    4355    }
  • branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVUniformOnePositionManipulator.cs

    r13437 r13443  
    4040    }
    4141
    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 } }));
    4444    }
    4545
    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);
    4848    }
    4949  }
Note: See TracChangeset for help on using the changeset viewer.