Changeset 11013 for trunk/sources
- Timestamp:
- 06/12/14 14:35:16 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs
r10955 r11013 27 27 private const string PruningOperatorParameterName = "PruningOperator"; 28 28 private const string ResultsParameterName = "Results"; 29 private const string PopulationSizeParameterName = "PopulationSize"; 29 30 #endregion 30 31 #region private members … … 62 63 public IValueParameter<DoubleValue> PruningProbabilityParameter { 63 64 get { return (IValueParameter<DoubleValue>)Parameters[PruningProbabilityParameterName]; } 65 } 66 public ILookupParameter<IntValue> PopulationSizeParameter { 67 get { return (ILookupParameter<IntValue>)Parameters[PopulationSizeParameterName]; } 64 68 } 65 69 #endregion … … 99 103 this.resultsCollector = (ResultsCollector)original.resultsCollector.Clone(); 100 104 } 105 106 [StorableHook(HookType.AfterDeserialization)] 107 private void AfterDeserialization() { 108 if (!Parameters.ContainsKey(PopulationSizeParameterName)) { 109 Parameters.Add(new LookupParameter<IntValue>(PopulationSizeParameterName, "The population of individuals.")); 110 } 111 } 112 101 113 protected SymbolicDataAnalysisSingleObjectivePruningAnalyzer() { 102 114 #region add parameters … … 109 121 Parameters.Add(new FixedValueParameter<DoubleValue>(NodeImpactThresholdParameterName, new DoubleValue(0.0))); 110 122 Parameters.Add(new FixedValueParameter<BoolValue>(PruneOnlyZeroImpactNodesParameterName, new BoolValue(false))); 123 Parameters.Add(new LookupParameter<IntValue>(PopulationSizeParameterName, "The population of individuals.")); 111 124 #endregion 112 125 } … … 143 156 /// <returns>Returns an int range [start, end]</returns> 144 157 private IntRange GetSliceBounds() { 145 var count = ExecutionContext.Scope.SubScopes.Count; 158 if (PopulationSlice.Start < 0 || PopulationSlice.End < 0) throw new ArgumentOutOfRangeException("The slice bounds cannot be negative."); 159 if (PopulationSlice.Start > 1 || PopulationSlice.End > 1) throw new ArgumentOutOfRangeException("The slice bounds should be expressed as unit percentages."); 160 var count = PopulationSizeParameter.ActualValue.Value; 146 161 var start = (int)Math.Round(PopulationSlice.Start * count); 147 162 var end = (int)Math.Round(PopulationSlice.End * count); 148 163 if (end > count) end = count; 149 164 150 if (PopulationSlice.Start > 1 || PopulationSlice.End > 1) throw new ArgumentOutOfRangeException("The slice bounds should be expressed as unit percentages.");151 165 if (start >= end) throw new ArgumentOutOfRangeException("Invalid PopulationSlice bounds."); 152 166 return new IntRange(start, end);
Note: See TracChangeset
for help on using the changeset viewer.