Changeset 15289 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/SolutionCreator/PushSolutionCreator.cs
- Timestamp:
- 07/26/17 19:34:13 (7 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP
- Files:
-
- 2 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/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.