Ignore:
Timestamp:
04/10/17 00:27:31 (3 years ago)
Author:
pkimmesw
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Creator/PointsBasedPushProgramCreator.cs

    r14777 r14834  
    1 //namespace HeuristicLab.Problems.ProgramSynthesis.Push.Creator {
     1namespace HeuristicLab.Problems.ProgramSynthesis.Push.Creator {
    22
    3 //  using HeuristicLab.Common;
    4 //  using HeuristicLab.Core;
    5 //  using HeuristicLab.Operators;
    6 //  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    7 //  using HeuristicLab.Problems.ProgramSynthesis.Push.Configuration;
    8 //  using HeuristicLab.Problems.ProgramSynthesis.Push.Expressions;
    9 //  using HeuristicLab.Problems.ProgramSynthesis.Push.Generators;
     3  using Common;
     4  using Configuration;
     5  using Core;
     6  using Encodings.IntegerVectorEncoding;
     7  using Erc;
     8  using Expressions;
     9  using Generators.CodeGenerator;
    1010
    11 //  [Item("PointBasedPushProgramCreator", "Creates a Push program whereby points specify the max size but not the min size of the program.")]
    12 //  [StorableClass]
    13 //  public class PointsBasedPushProgramCreator : InstrumentedOperator, IPushProgramCreator {
     11  using HeuristicLab.Data;
    1412
    15 //    public PointsBasedPushProgramCreator(bool deserializing) : base(deserializing) { }
     13  using Persistence.Default.CompositeSerializers.Storable;
    1614
    17 //    public PointsBasedPushProgramCreator(PointsBasedPushProgramCreator origin, Cloner cloner) : base(origin, cloner) {
     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";
    1819
    19 //    }
     20    public PointsBasedPushProgramCreator(ErcOptions ercOptions) {
     21      //Parameters.Add(new FixedValueParameter<ErcOptions>(ErcOptionsParameterName, ercOptions));
     22    }
    2023
    21 //    public override IDeepCloneable Clone(Cloner cloner) {
    22 //      return new PointsBasedPushProgramCreator(this, cloner);
    23 //    }
     24    [StorableConstructor]
     25    public PointsBasedPushProgramCreator(bool deserializing) : base(deserializing) { }
    2426
    25 //    public PushProgram CreateProgram(IRandom random, IReadOnlyPushConfiguration config) {
    26 //      return CodeGenerator.RandomProgram(10, random, config);
    27 //    }
    28 //  }
    29 //}
     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 TracChangeset for help on using the changeset viewer.