Changeset 15289 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/SolutionCreator
- Timestamp:
- 07/26/17 19:34:13 (7 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP
-
Property
svn:ignore
set to
*.user
-
Property
svn:ignore
set to
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/SolutionCreator/IPlushCreator.cs
r15275 r15289 12 12 IValueLookupParameter<IntValue> MinCloseParameter { get; } 13 13 IValueLookupParameter<IntValue> MaxCloseParameter { get; } 14 IValueLookupParameter<DoubleValue> CloseBiasLevelParameter { get; } 14 15 IValueLookupParameter<PercentValue> InInstructionProbabilityParameter { get; } 15 16 IValueLookupParameter<IReadOnlyErcOptions> ErcOptionsParameter { get; } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/SolutionCreator/PlushCreator.cs
r15275 r15289 77 77 get { return (IValueLookupParameter<IntValue>)Parameters["MaxClose"]; } 78 78 } 79 public IValueLookupParameter<DoubleValue> CloseBiasLevel 79 public IValueLookupParameter<DoubleValue> CloseBiasLevelParameter 80 80 { 81 81 get { return (IValueLookupParameter<DoubleValue>)Parameters["CloseBiasLevel"]; } … … 99 99 var minClose = MinCloseParameter.ActualValue.Value; 100 100 var maxClose = MaxCloseParameter.ActualValue.Value; 101 var biasLevel = CloseBiasLevel .ActualValue.Value;101 var biasLevel = CloseBiasLevelParameter.ActualValue.Value; 102 102 103 103 if (minLength > maxLength) … … 111 111 112 112 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 114 119 var close = random.NextBiased(minClose, maxClose, biasLevel); 115 120 -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/SolutionCreator/PushSolutionCreator.cs
r15273 r15289 1 1 namespace HeuristicLab.Problems.ProgramSynthesis.Push.SolutionCreator { 2 using System;3 2 4 3 using HeuristicLab.Common; … … 9 8 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 10 9 using HeuristicLab.Problems.ProgramSynthesis.Base.Erc; 10 using HeuristicLab.Problems.ProgramSynthesis.Push.Configuration; 11 11 12 12 /// <summary> … … 34 34 if (!Parameters.ContainsKey(IN_INSTRUCTION_PROBABILITY)) 35 35 Parameters.Add(new FixedValueParameter<PercentValue>(IN_INSTRUCTION_PROBABILITY, new PercentValue(0.05))); 36 37 Parameters.Add(new ValueLookupParameter<IReadOnlyExpressionsConfiguration>("Instructions", "The enabled instructions")); 36 38 } 37 39 … … 68 70 } 69 71 72 public IValueLookupParameter<IReadOnlyExpressionsConfiguration> InstructionsParameter 73 { 74 get { return (IValueLookupParameter<IReadOnlyExpressionsConfiguration>)Parameters["Instructions"]; } 75 } 76 70 77 //public IValueParameter<IntValue> MaxLengthParameter 71 78 //{ … … 94 101 var result = new IntegerVector(len); 95 102 96 var variableLength = random.Next(MinLength, len); 97 var contentLength = Math.Min(variableLength, len); 103 var contentLength = random.Next(MinLength, len); 98 104 var lowerBound = bounds[0, 0]; 99 105 var upperBound = bounds[0, 1]; 100 var inInstructionRelativeProbability = ErcOptions.ErcProbability + InInstructionProbability; 106 //var inInstructionRelativeProbability = ErcOptions.ErcProbability + InInstructionProbability; 107 //var instructions = InstructionsParameter.ActualValue; 101 108 102 109 for (var i = 0; i < contentLength; i++) { 103 var x = random.NextDouble();110 //var x = random.NextDouble(); 104 111 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 //} 113 123 } 114 124
Note: See TracChangeset
for help on using the changeset viewer.