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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVRandomCreator.cs

    r13435 r13437  
    2222using HeuristicLab.Common;
    2323using HeuristicLab.Core;
    24 using HeuristicLab.Data;
    2524using HeuristicLab.Optimization;
    2625using HeuristicLab.Parameters;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2827
    29 namespace HeuristicLab.Encodings.ScheduleEncoding.PriorityRulesVector {
     28namespace HeuristicLab.Encodings.ScheduleEncoding {
    3029  [Item("PriorityRulesRandomCreator", "Creator class used to create PRV encoding objects for scheduling problems.")]
    3130  [StorableClass]
     
    3332
    3433    [Storable]
    35     public IntValue NrOfRules { get; set; }
     34    public int NrOfRules { get; set; }
    3635
    3736    public ILookupParameter<IRandom> RandomParameter {
    3837      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    39     }
    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"]; }
    4538    }
    4639
     
    4942    protected PRVRandomCreator(PRVRandomCreator original, Cloner cloner)
    5043      : base(original, cloner) {
    51       this.NrOfRules = cloner.Clone(original.NrOfRules);
     44      this.NrOfRules = original.NrOfRules;
    5245    }
    53     public PRVRandomCreator()
    54       : base() {
    55       NrOfRules = new IntValue(10);
    56       Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator."));
    57       Parameters.Add(new ValueLookupParameter<IntValue>("Jobs", "The number of jobs handled in this problem instance."));
    58       Parameters.Add(new ValueLookupParameter<IntValue>("Resources", "The number of resources used in this problem instance."));
    59       ScheduleParameter.ActualName = "PriorityRulesVector";
    60     }
    61 
    6246    public override IDeepCloneable Clone(Cloner cloner) {
    6347      return new PRVRandomCreator(this, cloner);
    6448    }
    6549
    66     public static PRVEncoding Apply(int jobs, int resources, IRandom random, IntValue nrOfRules) {
    67       return new PRVEncoding(jobs * resources, random, 0, nrOfRules.Value, nrOfRules);
     50    public PRVRandomCreator()
     51      : base() {
     52      NrOfRules = 10;
     53      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator."));
     54    }
     55
     56    public static PRVEncoding Apply(int jobs, int resources, IRandom random, int nrOfRules) {
     57      return new PRVEncoding(jobs * resources, random, 0, nrOfRules, nrOfRules);
    6858    }
    6959
     
    7161      return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue, NrOfRules);
    7262    }
    73 
    74 
    7563  }
    7664}
Note: See TracChangeset for help on using the changeset viewer.