- Timestamp:
- 02/21/11 00:46:33 (14 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs
r5361 r5522 493 493 } 494 494 } 495 496 public double CalculateSimilarity(IOptimizable optimizable) { 497 var other = (IParameterConfiguration)optimizable; 498 if (this.ActualValueConfigurationIndex == other.ActualValueConfigurationIndex) { 499 return this.ValueConfigurations[this.ActualValueConfigurationIndex].CalculateSimilarity(other.ValueConfigurations[other.ActualValueConfigurationIndex]); 500 } else { 501 return 0.0; 502 } 503 } 495 504 } 496 505 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/ConstrainedValue.cs
r5231 r5522 86 86 #endregion 87 87 88 void value_ToStringChanged(object sender, EventArgs e) {88 private void value_ToStringChanged(object sender, EventArgs e) { 89 89 OnToStringChanged(); 90 90 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/DoubleValueRange.cs
r5337 r5522 48 48 return solutions; 49 49 } 50 51 protected override double CalculateSimilarityValue(DoubleValue a, DoubleValue b) { 52 double range = UpperBound.Value - LowerBound.Value; 53 double diff = Math.Abs(a.Value - b.Value); 54 return Math.Max(0, (range - (diff*2)) / range); 55 } 50 56 } 51 57 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/IntValueRange.cs
r5337 r5522 47 47 return solutions; 48 48 } 49 50 protected override double CalculateSimilarityValue(IntValue a, IntValue b) { 51 double range = UpperBound.Value - LowerBound.Value; 52 double diff = Math.Abs(a.Value - b.Value); 53 return Math.Max(0, (range - (diff * 2)) / range); 54 } 49 55 } 50 56 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/PercentValueRange.cs
r5337 r5522 52 52 return solutions; 53 53 } 54 55 protected override double CalculateSimilarityValue(PercentValue a, PercentValue b) { 56 double range = UpperBound.Value - LowerBound.Value; 57 double diff = Math.Abs(a.Value - b.Value); 58 return Math.Max(0, (range - (diff * 2)) / range); 59 } 54 60 } 55 61 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/Range.cs
r5144 r5522 208 208 209 209 protected abstract T GetRandomSample(IRandom random); 210 210 211 IItem IRange.GetRandomValue(IRandom random) { 211 212 return GetRandomValue(random); … … 216 217 return GetCombinations().Cast<IItem>().ToArray(); 217 218 } 219 220 public virtual double CalculateSimilarity(IItem a, IItem b) { 221 return CalculateSimilarityValue((T)a, (T)b); 222 } 223 224 protected abstract double CalculateSimilarityValue(T a, T b); 218 225 } 219 226 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ValueConfiguration.cs
r5361 r5522 326 326 return list; 327 327 } 328 329 public double CalculateSimilarity(IOptimizable optimizable) { 330 var other = (IValueConfiguration)optimizable; 331 if (rangeConstraint != null) { 332 return this.RangeConstraint.CalculateSimilarity(this.ActualValue.Value, other.ActualValue.Value); 333 } else { 334 double sum = 0; 335 int count = 0; 336 for (int i = 0; i < ParameterConfigurations.Count; i++) { 337 if (this.ParameterConfigurations.ElementAt(i).Optimize) { 338 sum += this.ParameterConfigurations.ElementAt(i).CalculateSimilarity(other.ParameterConfigurations.ElementAt(i)); 339 count++; 340 } 341 } 342 return count == 0 ? 1.0 : sum / (double)count; 343 } 344 } 328 345 } 329 346 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj
r5359 r5522 75 75 <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath> 76 76 </Reference> 77 <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 78 <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Analysis-3.3.dll</HintPath> 79 </Reference> 77 80 <Reference Include="HeuristicLab.Collections-3.3"> 78 81 <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath> … … 119 122 <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 120 123 <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Random-3.3.dll</HintPath> 124 </Reference> 125 <Reference Include="HeuristicLab.Selection-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 126 <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Selection-3.3.dll</HintPath> 121 127 </Reference> 122 128 <Reference Include="HeuristicLab.SequentialEngine-3.3"> … … 133 139 <ItemGroup> 134 140 <Compile Include="Analyzers\BestParameterConfigurationAnalyzer.cs" /> 141 <Compile Include="Analyzers\PMOPopulationDiversityAnalyzer.cs" /> 135 142 <Compile Include="ConstrainedTypeValue.cs" /> 136 143 <Compile Include="MetaOptimizationUtil.cs" /> -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IOptimizable.cs
r5340 r5522 20 20 string ParameterInfoString { get; } 21 21 void CollectOptimizedParameterNames(List<string> parameterNames, string prefix); 22 double CalculateSimilarity(IOptimizable optimizable); 22 23 23 24 /// <summary> -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IRange.cs
r5144 r5522 18 18 19 19 IEnumerable<IItem> GetCombinations(); 20 21 double CalculateSimilarity(IItem a, IItem b); 20 22 } 21 23 -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs
r5359 r5522 107 107 get { return Operators.OfType<SolutionCacheAnalyzer>().FirstOrDefault(); } 108 108 } 109 private PMOPopulationDiversityAnalyzer PMOPopulationDiversityAnalyzer { 110 get { return Operators.OfType<PMOPopulationDiversityAnalyzer>().FirstOrDefault(); } 111 } 109 112 #endregion 110 113 … … 170 173 Operators.Add(new ReferenceQualityAnalyzer()); 171 174 Operators.Add(new SolutionCacheAnalyzer()); 175 Operators.Add(new PMOPopulationDiversityAnalyzer()); 172 176 } 173 177 private void ParameterizeSolutionCreator() { … … 185 189 if (RunsAnalyzer != null) { 186 190 RunsAnalyzer.ParameterConfigurationParameter.ActualName = ((RandomParameterConfigurationCreator)SolutionCreator).ParameterConfigurationParameter.ActualName; 191 } 192 if (PMOPopulationDiversityAnalyzer != null) { 193 PMOPopulationDiversityAnalyzer.SolutionParameter.ActualName = ((RandomParameterConfigurationCreator)SolutionCreator).ParameterConfigurationParameter.ActualName; 194 PMOPopulationDiversityAnalyzer.StoreHistoryParameter.Value.Value = true; 187 195 } 188 196 }
Note: See TracChangeset
for help on using the changeset viewer.