Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/06/15 15:33:25 (9 years ago)
Author:
mkommend
Message:

#2521: Added encodings for schedules.

Location:
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Crossovers/DirectScheduleCrossover.cs

    r12012 r13437  
    2929  [StorableClass]
    3030  public abstract class DirectScheduleCrossover : ScheduleCrossover, IDirectScheduleOperator {
     31    public ILookupParameter<ItemList<Job>> JobDataParameter {
     32      get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; }
     33    }
     34
    3135    [StorableConstructor]
    3236    protected DirectScheduleCrossover(bool deserializing) : base(deserializing) { }
     
    3438    public DirectScheduleCrossover()
    3539      : base() {
    36       ParentsParameter.ActualName = "Schedule";
    37       ChildParameter.ActualName = "Schedule";
    3840      Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the JSSP - Instance."));
    39     }
    40 
    41     public ILookupParameter<ItemList<Job>> JobDataParameter {
    42       get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; }
    4341    }
    4442
  • branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Crossovers/DirectScheduleGTCrossover.cs

    r12012 r13437  
    6464        Task minimal = GTAlgorithmUtils.GetTaskWithMinimalEC(earliestTasksList, child);
    6565        int conflictedResourceNr = minimal.ResourceNr;
    66         Resource conflictedResource = child.Resources[conflictedResourceNr];
    6766
    6867        //STEP 2 - Compute a conflict set of all operations that can be scheduled on the conflicted resource
    69         ItemList<Task> conflictSet = GTAlgorithmUtils.GetConflictSetForTask(minimal, earliestTasksList, jobData, child);
     68        ItemList<Task> conflictSet = GTAlgorithmUtils.GetConflictSetForTask(minimal, earliestTasksList, child);
    7069
    7170        //STEP 3 - Select a task from the conflict set
    72         int progressOnResource = conflictedResource.Tasks.Count;
    7371        Task selectedTask = null;
    7472        if (random.NextDouble() < mutProp) {
     
    7775        } else {
    7876          //Crossover
    79           selectedTask = SelectTaskFromConflictSet(conflictSet, ((random.Next(2) == 0) ? parent1 : parent2), conflictedResourceNr, progressOnResource);
     77          selectedTask = SelectTaskFromConflictSet(conflictSet, ((random.Next(2) == 0) ? parent1 : parent2), conflictedResourceNr);
    8078        }
    8179
     
    9290    }
    9391
    94     private static Task SelectTaskFromConflictSet(ItemList<Task> conflictSet, Schedule usedParent, int conflictedResourceNr, int progressOnResource) {
     92    private static Task SelectTaskFromConflictSet(ItemList<Task> conflictSet, Schedule usedParent, int conflictedResourceNr) {
    9593      //Apply Crossover
    9694      foreach (ScheduledTask st in usedParent.Resources[conflictedResourceNr].Tasks) {
  • branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/DirectScheduleRandomCreator.cs

    r13435 r13437  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
    25 using HeuristicLab.Data;
    26 using HeuristicLab.Encodings.ScheduleEncoding.PermutationWithRepetition;
    2725using HeuristicLab.Optimization;
    2826using HeuristicLab.Parameters;
     
    3331  [Item("DirectScheduleRandomCreator", "Creator class used to create schedule encoding objects.")]
    3432  [StorableClass]
    35   public class DirectScheduleRandomCreator : ScheduleCreator, IStochasticOperator {
     33  public class DirectScheduleRandomCreator : ScheduleCreator, IStochasticOperator, IDirectScheduleOperator {
    3634
    3735    public ILookupParameter<IRandom> RandomParameter {
    3836      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    3937    }
    40     public IValueLookupParameter<IntValue> JobsParameter {
    41       get { return (IValueLookupParameter<IntValue>)Parameters["Jobs"]; }
    42     }
    43     public IValueLookupParameter<IntValue> ResourcesParameter {
    44       get { return (IValueLookupParameter<IntValue>)Parameters["Resources"]; }
    45     }
    4638    public ILookupParameter<ItemList<Job>> JobDataParameter {
    4739      get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; }
    4840    }
    49 
    5041
    5142    [StorableConstructor]
     
    6051      : base() {
    6152      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator."));
    62       Parameters.Add(new ValueLookupParameter<IntValue>("Jobs", "The number of jobs handled in this problem instance."));
    63       Parameters.Add(new ValueLookupParameter<IntValue>("Resources", "The number of resources used in this problem instance."));
    6453      Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the JSSP - Instance."));
    65       ScheduleParameter.ActualName = "Schedule";
    6654    }
    6755
     
    8977          new PWREncoding(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue),
    9078          jobData);
    91       } catch {
     79      }
     80      catch {
    9281        throw new Exception("ScheduleRandomCreator needs JobData parameter from a JSSP-Instance to create Schedule-Instances!");
    9382      }
  • branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Manipulators/DirectScheduleManipulator.cs

    r13435 r13437  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Parameters;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2627
     
    2930  [StorableClass]
    3031  public abstract class DirectScheduleManipulator : ScheduleManipulator, IDirectScheduleOperator {
     32    public ILookupParameter<ItemList<Job>> JobDataParameter {
     33      get { return (LookupParameter<ItemList<Job>>)Parameters["JobData"]; }
     34    }
    3135
    3236    [StorableConstructor]
    3337    protected DirectScheduleManipulator(bool deserializing) : base(deserializing) { }
    3438    protected DirectScheduleManipulator(DirectScheduleManipulator original, Cloner cloner) : base(original, cloner) { }
     39
    3540    public DirectScheduleManipulator()
    3641      : base() {
    37       ScheduleParameter.ActualName = "Schedule";
     42      Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the JSSP - Instance."));
    3843    }
    3944
     
    4247    public override IOperation InstrumentedApply() {
    4348      var schedule = ScheduleParameter.ActualValue as Schedule;
    44       if (schedule == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type Schedule.");
     49      if (schedule == null) throw new InvalidOperationException("Schedule was not found or is not of type Schedule.");
    4550      Manipulate(RandomParameter.ActualValue, schedule);
    4651      return base.InstrumentedApply();
Note: See TracChangeset for help on using the changeset viewer.