Changeset 14905 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis.Base/Erc/VectorConstantsErcValue.cs
- Timestamp:
- 05/02/17 20:42:40 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis.Base/Erc/VectorConstantsErcValue.cs
r14898 r14905 15 15 private const string ConstantsParameterName = "Constants"; 16 16 17 pr ivate readonly TValue[] arrays; // perf opt: avoid using parameter getter17 protected VectorConstantsErcValue(params TValue[] arrays) : this(true, 1d, arrays) { } 18 18 19 protected VectorConstantsErcValue(params TValue[] arrays) : this(true, arrays) { } 20 21 protected VectorConstantsErcValue(bool isEnabled, params TValue[] arrays) { 22 this.arrays = arrays; 19 protected VectorConstantsErcValue(bool isEnabled, double weight = 1d, params TValue[] arrays) : base(isEnabled, weight) { 23 20 IsEnabled = isEnabled; 24 21 Parameters.Add(new ValueParameter<ItemCollection<TValue>>(ConstantsParameterName, new ItemCollection<TValue>(arrays))); … … 42 39 public override IReadOnlyList<T> GetErcValue(IRandom random) { 43 40 // TODO: remove ToList when ValueTypeArray implements IReadOnlyList 44 return arrays.SampleRandom(random).ToList();41 return Constants.SampleRandom(random).ToArray(); 45 42 } 46 43 }
Note: See TracChangeset
for help on using the changeset viewer.