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:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP

    • Property svn:ignore set to
      *.user
  • 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.