Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Creator/PointsBasedPushProgramCreator.cs @ 14834

Last change on this file since 14834 was 14834, checked in by pkimmesw, 7 years ago

#2665 LexicaseSelector, Performance improvements, UI Fixes, Debugger only shows used stacks, fixed Debugger stepping, Added vector expressions, ERCOptions,

File size: 1.6 KB
Line 
1namespace HeuristicLab.Problems.ProgramSynthesis.Push.Creator {
2
3  using Common;
4  using Configuration;
5  using Core;
6  using Encodings.IntegerVectorEncoding;
7  using Erc;
8  using Expressions;
9  using Generators.CodeGenerator;
10
11  using HeuristicLab.Data;
12
13  using Persistence.Default.CompositeSerializers.Storable;
14
15  [Item("PointBasedPushProgramCreator", "Creates a Push program whereby points specify the max size but not the min size of the program.")]
16  [StorableClass]
17  public class PointsBasedPushProgramCreator : UniformRandomIntegerVectorCreator, IPushProgramCreator {
18    //private const string ErcOptionsParameterName = "ERC Options";
19
20    public PointsBasedPushProgramCreator(ErcOptions ercOptions) {
21      //Parameters.Add(new FixedValueParameter<ErcOptions>(ErcOptionsParameterName, ercOptions));
22    }
23
24    [StorableConstructor]
25    public PointsBasedPushProgramCreator(bool deserializing) : base(deserializing) { }
26
27    public PointsBasedPushProgramCreator(PointsBasedPushProgramCreator origin, Cloner cloner) : base(origin, cloner) {
28    }
29
30    public override IDeepCloneable Clone(Cloner cloner) {
31      return new PointsBasedPushProgramCreator(this, cloner);
32    }
33
34    public PushProgram CreateProgram(IRandom random, IReadOnlyPushConfiguration config) {
35      return LinearCodeGenerator.RandomProgram(LengthParameter.Value.Value, random, config);
36    }
37
38    protected override IntegerVector Create(IRandom random, IntValue length, IntMatrix bounds) {
39      var x = random.Next(length.Value + 1);
40      return base.Create(random, new IntValue(x), bounds);
41    }
42  }
43}
Note: See TracBrowser for help on using the repository browser.