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
Files:
5 deleted
46 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/HeuristicLab.Encodings.ScheduleEncoding-3.3.csproj

    r8806 r8887  
    110110  <ItemGroup>
    111111    <Compile Include="Interfaces\IDirectScheduleOperator.cs" />
    112     <Compile Include="Interfaces\IScheduleEvaluationAlgorithm.cs" />
    113112    <Compile Include="Interfaces\IJSMOperator.cs" />
    114113    <Compile Include="Interfaces\IPRVOperator.cs" />
     
    116115    <Compile Include="Interfaces\IScheduleCreator.cs" />
    117116    <Compile Include="Interfaces\IScheduleCrossover.cs" />
    118     <Compile Include="Interfaces\IScheduleDecoder.cs" />
    119117    <Compile Include="Interfaces\IScheduleEncoding.cs" />
    120     <Compile Include="Interfaces\IScheduleEvaluator.cs" />
    121118    <Compile Include="Interfaces\IScheduleManipulator.cs" />
    122119    <Compile Include="Interfaces\IScheduleOperator.cs" />
     
    151148    <Compile Include="ScheduleEncoding\Job.cs" />
    152149    <Compile Include="ScheduleEncoding\Manipulators\DirectScheduleManipulator.cs" />
    153     <Compile Include="ScheduleEncoding\Manipulators\ConcreteScheduleManipulator.cs" />
    154150    <Compile Include="ScheduleEncoding\DirectScheduleRandomCreator.cs" />
    155151    <Compile Include="ScheduleEncoding\Resource.cs" />
     
    158154    <Compile Include="ScheduleCreator.cs" />
    159155    <Compile Include="ScheduleCrossover.cs" />
    160     <Compile Include="ScheduleDecoder.cs" />
    161156    <Compile Include="ScheduleEncoding\Task.cs" />
    162157    <Compile Include="ScheduleManipulator.cs" />
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IDirectScheduleOperator.cs

    r8603 r8887  
    2121
    2222using HeuristicLab.Core;
     23
    2324namespace HeuristicLab.Encodings.ScheduleEncoding {
    2425  public interface IDirectScheduleOperator : IOperator {
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IJSMOperator.cs

    r6406 r8887  
    1 using HeuristicLab.Core;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Core;
    223
    324namespace HeuristicLab.Encodings.ScheduleEncoding {
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IPRVOperator.cs

    r6406 r8887  
    1 using HeuristicLab.Core;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Core;
    223
    324namespace HeuristicLab.Encodings.ScheduleEncoding {
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IPWROperator.cs

    r6406 r8887  
    1 using HeuristicLab.Core;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Core;
    223
    324namespace HeuristicLab.Encodings.ScheduleEncoding {
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleCreator.cs

    r6406 r8887  
    1 using HeuristicLab.Optimization;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Core;
     23using HeuristicLab.Optimization;
    224
    325namespace HeuristicLab.Encodings.ScheduleEncoding {
    426  public interface IScheduleCreator : ISolutionCreator, IScheduleOperator {
     27    ILookupParameter<IScheduleEncoding> ScheduleEncodingParameter { get; }
    528  }
    629}
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleCrossover.cs

    r6406 r8887  
    1 using HeuristicLab.Optimization;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Core;
     23using HeuristicLab.Optimization;
    224
    325namespace HeuristicLab.Encodings.ScheduleEncoding {
    426  public interface IScheduleCrossover : ICrossover, IScheduleOperator {
     27    ILookupParameter<IScheduleEncoding> ChildParameter { get; }
     28    IScopeTreeLookupParameter<IScheduleEncoding> ParentsParameter { get; }
    529  }
    630}
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleManipulator.cs

    r8603 r8887  
    2020#endregion
    2121
     22using HeuristicLab.Core;
    2223using HeuristicLab.Optimization;
    2324
    2425namespace HeuristicLab.Encodings.ScheduleEncoding {
    2526  public interface IScheduleManipulator : IManipulator, IScheduleOperator {
     27    ILookupParameter<IScheduleEncoding> ScheduleEncodingParameter { get; }
    2628  }
    2729}
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleOperator.cs

    r6406 r8887  
    1 using HeuristicLab.Core;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Core;
    223
    324namespace HeuristicLab.Encodings.ScheduleEncoding {
  • 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];
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JSMEncoding.cs

    r8603 r8887  
    3030  [StorableClass]
    3131  public class JSMEncoding : Item, IScheduleEncoding {
     32
    3233    [Storable]
    3334    public ItemList<Permutation> JobSequenceMatrix { get; set; }
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JSMRandomCreator.cs

    r8603 r8887  
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2929
    30 
    3130namespace HeuristicLab.Encodings.ScheduleEncoding.JobSequenceMatrix {
    3231  [Item("JobSequenceMatrixCreator", "Creator class used to create Job Sequence Matrix solutions for standard JobShop scheduling problems.")]
    3332  [StorableClass]
    34   public class JSMRandomCreator : ScheduleCreator<JSMEncoding>, IStochasticOperator {
    35     #region Parameter Properties
     33  public class JSMRandomCreator : ScheduleCreator, IStochasticOperator {
     34
    3635    public ILookupParameter<IRandom> RandomParameter {
    3736      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
     
    4342      get { return (IValueLookupParameter<IntValue>)Parameters["Resources"]; }
    4443    }
    45     #endregion
    46 
    4744
    4845    [StorableConstructor]
    4946    protected JSMRandomCreator(bool deserializing) : base(deserializing) { }
    50     protected JSMRandomCreator(JSMRandomCreator original, Cloner cloner)
    51       : base(original, cloner) {
    52     }
    53     public override IDeepCloneable Clone(Cloner cloner) {
    54       return new JSMRandomCreator(this, cloner);
    55     }
     47    protected JSMRandomCreator(JSMRandomCreator original, Cloner cloner) : base(original, cloner) { }
    5648    public JSMRandomCreator()
    5749      : base() {
     
    6355    }
    6456
     57    public override IDeepCloneable Clone(Cloner cloner) {
     58      return new JSMRandomCreator(this, cloner);
     59    }
    6560
    6661    public static JSMEncoding Apply(int jobs, int resources, IRandom random) {
    67       JSMEncoding solution = new JSMEncoding();
    68 
     62      var solution = new JSMEncoding();
    6963      for (int i = 0; i < resources; i++) {
    7064        solution.JobSequenceMatrix.Add(new Permutation(PermutationTypes.Absolute, jobs, random));
    7165      }
    72 
    7366      return solution;
    7467    }
    7568
    76 
    77     protected override JSMEncoding CreateSolution() {
     69    protected override IScheduleEncoding CreateSolution() {
    7870      return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue);
    7971    }
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMManipulator.cs

    r8603 r8887  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2728  [Item("JSMManipulator", "An operator which manipulates a JSM representation.")]
    2829  [StorableClass]
    29   public abstract class JSMManipulator : ScheduleManipulator<JSMEncoding>, IJSMOperator {
     30  public abstract class JSMManipulator : ScheduleManipulator, IJSMOperator {
    3031    [StorableConstructor]
    3132    protected JSMManipulator(bool deserializing) : base(deserializing) { }
     
    3637    }
    3738
    38     protected abstract void Manipulate(IRandom random, JSMEncoding individual);
    39 
     39    protected abstract void Manipulate(IRandom random, IScheduleEncoding individual);
    4040
    4141    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.");
    4344      Manipulate(RandomParameter.ActualValue, solution);
    4445      return base.Apply();
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMShiftChangeManipulator.cs

    r8603 r8887  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using System.Linq;
     
    2829
    2930namespace HeuristicLab.Encodings.ScheduleEncoding.JobSequenceMatrix {
    30 
    3131  [Item("JSMShiftChangeManipulator", "Represents a manipulation operation where the operations of a randomly determined job are shifted in one direction for all resources.")]
    3232  [StorableClass]
    3333  public class JSMShiftChangeManipulator : JSMManipulator {
     34
    3435    [StorableConstructor]
    3536    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
    3940    public override IDeepCloneable Clone(Cloner cloner) {
    4041      return new JSMShiftChangeManipulator(this, cloner);
    4142    }
    42 
    43     public JSMShiftChangeManipulator() : base() { }
    44 
    4543
    4644    public static void Apply(IRandom random, JSMEncoding individual) {
     
    6563    }
    6664
    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);
    6969    }
    7070  }
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMSwapManipulator.cs

    r8603 r8887  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2627
    2728namespace HeuristicLab.Encodings.ScheduleEncoding.JobSequenceMatrix {
    28 
    2929  [Item("JSMSwapManipulator", "Represents a manipulation operation swapping parts of the individual.")]
    3030  [StorableClass]
    3131  public class JSMSwapManipulator : JSMManipulator {
     32
    3233    [StorableConstructor]
    3334    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
    3738    public override IDeepCloneable Clone(Cloner cloner) {
    3839      return new JSMSwapManipulator(this, cloner);
    3940    }
    40 
    41     public JSMSwapManipulator() : base() { }
    42 
    4341
    4442    public static void Apply(IRandom random, JSMEncoding individual) {
     
    5250    }
    5351
    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);
    5656    }
    5757  }
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Crossovers/PWRCrossover.cs

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

    r8603 r8887  
    3131  [StorableClass]
    3232  public class PWRGOXCrossover : PWRCrossover {
     33
    3334    [StorableConstructor]
    3435    protected PWRGOXCrossover(bool deserializing) : base(deserializing) { }
    35     protected PWRGOXCrossover(PWRGOXCrossover original, Cloner cloner)
    36       : base(original, cloner) {
    37     }
     36    protected PWRGOXCrossover(PWRGOXCrossover original, Cloner cloner) : base(original, cloner) { }
     37    public PWRGOXCrossover() : base() { }
     38
    3839    public override IDeepCloneable Clone(Cloner cloner) {
    3940      return new PWRGOXCrossover(this, cloner);
    4041    }
    41     public PWRGOXCrossover() : base() { }
    4242
    4343    private static int[] GetLookUpForIndividual(List<int> p) {
    44       int[] result = new int[p.Count];
    45       Dictionary<int, int> lookUpTable = new Dictionary<int, int>();
     44      var result = new int[p.Count];
     45      var lookUpTable = new Dictionary<int, int>();
    4646
    4747      for (int i = 0; i < p.Count; i++) {
     
    5454      return result;
    5555    }
     56
    5657    public static PWREncoding Apply(IRandom random, PWREncoding parent1, PWREncoding parent2) {
    57       PWREncoding result = new PWREncoding();
     58      var result = new PWREncoding();
    5859
    59       List<int> p1 = ((IntegerVector)(parent1.PermutationWithRepetition.Clone())).ToList<int>();
    60       List<int> p2 = ((IntegerVector)(parent2.PermutationWithRepetition.Clone())).ToList<int>();
    61       List<int> child = new List<int>();
     60      var p1 = ((IntegerVector)(parent1.PermutationWithRepetition.Clone())).ToList();
     61      var p2 = ((IntegerVector)(parent2.PermutationWithRepetition.Clone())).ToList();
     62      var child = new List<int>();
    6263
    6364      int[] lookUpArrayP1 = GetLookUpForIndividual(p1);
     
    9091    }
    9192
    92 
    93 
    94 
    9593  }
    9694}
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Crossovers/PWRPPXCrossover.cs

    r8603 r8887  
    3131  [StorableClass]
    3232  public class PWRPPXCrossover : PWRCrossover {
     33
    3334    [StorableConstructor]
    3435    protected PWRPPXCrossover(bool deserializing) : base(deserializing) { }
    35     protected PWRPPXCrossover(PWRPPXCrossover original, Cloner cloner)
    36       : base(original, cloner) {
    37     }
     36    protected PWRPPXCrossover(PWRPPXCrossover original, Cloner cloner) : base(original, cloner) { }
     37    public PWRPPXCrossover() : base() { }
     38
    3839    public override IDeepCloneable Clone(Cloner cloner) {
    3940      return new PWRPPXCrossover(this, cloner);
    4041    }
    41     public PWRPPXCrossover() : base() { }
    4242
    4343    public static PWREncoding Apply(IRandom random, PWREncoding parent1, PWREncoding parent2) {
    44       PWREncoding result = new PWREncoding();
    45       List<int> p1 = ((IntegerVector)(parent1.PermutationWithRepetition.Clone())).ToList<int>();
    46       List<int> p2 = ((IntegerVector)(parent2.PermutationWithRepetition.Clone())).ToList<int>();
    47       List<int> child = new List<int>();
     44      var result = new PWREncoding();
     45      var p1 = ((IntegerVector)(parent1.PermutationWithRepetition.Clone())).ToList();
     46      var p2 = ((IntegerVector)(parent2.PermutationWithRepetition.Clone())).ToList();
     47      var child = new List<int>();
    4848
    49       bool[] lookUpTable = new bool[parent1.PermutationWithRepetition.Length];
     49      var lookUpTable = new bool[parent1.PermutationWithRepetition.Length];
    5050      for (int i = 0; i < lookUpTable.Length; i++) {
    5151        lookUpTable[i] = random.Next(2) == 1;
     
    7373    }
    7474
    75 
    7675  }
    7776}
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Manipulators/PWRInsertionManipulator.cs

    r8603 r8887  
    2828
    2929namespace HeuristicLab.Encodings.ScheduleEncoding.PermutationWithRepetition {
    30 
    3130  [Item("PWRInsertionManipulator", "Represents a manipulation operation inserting parts of the individual at another position.")]
    3231  [StorableClass]
     
    3433    [StorableConstructor]
    3534    protected PWRInsertionManipulator(bool deserializing) : base(deserializing) { }
    36     protected PWRInsertionManipulator(PWRInsertionManipulator original, Cloner cloner)
    37       : base(original, cloner) {
    38     }
     35    protected PWRInsertionManipulator(PWRInsertionManipulator original, Cloner cloner) : base(original, cloner) { }
     36    public PWRInsertionManipulator() : base() { }
     37
    3938    public override IDeepCloneable Clone(Cloner cloner) {
    4039      return new PWRInsertionManipulator(this, cloner);
    4140    }
    42     public PWRInsertionManipulator() : base() { }
    4341
    4442    public static void Apply(IRandom random, PWREncoding individual) {
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Manipulators/PWRManipulator.cs

    r8603 r8887  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2728  [Item("PWRManipulator", "An operator which manipulates a PWR representation.")]
    2829  [StorableClass]
    29   public abstract class PWRManipulator : ScheduleManipulator<PWREncoding>, IPWROperator {
     30  public abstract class PWRManipulator : ScheduleManipulator, IPWROperator {
     31
    3032    [StorableConstructor]
    3133    protected PWRManipulator(bool deserializing) : base(deserializing) { }
     
    3840    protected abstract void Manipulate(IRandom random, PWREncoding individual);
    3941
    40 
    4142    public override IOperation Apply() {
    42       PWREncoding solution = ScheduleEncodingParameter.ActualValue;
     43      var solution = ScheduleEncodingParameter.ActualValue as PWREncoding;
     44      if (solution == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type PWREncoding.");
    4345      Manipulate(RandomParameter.ActualValue, solution);
    4446      return base.Apply();
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWREncoding.cs

    r8603 r8887  
    3030  [StorableClass]
    3131  public class PWREncoding : Item, IScheduleEncoding {
     32
    3233    [Storable]
    3334    public IntegerVector PermutationWithRepetition { get; set; }
    34 
    3535
    3636    [StorableConstructor]
     
    4040      this.PermutationWithRepetition = cloner.Clone(original.PermutationWithRepetition);
    4141    }
    42     public override IDeepCloneable Clone(Cloner cloner) {
    43       return new PWREncoding(this, cloner);
    44     }
    4542    public PWREncoding()
    4643      : base() {
    4744      PermutationWithRepetition = new IntegerVector();
     45    }
     46
     47    public override IDeepCloneable Clone(Cloner cloner) {
     48      return new PWREncoding(this, cloner);
    4849    }
    4950
     
    8182        return base.Equals(obj);
    8283    }
     84
    8385    public override int GetHashCode() {
    8486      if (PermutationWithRepetition.Length == 1)
     
    8890      return 0;
    8991    }
     92
    9093    private bool AreEqual(PWREncoding pWREncoding1, PWREncoding pWREncoding2) {
    9194      if (pWREncoding1.PermutationWithRepetition.Length != pWREncoding2.PermutationWithRepetition.Length)
     
    97100      return true;
    98101    }
    99 
    100 
    101102  }
    102103}
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWRRandomCreator.cs

    r8603 r8887  
    3030  [Item("PermutationWithRepetitionRandomCreator", "Creates PWR-individuals at random.")]
    3131  [StorableClass]
    32   public class PWRRandomCreator : ScheduleCreator<PWREncoding>, IStochasticOperator {
    33     public IRandom Random {
    34       get { return RandomParameter.ActualValue; }
    35     }
     32  public class PWRRandomCreator : ScheduleCreator, IStochasticOperator {
    3633
    3734    public ILookupParameter<IRandom> RandomParameter {
     
    4744    [StorableConstructor]
    4845    protected PWRRandomCreator(bool deserializing) : base(deserializing) { }
    49     protected PWRRandomCreator(PWRRandomCreator original, Cloner cloner)
    50       : base(original, cloner) {
    51     }
    52     public override IDeepCloneable Clone(Cloner cloner) {
    53       return new PWRRandomCreator(this, cloner);
    54     }
    55 
     46    protected PWRRandomCreator(PWRRandomCreator original, Cloner cloner) : base(original, cloner) { }
    5647    public PWRRandomCreator()
    5748      : base() {
     
    6354    }
    6455
     56    public override IDeepCloneable Clone(Cloner cloner) {
     57      return new PWRRandomCreator(this, cloner);
     58    }
     59
    6560    public static PWREncoding Apply(int jobs, int resources, IRandom random) {
    6661      return new PWREncoding(jobs, resources, random);
    6762    }
    6863
    69 
    70     protected override PWREncoding CreateSolution() {
    71       return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, Random);
     64    protected override IScheduleEncoding CreateSolution() {
     65      return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue);
    7266    }
    7367  }
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/Plugin.cs.frame

    r8603 r8887  
    2323
    2424namespace HeuristicLab.Encodings.ScheduleEncoding {
    25   [Plugin("HeuristicLab.Encodings.ScheduleEncoding", "3.3.3.$WCREV$")]
     25  [Plugin("HeuristicLab.Encodings.ScheduleEncoding", "3.3.7.$WCREV$")]
    2626  [PluginFile("HeuristicLab.Encodings.ScheduleEncoding-3.3.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Collections", "3.3")]
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVCrossover.cs

    r8603 r8887  
    2727  [Item("PRVCrossover", "An operator which crosses two PRV representations.")]
    2828  [StorableClass]
    29   public abstract class PRVCrossover : ScheduleCrossover<PRVEncoding>, IPRVOperator {
     29  public abstract class PRVCrossover : ScheduleCrossover, IPRVOperator {
     30
    3031    [StorableConstructor]
    3132    protected PRVCrossover(bool deserializing) : base(deserializing) { }
     
    3738    }
    3839
    39 
    4040    public abstract PRVEncoding Cross(IRandom random, PRVEncoding parent1, PRVEncoding parent2);
    4141
    4242    public override IOperation Apply() {
    43       ItemArray<PRVEncoding> parents = ParentsParameter.ActualValue;
     43      var parents = ParentsParameter.ActualValue;
    4444      ChildParameter.ActualValue =
    4545        Cross(RandomParameter.ActualValue, parents[0] as PRVEncoding, parents[1] as PRVEncoding);
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVDiscreteCrossover.cs

    r8603 r8887  
    2929  [StorableClass]
    3030  public class PRVDiscreteCrossover : PRVCrossover {
     31
    3132    [StorableConstructor]
    3233    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
    3637    public override IDeepCloneable Clone(Cloner cloner) {
    3738      return new PRVDiscreteCrossover(this, cloner);
    3839    }
    39     public PRVDiscreteCrossover() : base() { }
    40 
    4140
    4241    public static PRVEncoding Apply(IRandom random, PRVEncoding parent1, PRVEncoding parent2) {
    4342      return new PRVEncoding(DiscreteCrossover.Apply(random, new ItemArray<IntegerVector>(new IntegerVector[] { parent1.PriorityRulesVector, parent2.PriorityRulesVector })), parent1.NrOfRules);
    4443    }
     44
    4545    public override PRVEncoding Cross(IRandom random, PRVEncoding parent1, PRVEncoding parent2) {
    4646      return Apply(random, parent1, parent2);
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Crossovers/PRVSinglePointCrossover.cs

    r8603 r8887  
    2929  [StorableClass]
    3030  public class PRVSinglePointCrossover : PRVCrossover {
     31
    3132    [StorableConstructor]
    3233    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
    3637    public override IDeepCloneable Clone(Cloner cloner) {
    3738      return new PRVSinglePointCrossover(this, cloner);
    3839    }
    39     public PRVSinglePointCrossover() : base() { }
    4040
    4141    public static PRVEncoding Apply(IRandom random, PRVEncoding parent1, PRVEncoding parent2) {
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVManipulator.cs

    r8603 r8887  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2728  [Item("PRVManipulator", "An operator which manipulates a PRV representation.")]
    2829  [StorableClass]
    29   public abstract class PRVManipulator : ScheduleManipulator<PRVEncoding>, IPRVOperator {
     30  public abstract class PRVManipulator : ScheduleManipulator, IPRVOperator {
    3031    [StorableConstructor]
    3132    protected PRVManipulator(bool deserializing) : base(deserializing) { }
     
    3637    }
    3738
     39    protected abstract void Manipulate(IRandom random, PRVEncoding individual);
    3840
    39     protected abstract void Manipulate(IRandom random, PRVEncoding individual);
    4041    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.");
    4244      Manipulate(RandomParameter.ActualValue, solution);
    4345      return base.Apply();
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVUniformOnePositionManipulator.cs

    r8882 r8887  
    2727
    2828namespace HeuristicLab.Encodings.ScheduleEncoding.PriorityRulesVector {
    29 
    3029  [Item("PRVUniformOnePositionManipulator", "Represents a manipulation operation inserting parts of the individual at another position.")]
    3130  [StorableClass]
    3231  public class PRVUniformOnePositionManipulator : PRVManipulator {
     32
    3333    [StorableConstructor]
    3434    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
    3838    public override IDeepCloneable Clone(Cloner cloner) {
    3939      return new PRVUniformOnePositionManipulator(this, cloner);
    4040    }
    41     public PRVUniformOnePositionManipulator() : base() { }
    42 
    4341
    4442    public static void Apply(IRandom random, PRVEncoding individual) {
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVEncoding.cs

    r8603 r8887  
    4242    }
    4343
    44 
    4544    [StorableConstructor]
    4645    protected PRVEncoding(bool deserializing) : base(deserializing) { }
     
    4948      this.nrOfRules = cloner.Clone(original.NrOfRules);
    5049      this.PriorityRulesVector = cloner.Clone(original.PriorityRulesVector);
    51     }
    52     public override IDeepCloneable Clone(Cloner cloner) {
    53       return new PRVEncoding(this, cloner);
    5450    }
    5551    public PRVEncoding(int nrOfRules)
     
    6965    }
    7066
     67    public override IDeepCloneable Clone(Cloner cloner) {
     68      return new PRVEncoding(this, cloner);
     69    }
    7170
    7271    public override string ToString() {
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVRandomCreator.cs

    r8603 r8887  
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2828
    29 
    3029namespace HeuristicLab.Encodings.ScheduleEncoding.PriorityRulesVector {
    3130  [Item("PriorityRulesRandomCreator", "Creator class used to create PRV encoding objects for scheduling problems.")]
    3231  [StorableClass]
    33   public class PRVRandomCreator : ScheduleCreator<PRVEncoding>, IStochasticOperator {
     32  public class PRVRandomCreator : ScheduleCreator, IStochasticOperator {
     33
    3434    [Storable]
    3535    public IntValue NrOfRules { get; set; }
     
    4545    }
    4646
    47 
    4847    [StorableConstructor]
    4948    protected PRVRandomCreator(bool deserializing) : base(deserializing) { }
     
    5150      : base(original, cloner) {
    5251      this.NrOfRules = cloner.Clone(original.NrOfRules);
    53     }
    54     public override IDeepCloneable Clone(Cloner cloner) {
    55       return new PRVRandomCreator(this, cloner);
    5652    }
    5753    public PRVRandomCreator()
     
    6460    }
    6561
     62    public override IDeepCloneable Clone(Cloner cloner) {
     63      return new PRVRandomCreator(this, cloner);
     64    }
     65
    6666    public static PRVEncoding Apply(int jobs, int resources, IRandom random, IntValue nrOfRules) {
    6767      return new PRVEncoding(jobs * resources, random, 0, nrOfRules.Value, nrOfRules);
    6868    }
    6969
    70     protected override PRVEncoding CreateSolution() {
     70    protected override IScheduleEncoding CreateSolution() {
    7171      return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue, NrOfRules);
    7272    }
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/Properties/AssemblyInfo.cs.frame

    r8759 r8887  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    5555// [assembly: AssemblyVersion("1.0.*")]
    5656[assembly: AssemblyVersion("3.3.0.0")]
    57 [assembly: AssemblyFileVersion("3.3.3.$WCREV$")]
     57[assembly: AssemblyFileVersion("3.3.7.$WCREV$")]
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleCreator.cs

    r8603 r8887  
    2929  [Item("ScheduleCreator", "Represents the generalized form of creators for Scheduling Problems.")]
    3030  [StorableClass]
    31   public abstract class ScheduleCreator<T> : SingleSuccessorOperator, IScheduleCreator where T : Item {
    32     public ILookupParameter<T> ScheduleEncodingParameter {
    33       get { return (ILookupParameter<T>)Parameters["ScheduleEncoding"]; }
     31  public abstract class ScheduleCreator : SingleSuccessorOperator, IScheduleCreator {
     32
     33    public ILookupParameter<IScheduleEncoding> ScheduleEncodingParameter {
     34      get { return (ILookupParameter<IScheduleEncoding>)Parameters["ScheduleEncoding"]; }
    3435    }
    35 
    3636
    3737    [StorableConstructor]
    3838    protected ScheduleCreator(bool deserializing) : base(deserializing) { }
    39     protected ScheduleCreator(ScheduleCreator<T> original, Cloner cloner)
    40       : base(original, cloner) {
    41     }
     39    protected ScheduleCreator(ScheduleCreator original, Cloner cloner) : base(original, cloner) { }
    4240    public ScheduleCreator()
    4341      : base() {
    44       Parameters.Add(new LookupParameter<T>("ScheduleEncoding", "The new scheduling solutioncandidate."));
     42      Parameters.Add(new LookupParameter<IScheduleEncoding>("ScheduleEncoding", "The new scheduling solutioncandidate."));
    4543    }
    46 
    4744
    4845    public override IOperation Apply() {
     
    5047      return base.Apply();
    5148    }
    52     protected abstract T CreateSolution();
     49
     50    protected abstract IScheduleEncoding CreateSolution();
    5351  }
    5452}
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleCrossover.cs

    r8603 r8887  
    3030  [Item("ScheduleCrossover", "A scheduling crossover operation.")]
    3131  [StorableClass]
    32   public abstract class ScheduleCrossover<T> : SingleSuccessorOperator, IScheduleCrossover, IStochasticOperator where T : Item {
    33     #region IScheduleCrossover Members
    34     public ILookupParameter<ItemArray<T>> ParentsParameter {
    35       get { return (ScopeTreeLookupParameter<T>)Parameters["Parents"]; }
     32  public abstract class ScheduleCrossover : SingleSuccessorOperator, IScheduleCrossover, IStochasticOperator {
     33
     34    public ILookupParameter<IScheduleEncoding> ChildParameter {
     35      get { return (ILookupParameter<IScheduleEncoding>)Parameters["Child"]; }
    3636    }
    37 
    38     public ILookupParameter<T> ChildParameter {
    39       get { return (ILookupParameter<T>)Parameters["Child"]; }
     37    public IScopeTreeLookupParameter<IScheduleEncoding> ParentsParameter {
     38      get { return (IScopeTreeLookupParameter<IScheduleEncoding>)Parameters["Parents"]; }
    4039    }
    41     #endregion
    42 
    4340    public ILookupParameter<IRandom> RandomParameter {
    4441      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
     
    4744    [StorableConstructor]
    4845    protected ScheduleCrossover(bool deserializing) : base(deserializing) { }
    49     protected ScheduleCrossover(ScheduleCrossover<T> original, Cloner cloner)
    50       : base(original, cloner) {
    51     }
     46    protected ScheduleCrossover(ScheduleCrossover original, Cloner cloner) : base(original, cloner) { }
    5247    public ScheduleCrossover()
    5348      : base() {
    5449      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
    55       Parameters.Add(new ScopeTreeLookupParameter<T>("Parents", "The parent solution which should be crossed."));
     50      Parameters.Add(new LookupParameter<IScheduleEncoding>("Child", "The child solution resulting from the crossover."));
     51      ChildParameter.ActualName = "SchedulingSolution";
     52      Parameters.Add(new ScopeTreeLookupParameter<IScheduleEncoding>("Parents", "The parent solution which should be crossed."));
    5653      ParentsParameter.ActualName = "SchedulingSolution";
    57       Parameters.Add(new LookupParameter<T>("Child", "The child solution resulting from the crossover."));
    58       ChildParameter.ActualName = "SchedulingSolution";
    5954    }
    6055  }
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Crossovers/DirectScheduleCrossover.cs

    r8603 r8887  
    2828  [Item("DirectScheduleCrossover", "An operator which crosses two schedule representations.")]
    2929  [StorableClass]
    30   public abstract class DirectScheduleCrossover : ScheduleCrossover<Schedule>, IDirectScheduleOperator {
     30  public abstract class DirectScheduleCrossover : ScheduleCrossover, IDirectScheduleOperator {
    3131    [StorableConstructor]
    3232    protected DirectScheduleCrossover(bool deserializing) : base(deserializing) { }
     
    3939    }
    4040
    41 
    4241    public ILookupParameter<ItemList<Job>> JobDataParameter {
    4342      get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; }
     
    4746
    4847    public override IOperation Apply() {
    49       ItemArray<Schedule> parents = ParentsParameter.ActualValue;
     48      var parents = ParentsParameter.ActualValue;
    5049      ChildParameter.ActualValue =
    5150        Cross(RandomParameter.ActualValue, parents[0] as Schedule, parents[1] as Schedule);
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Crossovers/DirectScheduleGTCrossover.cs

    r8603 r8887  
    3030  [StorableClass]
    3131  public class DirectScheduleGTCrossover : DirectScheduleCrossover {
     32
     33    public IValueLookupParameter<DoubleValue> MutationProbabilityParameter {
     34      get { return (IValueLookupParameter<DoubleValue>)Parameters["MutationProbability"]; }
     35    }
     36
    3237    [StorableConstructor]
    3338    protected DirectScheduleGTCrossover(bool deserializing) : base(deserializing) { }
    34     protected DirectScheduleGTCrossover(DirectScheduleGTCrossover original, Cloner cloner)
    35       : base(original, cloner) {
     39    protected DirectScheduleGTCrossover(DirectScheduleGTCrossover original, Cloner cloner) : base(original, cloner) { }
     40    public DirectScheduleGTCrossover()
     41      : base() {
     42      Parameters.Add(new ValueLookupParameter<DoubleValue>("MutationProbability", "The probability that a task from the conflict set is chosen randomly instead of from one of the parents."));
    3643    }
     44
    3745    public override IDeepCloneable Clone(Cloner cloner) {
    3846      return new DirectScheduleGTCrossover(this, cloner);
    3947    }
    40     public DirectScheduleGTCrossover()
    41       : base() {
    42       Parameters.Add(new LookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
    43     }
    44 
    45 
    46     private LookupParameter<PercentValue> MutationProbabilityParameter {
    47       get { return (LookupParameter<PercentValue>)Parameters["MutationProbability"]; }
    48     }
    49 
    5048
    5149    public static Schedule Apply(IRandom random, Schedule parent1, Schedule parent2, ItemList<Job> jobData, double mutProp) {
    52       Schedule child = new Schedule(parent1.Resources.Count);
    53 
     50      var child = new Schedule(parent1.Resources.Count);
    5451
    5552      //Reset scheduled tasks in result
     
    7572        int progressOnResource = conflictedResource.Tasks.Count;
    7673        Task selectedTask = null;
    77         if (random.Next(100) < mutProp) {
     74        if (random.NextDouble() < mutProp) {
    7875          //Mutation
    7976          selectedTask = conflictSet[random.Next(conflictSet.Count)];
     
    9592    }
    9693
    97 
    9894    private static Task SelectTaskFromConflictSet(ItemList<Task> conflictSet, Schedule usedParent, int conflictedResourceNr, int progressOnResource) {
    9995      //Apply Crossover
     
    109105
    110106    public override Schedule Cross(IRandom random, Schedule parent1, Schedule parent2) {
    111       ItemList<Job> jobData = (ItemList<Job>)JobDataParameter.ActualValue.Clone();
    112       PercentValue mutProp = MutationProbabilityParameter.ActualValue;
     107      var jobData = (ItemList<Job>)JobDataParameter.ActualValue.Clone();
     108      var mutProp = MutationProbabilityParameter.ActualValue;
    113109      return Apply(random, parent1, parent2, jobData, mutProp.Value);
    114110    }
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/DirectScheduleRandomCreator.cs

    r8603 r8887  
    3333  [Item("DirectScheduleRandomCreator", "Creator class used to create schedule encoding objects.")]
    3434  [StorableClass]
    35   public class DirectScheduleRandomCreator : ScheduleCreator<Schedule>, IStochasticOperator {
     35  public class DirectScheduleRandomCreator : ScheduleCreator, IStochasticOperator {
    3636
    3737    public ILookupParameter<IRandom> RandomParameter {
     
    6868
    6969    public static Schedule Apply(int jobs, int resources, PWREncoding pwr, ItemList<Job> jobData) {
    70       Schedule resultingSchedule = new Schedule(jobData[0].Tasks.Count);
     70      var resultingSchedule = new Schedule(jobData[0].Tasks.Count);
    7171      foreach (int jobNr in pwr.PermutationWithRepetition) {
    7272        int i = 0;
     
    8282
    8383
    84     protected override Schedule CreateSolution() {
     84    protected override IScheduleEncoding CreateSolution() {
    8585      try {
    86         ItemList<Job> jobData = (ItemList<Job>)JobDataParameter.ActualValue.Clone();
     86        var jobData = (ItemList<Job>)JobDataParameter.ActualValue.Clone();
    8787        return Apply(JobsParameter.ActualValue.Value,
    8888          ResourcesParameter.ActualValue.Value,
    8989          new PWREncoding(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue),
    9090          jobData);
    91       }
    92       catch {
     91      } catch {
    9392        throw new Exception("ScheduleRandomCreator needs JobData parameter from a JSSP-Instance to create Schedule-Instances!");
    9493      }
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Job.cs

    r8886 r8887  
    3030  [StorableClass]
    3131  public class Job : Item, INotifyPropertyChanged {
    32     [Storable(Name = "DueDate")] private double dueDate;
     32
     33    [Storable(Name = "DueDate")]
     34    private double dueDate;
    3335    public double DueDate {
    3436      get { return dueDate; }
     
    5254
    5355    [Storable(Name = "Tasks")]
    54     private ItemList<Task> tasks; 
     56    private ItemList<Task> tasks;
    5557    public ItemList<Task> Tasks {
    5658      get { return tasks; }
     
    7072      this.Tasks = cloner.Clone(original.Tasks);
    7173    }
    72     public override IDeepCloneable Clone(Cloner cloner) {
    73       return new Job(this, cloner);
    74     }
     74    public Job() : this(-1, double.MaxValue) { }
    7575    public Job(int index, double dueDate)
    7676      : base() {
     
    7878      Index = index;
    7979      Tasks = new ItemList<Task>();
     80    }
     81
     82    public override IDeepCloneable Clone(Cloner cloner) {
     83      return new Job(this, cloner);
    8084    }
    8185
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Manipulators/DirectScheduleManipulator.cs

    r8603 r8887  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2728  [Item("DirectScheduleManipulator", "An operator which manipulates a direct schedule representation.")]
    2829  [StorableClass]
    29   public abstract class DirectScheduleManipulator : ScheduleManipulator<Schedule>, IDirectScheduleOperator {
     30  public abstract class DirectScheduleManipulator : ScheduleManipulator, IDirectScheduleOperator {
     31
    3032    [StorableConstructor]
    3133    protected DirectScheduleManipulator(bool deserializing) : base(deserializing) { }
     
    3638    }
    3739
     40    protected abstract void Manipulate(IRandom random, Schedule individual);
    3841
    39     protected abstract void Manipulate(IRandom random, Schedule individual);
    4042    public override IOperation Apply() {
    41       Schedule solution = ScheduleEncodingParameter.ActualValue;
    42       Manipulate(RandomParameter.ActualValue, solution);
     43      var schedule = ScheduleEncodingParameter.ActualValue as Schedule;
     44      if (schedule == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type Schedule.");
     45      Manipulate(RandomParameter.ActualValue, schedule);
    4346      return base.Apply();
    4447    }
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Resource.cs

    r8603 r8887  
    2929  [StorableClass]
    3030  public class Resource : Item {
    31     public Resource(int index)
    32       : base() {
    33       Index = index;
    34       Tasks = new ItemList<ScheduledTask>();
    35     }
     31
    3632    [Storable]
    3733    public int Index {
     
    4440      set;
    4541    }
     42
     43    [StorableConstructor]
     44    protected Resource(bool deserializing) : base(deserializing) { }
     45    protected Resource(Resource original, Cloner cloner)
     46      : base(original, cloner) {
     47      this.Index = original.Index;
     48      this.Tasks = cloner.Clone(original.Tasks);
     49    }
     50    public Resource(int index)
     51      : base() {
     52      Index = index;
     53      Tasks = new ItemList<ScheduledTask>();
     54    }
     55
     56    public override IDeepCloneable Clone(Cloner cloner) {
     57      return new Resource(this, cloner);
     58    }
     59
    4660    public double TotalDuration {
    4761      get {
     
    5367        return result;
    5468      }
    55     }
    56 
    57     [StorableConstructor]
    58     protected Resource(bool deserializing) : base(deserializing) { }
    59     protected Resource(Resource original, Cloner cloner)
    60       : base(original, cloner) {
    61       this.Index = original.Index;
    62       this.Tasks = cloner.Clone(original.Tasks);
    63     }
    64     public override IDeepCloneable Clone(Cloner cloner) {
    65       return new Resource(this, cloner);
    6669    }
    6770
     
    8386        return false;
    8487    }
     88
    8589    public override int GetHashCode() {
    8690      if (Tasks.Count == 1)
     
    9094      return 0;
    9195    }
     96
    9297    private static bool AreEqual(Resource res1, Resource res2) {
    9398      if (res1.Tasks.Count != res2.Tasks.Count)
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Schedule.cs

    r8603 r8887  
    3232  [StorableClass]
    3333  public class Schedule : NamedItem, IScheduleEncoding {
     34
    3435    #region Properties
    3536    [Storable]
     
    6970      this.lastScheduledTaskOfJob = new Dictionary<int, ScheduledTask>(original.lastScheduledTaskOfJob);
    7071    }
    71     public override IDeepCloneable Clone(Cloner cloner) {
    72       return new Schedule(this, cloner);
    73     }
    7472    public Schedule(int nrOfResources) {
    7573      Resources = new ItemList<Resource>();
     
    8078    }
    8179
    82 
     80    public override IDeepCloneable Clone(Cloner cloner) {
     81      return new Schedule(this, cloner);
     82    }
    8383
    8484    #region Events
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/ScheduledTask.cs

    r8603 r8887  
    2929  [StorableClass]
    3030  public class ScheduledTask : Item {
     31
    3132    #region Properties
    3233    [Storable]
     
    5758      this.JobNr = original.JobNr;
    5859    }
    59     public override IDeepCloneable Clone(Cloner cloner) {
    60       return new ScheduledTask(this, cloner);
    61     }
    62 
    6360    public ScheduledTask(int resNr, double startTime, double duration, int jobNr)
    6461      : base() {
     
    6966    }
    7067
     68    public override IDeepCloneable Clone(Cloner cloner) {
     69      return new ScheduledTask(this, cloner);
     70    }
     71
    7172    public override string ToString() {
    7273      StringBuilder sb = new StringBuilder();
     
    7475      return sb.ToString();
    7576    }
    76 
    7777
    7878    public override bool Equals(object obj) {
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Task.cs

    r8886 r8887  
    3030  [StorableClass]
    3131  public class Task : Item, INotifyPropertyChanged {
     32
    3233    [Storable(Name = "TaskNr")]
    3334    private int taskNr;
     
    9495      this.IsScheduled = original.IsScheduled;
    9596    }
    96     public override IDeepCloneable Clone(Cloner cloner) {
    97       return new Task(this, cloner);
    98     }
    99 
    100 
     97    public Task() : this(-1, -1, -1, 0) { }
    10198    public Task(int taskNr, int resNr, int jobNr, double duration)
    10299      : base() {
     
    106103      TaskNr = taskNr;
    107104      IsScheduled = false;
     105    }
     106
     107    public override IDeepCloneable Clone(Cloner cloner) {
     108      return new Task(this, cloner);
    108109    }
    109110
     
    120121        return false;
    121122    }
     123
    122124    public override int GetHashCode() {
    123125      return TaskNr ^ JobNr;
    124126    }
     127
    125128    public static bool AreEqual(Task task1, Task task2) {
    126129      return (task1.Duration == task2.Duration &&
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleManipulator.cs

    r8603 r8887  
    3030  [Item("ScheduleManipulator", "A scheduling manipulation operation.")]
    3131  [StorableClass]
    32   public abstract class ScheduleManipulator<T> : SingleSuccessorOperator, IScheduleManipulator, IStochasticOperator where T : Item {
    33     #region IScheduleManipulator Members
     32  public abstract class ScheduleManipulator : SingleSuccessorOperator, IScheduleManipulator, IStochasticOperator {
    3433
    35     public ILookupParameter<T> ScheduleEncodingParameter {
    36       get { return (ILookupParameter<T>)Parameters["ScheduleEncoding"]; }
     34    public ILookupParameter<IScheduleEncoding> ScheduleEncodingParameter {
     35      get { return (ILookupParameter<IScheduleEncoding>)Parameters["ScheduleEncoding"]; }
    3736    }
    38 
    39     #endregion
    4037
    4138    public ILookupParameter<IRandom> RandomParameter {
     
    4542    [StorableConstructor]
    4643    protected ScheduleManipulator(bool deserializing) : base(deserializing) { }
    47     protected ScheduleManipulator(ScheduleManipulator<T> original, Cloner cloner)
    48       : base(original, cloner) {
    49     }
     44    protected ScheduleManipulator(ScheduleManipulator original, Cloner cloner) : base(original, cloner) { }
    5045    public ScheduleManipulator()
    5146      : base() {
    52       Parameters.Add(new LookupParameter<T>("ScheduleEncoding", "The scheduling solution to be manipulated."));
     47      Parameters.Add(new LookupParameter<IScheduleEncoding>("ScheduleEncoding", "The scheduling solution to be manipulated."));
    5348      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
    5449    }
Note: See TracChangeset for help on using the changeset viewer.