Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/26/17 19:34:13 (7 years ago)
Author:
pkimmesw
Message:

#2665 Fixed analyzer, fixed Plush encoding + operators, adpated print evaluation according to McPhee

Location:
branches/PushGP/HeuristicLab.PushGP
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP

    • Property svn:ignore set to
      *.user
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/SolutionCreator/IPlushCreator.cs

    r15275 r15289  
    1212    IValueLookupParameter<IntValue> MinCloseParameter { get; }
    1313    IValueLookupParameter<IntValue> MaxCloseParameter { get; }
     14    IValueLookupParameter<DoubleValue> CloseBiasLevelParameter { get; }
    1415    IValueLookupParameter<PercentValue> InInstructionProbabilityParameter { get; }
    1516    IValueLookupParameter<IReadOnlyErcOptions> ErcOptionsParameter { get; }
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/SolutionCreator/PlushCreator.cs

    r15275 r15289  
    7777      get { return (IValueLookupParameter<IntValue>)Parameters["MaxClose"]; }
    7878    }
    79     public IValueLookupParameter<DoubleValue> CloseBiasLevel
     79    public IValueLookupParameter<DoubleValue> CloseBiasLevelParameter
    8080    {
    8181      get { return (IValueLookupParameter<DoubleValue>)Parameters["CloseBiasLevel"]; }
     
    9999      var minClose = MinCloseParameter.ActualValue.Value;
    100100      var maxClose = MaxCloseParameter.ActualValue.Value;
    101       var biasLevel = CloseBiasLevel.ActualValue.Value;
     101      var biasLevel = CloseBiasLevelParameter.ActualValue.Value;
    102102
    103103      if (minLength > maxLength)
     
    111111
    112112      for (var i = 0; i < length; i++) {
    113         var expression = CodeGeneratorUtils.GetRandomExpression(random, ercOptions, instructions, inInstructionProbability);
     113        var expression = CodeGeneratorUtils.GetRandomExpression(
     114          random,
     115          ercOptions,
     116          instructions,
     117          inInstructionProbability);
     118
    114119        var close = random.NextBiased(minClose, maxClose, biasLevel);
    115120
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/SolutionCreator/PushSolutionCreator.cs

    r15273 r15289  
    11namespace HeuristicLab.Problems.ProgramSynthesis.Push.SolutionCreator {
    2   using System;
    32
    43  using HeuristicLab.Common;
     
    98  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    109  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc;
     10  using HeuristicLab.Problems.ProgramSynthesis.Push.Configuration;
    1111
    1212  /// <summary>
     
    3434      if (!Parameters.ContainsKey(IN_INSTRUCTION_PROBABILITY))
    3535        Parameters.Add(new FixedValueParameter<PercentValue>(IN_INSTRUCTION_PROBABILITY, new PercentValue(0.05)));
     36
     37      Parameters.Add(new ValueLookupParameter<IReadOnlyExpressionsConfiguration>("Instructions", "The enabled instructions"));
    3638    }
    3739
     
    6870    }
    6971
     72    public IValueLookupParameter<IReadOnlyExpressionsConfiguration> InstructionsParameter
     73    {
     74      get { return (IValueLookupParameter<IReadOnlyExpressionsConfiguration>)Parameters["Instructions"]; }
     75    }
     76
    7077    //public IValueParameter<IntValue> MaxLengthParameter
    7178    //{
     
    94101      var result = new IntegerVector(len);
    95102
    96       var variableLength = random.Next(MinLength, len);
    97       var contentLength = Math.Min(variableLength, len);
     103      var contentLength = random.Next(MinLength, len);
    98104      var lowerBound = bounds[0, 0];
    99105      var upperBound = bounds[0, 1];
    100       var inInstructionRelativeProbability = ErcOptions.ErcProbability + InInstructionProbability;
     106      //var inInstructionRelativeProbability = ErcOptions.ErcProbability + InInstructionProbability;
     107      //var instructions = InstructionsParameter.ActualValue;
    101108
    102109      for (var i = 0; i < contentLength; i++) {
    103         var x = random.NextDouble();
     110        //var x = random.NextDouble();
    104111
    105         if (ErcOptions.ErcProbability > 0 &&
    106             x <= ErcOptions.ErcProbability)
    107           result[i] = PushSolutionEncoding.Erc;
    108         else if (InInstructionProbability > 0 &&
    109                  x <= inInstructionRelativeProbability)
    110           result[i] = PushSolutionEncoding.In;
    111         else
    112           result[i] = random.Next(lowerBound, upperBound);
     112        //if (ErcOptions.ErcProbability > 0 && x <= ErcOptions.ErcProbability) {
     113        //  result[i] = PushSolutionEncoding.Erc;
     114        //} else if (InInstructionProbability > 0 && x <= inInstructionRelativeProbability && instructions.InExpressionCount > 0) {
     115        //  var index = random.Next(0, instructions.InExpressionCount);
     116        //  var expression = ExpressionTable.InExpressionTable[index];
     117
     118        //  instructions.EnabledExpressions
     119        //  //result[i] = PushSolutionEncoding.In;
     120        //} else {
     121        result[i] = random.Next(lowerBound, upperBound);
     122        //}
    113123      }
    114124
Note: See TracChangeset for help on using the changeset viewer.