Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/11/12 22:57:09 (12 years ago)
Author:
abeham
Message:

#1329:

  • Moved decoders and evaluators from encoding to problem
  • Removed unnecessary state variables in operators
  • Introduced parameters in interfaces and added wiring code
  • Removed ConcreteScheduleManipulator as it does not perform any manipulation
  • Made ErrorPolicy and ForcingStrategy configurable and added views for them
  • Renamed the SchedulingEvaluationAlgorithm and also converted the AlgorithmOperator to a SingleSuccessorOperator
  • Fixed Plugin- and AssemblyFileVersion
  • Added missing license headers
Location:
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMCrossover.cs

    r8603 r8887  
    2727  [Item("JSMCrossover", "An operator which crosses two JSM representations.")]
    2828  [StorableClass]
    29   public abstract class JSMCrossover : ScheduleCrossover<JSMEncoding>, IJSMOperator {
     29  public abstract class JSMCrossover : ScheduleCrossover, IJSMOperator {
    3030
    3131    [StorableConstructor]
     
    4141
    4242    public override IOperation Apply() {
    43       ItemArray<JSMEncoding> parents = ParentsParameter.ActualValue;
     43      var parents = ParentsParameter.ActualValue;
    4444
    4545      ChildParameter.ActualValue =
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMJOXCrossover.cs

    r8603 r8887  
    3030  [StorableClass]
    3131  public class JSMJOXCrossover : JSMCrossover {
     32
    3233    [StorableConstructor]
    3334    protected JSMJOXCrossover(bool deserializing) : base(deserializing) { }
    34     protected JSMJOXCrossover(JSMJOXCrossover original, Cloner cloner)
    35       : base(original, cloner) {
    36     }
     35    protected JSMJOXCrossover(JSMJOXCrossover original, Cloner cloner) : base(original, cloner) { }
     36    public JSMJOXCrossover() : base() { }
     37
    3738    public override IDeepCloneable Clone(Cloner cloner) {
    3839      return new JSMJOXCrossover(this, cloner);
    3940    }
    40     public JSMJOXCrossover() : base() { }
    41 
    4241
    4342    public static JSMEncoding Apply(IRandom random, JSMEncoding p1, JSMEncoding p2) {
    44       JSMEncoding result = new JSMEncoding();
     43      var result = new JSMEncoding();
    4544
    4645      int nrOfResources = p1.JobSequenceMatrix.Count;
     
    4847
    4948      //Determine randomly which jobindexes persist
    50       BoolArray persist = new BoolArray(nrOfJobs);
     49      var persist = new BoolArray(nrOfJobs);
    5150      for (int i = 0; i < persist.Length; i++) {
    5251        persist[i] = random.Next(2) == 1;
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMOXCrossover.cs

    r8603 r8887  
    2828  [StorableClass]
    2929  public class JSMOXCrossover : JSMCrossover {
     30
    3031    [StorableConstructor]
    3132    protected JSMOXCrossover(bool deserializing) : base(deserializing) { }
    32     protected JSMOXCrossover(JSMOXCrossover original, Cloner cloner)
    33       : base(original, cloner) {
    34     }
     33    protected JSMOXCrossover(JSMOXCrossover original, Cloner cloner) : base(original, cloner) { }
     34    public JSMOXCrossover() : base() { }
     35
    3536    public override IDeepCloneable Clone(Cloner cloner) {
    3637      return new JSMOXCrossover(this, cloner);
    3738    }
    38     public JSMOXCrossover() : base() { }
    39 
    4039
    4140    public static JSMEncoding Apply(IRandom random, JSMEncoding parent1, JSMEncoding parent2) {
    42       JSMEncoding result = new JSMEncoding();
     41      var result = new JSMEncoding();
    4342
    4443      for (int i = 0; i < parent1.JobSequenceMatrix.Count; i++) {
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Crossovers/JSMSXXCrossover.cs

    r8603 r8887  
    2929  [StorableClass]
    3030  public class JSMSXXCrossover : JSMCrossover {
     31
    3132    [StorableConstructor]
    3233    protected JSMSXXCrossover(bool deserializing) : base(deserializing) { }
    33     protected JSMSXXCrossover(JSMSXXCrossover original, Cloner cloner)
    34       : base(original, cloner) {
    35     }
     34    protected JSMSXXCrossover(JSMSXXCrossover original, Cloner cloner) : base(original, cloner) { }
     35    public JSMSXXCrossover() : base() { }
     36
    3637    public override IDeepCloneable Clone(Cloner cloner) {
    3738      return new JSMSXXCrossover(this, cloner);
    3839    }
    39     public JSMSXXCrossover() : base() { }
    40 
    4140
    4241    public static JSMEncoding Apply(IRandom random, JSMEncoding parent1, JSMEncoding parent2) {
    43       JSMEncoding result = new JSMEncoding();
     42      var result = new JSMEncoding();
    4443      int subSequenceLength = random.Next(parent1.JobSequenceMatrix[0].Length);
    4544      for (int i = 0; i < parent1.JobSequenceMatrix.Count; i++) {
    46         Permutation p1 = (Permutation)parent1.JobSequenceMatrix[i].Clone();
    47         Permutation p2 = (Permutation)parent2.JobSequenceMatrix[i].Clone();
     45        var p1 = (Permutation)parent1.JobSequenceMatrix[i].Clone();
     46        var p2 = (Permutation)parent2.JobSequenceMatrix[i].Clone();
    4847        FindAndExchangeSubsequences(p1, p2, subSequenceLength);
    4948        result.JobSequenceMatrix.Add(p1);
     
    5150      return result;
    5251    }
     52
    5353    private static void FindAndExchangeSubsequences(Permutation p1, Permutation p2, int subSequenceLength) {
    5454      for (int i = 0; i <= p1.Length - subSequenceLength; i++) {
     
    6363      }
    6464    }
     65
    6566    private static void ExchangeSubsequences(Permutation p1, int index1, Permutation p2, int index2, int subSequenceLength) {
    66       Permutation aux = (Permutation)p1.Clone();
     67      var aux = (Permutation)p1.Clone();
    6768      for (int i = 0; i < subSequenceLength; i++) {
    6869        p1[i + index1] = p2[i + index2];
     
    7071      }
    7172    }
     73
    7274    private static bool AreEqualSubsequences(int[] ss1, int[] ss2) {
    7375      int counter = 0;
     
    8082      return counter == ss1.Length;
    8183    }
     84
    8285    private static int[] GetSubSequenceAtPosition(Permutation p1, int index, int subSequenceLength) {
    83       int[] result = new int[subSequenceLength];
     86      var result = new int[subSequenceLength];
    8487      for (int i = 0; i < subSequenceLength; i++)
    8588        result[i] = p1[i + index];
Note: See TracChangeset for help on using the changeset viewer.