Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/24/11 14:23:19 (13 years ago)
Author:
jhelm
Message:

#1329: Added DirectSchedule-Classes for optimization with the direct-schedule encoding.

Location:
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3
Files:
12 added
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/HeuristicLab.Encodings.ScheduleEncoding-3.3.csproj

    r6406 r6475  
    4747  </ItemGroup>
    4848  <ItemGroup>
     49    <Compile Include="Interfaces\IDirectScheduleOperator.cs" />
    4950    <Compile Include="Interfaces\IScheduleEvaluationAlgorithm.cs" />
    5051    <Compile Include="Interfaces\IJSMOperator.cs" />
     
    7172    <Compile Include="PermutationWithRepetition\Crossovers\PWRPPXCrossover.cs" />
    7273    <Compile Include="PermutationWithRepetition\Manipulators\PWRManipulator.cs" />
    73     <Compile Include="PermutationWithRepetition\Manipulators\PWRUniformOnePositionManipulator.cs" />
     74    <Compile Include="PermutationWithRepetition\Manipulators\PWRInsertionManipulator.cs" />
    7475    <Compile Include="PermutationWithRepetition\PWREncoding.cs" />
    7576    <Compile Include="PermutationWithRepetition\PWRRandomCreator.cs" />
     
    8384    <Compile Include="PriorityRulesVector\PRVRandomCreator.cs" />
    8485    <Compile Include="Properties\AssemblyInfo.cs" />
     86    <Compile Include="ScheduleEncoding\Crossovers\DirectScheduleCrossover.cs" />
     87    <Compile Include="ScheduleEncoding\Crossovers\DirectScheduleGTCrossover.cs" />
     88    <Compile Include="ScheduleEncoding\GTAlgorithmUtils.cs" />
     89    <Compile Include="ScheduleEncoding\Job.cs" />
     90    <Compile Include="ScheduleEncoding\Manipulators\DirectScheduleManipulator.cs" />
     91    <Compile Include="ScheduleEncoding\Manipulators\ConcreteScheduleManipulator.cs" />
     92    <Compile Include="ScheduleEncoding\DirectScheduleRandomCreator.cs" />
    8593    <Compile Include="ScheduleEncoding\Resource.cs" />
    8694    <Compile Include="ScheduleEncoding\Schedule.cs" />
     
    8997    <Compile Include="ScheduleCrossover.cs" />
    9098    <Compile Include="ScheduleDecoder.cs" />
     99    <Compile Include="ScheduleEncoding\Task.cs" />
    91100    <Compile Include="ScheduleManipulator.cs" />
    92101  </ItemGroup>
  • branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JSMRandomCreator.cs

    r6406 r6475  
    6464
    6565
    66     protected override JSMEncoding CreateSolution() {
     66    public static JSMEncoding Apply(int jobs, int resources, IRandom random) {
    6767      JSMEncoding solution = new JSMEncoding();
    68       IntValue nrOfJobs = new IntValue(JobsParameter.ActualValue.Value);
    69       IntValue nrOfResources = new IntValue(ResourcesParameter.ActualValue.Value);
    7068
    71       for (int i = 0; i < nrOfResources.Value; i++) {
    72         solution.JobSequenceMatrix.Add(new Permutation(PermutationTypes.Absolute, nrOfJobs.Value, RandomParameter.ActualValue));
     69      for (int i = 0; i < resources; i++) {
     70        solution.JobSequenceMatrix.Add(new Permutation(PermutationTypes.Absolute, jobs, random));
    7371      }
    7472
    7573      return solution;
    7674    }
     75
     76
     77    protected override JSMEncoding CreateSolution() {
     78      return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue);
     79    }
    7780  }
    7881}
  • branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Crossovers/PWRPPXCrossover.cs

    r6406 r6475  
    2828
    2929namespace HeuristicLab.Encodings.ScheduleEncoding.PermutationWithRepetition {
    30   [Item("PWROrderCrossover", "Represents a crossover operation swapping sequences of the parents to generate offspring.")]
     30  [Item("PWRPPXCrossover", "Represents a crossover operation swapping sequences of the parents to generate offspring.")]
    3131  [StorableClass]
    3232  public class PWRPPXCrossover : PWRCrossover {
  • branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWREncoding.cs

    r6406 r6475  
    4848    }
    4949
    50     public PWREncoding(int problemDimension, IRandom random)
     50    public PWREncoding(int nrOfJobs, int nrOfResources, IRandom random)
    5151      : base() {
    52       PermutationWithRepetition = new IntegerVector(problemDimension * problemDimension);
    53       int[] lookUpTable = new int[problemDimension];
     52      PermutationWithRepetition = new IntegerVector(nrOfJobs * nrOfResources);
     53      int[] lookUpTable = new int[nrOfJobs];
    5454
    5555      for (int i = 0; i < PermutationWithRepetition.Length; i++) {
    56         int newValue = random.Next(problemDimension);
    57         while (lookUpTable[newValue] >= problemDimension)
    58           newValue = random.Next(problemDimension);
     56        int newValue = random.Next(nrOfJobs);
     57        while (lookUpTable[newValue] >= nrOfResources)
     58          newValue = random.Next(nrOfJobs);
    5959
    6060        PermutationWithRepetition[i] = newValue;
  • branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWRRandomCreator.cs

    r6406 r6475  
    6363    }
    6464
     65    public static PWREncoding Apply(int jobs, int resources, IRandom random) {
     66      return new PWREncoding(jobs, resources, random);
     67    }
     68
    6569
    6670    protected override PWREncoding CreateSolution() {
    67       PWREncoding result = new PWREncoding(JobsParameter.ActualValue.Value, Random);
    68       return result;
     71      return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, Random);
    6972    }
    7073  }
  • branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/Plugin.cs

    r6414 r6475  
    2323
    2424namespace HeuristicLab.Encodings.ScheduleEncoding {
    25   [Plugin("HeuristicLab.Encodings.ScheduleEncoding", "3.3.3.6412")]
     25  [Plugin("HeuristicLab.Encodings.ScheduleEncoding", "3.3.3.6414")]
    2626  [PluginFile("HeuristicLab.Encodings.ScheduleEncoding-3.3.dll", PluginFileType.Assembly)]
    2727  public class HeuristicLabEncodingsScheduleEncodingPlugin : PluginBase {
  • branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVRandomCreator.cs

    r6406 r6475  
    6464    }
    6565
     66    public static PRVEncoding Apply(int jobs, int resources, IRandom random, IntValue nrOfRules) {
     67      return new PRVEncoding(jobs * resources, random, 0, nrOfRules.Value, nrOfRules);
     68    }
    6669
    6770    protected override PRVEncoding CreateSolution() {
    68       IntValue nrOfJobs = new IntValue(JobsParameter.ActualValue.Value);
    69       IntValue nrOfResources = new IntValue(ResourcesParameter.ActualValue.Value);
    70       PRVEncoding solution = new PRVEncoding(nrOfJobs.Value * nrOfResources.Value, RandomParameter.ActualValue, 0, NrOfRules.Value, NrOfRules);
    71       return solution;
     71      return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue, NrOfRules);
    7272    }
     73
     74
    7375  }
    7476}
  • branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/Properties/AssemblyInfo.cs

    r6414 r6475  
    5555// [assembly: AssemblyVersion("1.0.*")]
    5656[assembly: AssemblyVersion("3.3.0.0")]
    57 [assembly: AssemblyFileVersion("3.3.3.6412")]
     57[assembly: AssemblyFileVersion("3.3.3.6414")]
  • branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Resource.cs

    r6412 r6475  
    7575      return sb.ToString();
    7676    }
     77
     78
     79    public override bool Equals(object obj) {
     80      if (obj.GetType() == typeof(Resource))
     81        return AreEqual(this, obj as Resource);
     82      else
     83        return false;
     84    }
     85
     86    private static bool AreEqual(Resource res1, Resource res2) {
     87      if (res1.Tasks.Count != res2.Tasks.Count)
     88        return false;
     89      for (int i = 0; i < res1.Tasks.Count; i++) {
     90        if (!res1.Tasks[i].Equals(res2.Tasks[i]))
     91          return false;
     92      }
     93
     94      return true;
     95    }
    7796  }
    7897}
  • branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Schedule.cs

    r6412 r6475  
    3131  [Item("Schedule", "Represents the general solution for scheduling problems.")]
    3232  [StorableClass]
    33   public class Schedule : NamedItem {
     33  public class Schedule : NamedItem, IScheduleEncoding {
    3434    #region Properties
    3535    [Storable]
     
    7979      lastScheduledTaskOfJob = new Dictionary<int, ScheduledTask>();
    8080    }
     81
    8182
    8283
     
    159160      return quality;
    160161    }
     162
     163    public override bool Equals(object obj) {
     164      if (obj.GetType() == typeof(Schedule))
     165        return AreEqual(this, obj as Schedule);
     166      else
     167        return false;
     168    }
     169
     170    private static bool AreEqual(Schedule schedule1, Schedule schedule2) {
     171      if (schedule1.Resources.Count != schedule2.Resources.Count)
     172        return false;
     173      for (int i = 0; i < schedule1.Resources.Count; i++) {
     174        if (!schedule1.Resources[i].Equals(schedule2.Resources[i]))
     175          return false;
     176      }
     177
     178      return true;
     179    }
     180
    161181  }
    162182}
  • branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/ScheduledTask.cs

    r6414 r6475  
    7171      return sb.ToString();
    7272    }
     73
     74
     75    public override bool Equals(object obj) {
     76      if (obj.GetType() == typeof(ScheduledTask))
     77        return AreEqual(this, obj as ScheduledTask);
     78      else
     79        return false;
     80    }
     81
     82    public static bool AreEqual(ScheduledTask task1, ScheduledTask task2) {
     83      return (task1.Duration == task2.Duration &&
     84        task1.JobNr == task2.JobNr &&
     85        task1.ResourceNr == task2.ResourceNr &&
     86        task1.StartTime == task2.StartTime &&
     87        task1.EndTime == task2.EndTime);
     88    }
    7389  }
    7490}
Note: See TracChangeset for help on using the changeset viewer.