Changeset 13437 for branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVRandomCreator.cs
- Timestamp:
- 12/06/15 15:33:25 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVRandomCreator.cs
r13435 r13437 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data;25 24 using HeuristicLab.Optimization; 26 25 using HeuristicLab.Parameters; 27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 29 namespace HeuristicLab.Encodings.ScheduleEncoding .PriorityRulesVector{28 namespace HeuristicLab.Encodings.ScheduleEncoding { 30 29 [Item("PriorityRulesRandomCreator", "Creator class used to create PRV encoding objects for scheduling problems.")] 31 30 [StorableClass] … … 33 32 34 33 [Storable] 35 public IntValueNrOfRules { get; set; }34 public int NrOfRules { get; set; } 36 35 37 36 public ILookupParameter<IRandom> RandomParameter { 38 37 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"]; }45 38 } 46 39 … … 49 42 protected PRVRandomCreator(PRVRandomCreator original, Cloner cloner) 50 43 : base(original, cloner) { 51 this.NrOfRules = cloner.Clone(original.NrOfRules);44 this.NrOfRules = original.NrOfRules; 52 45 } 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 62 46 public override IDeepCloneable Clone(Cloner cloner) { 63 47 return new PRVRandomCreator(this, cloner); 64 48 } 65 49 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); 68 58 } 69 59 … … 71 61 return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue, NrOfRules); 72 62 } 73 74 75 63 } 76 64 }
Note: See TracChangeset
for help on using the changeset viewer.