Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/21/11 00:46:33 (14 years ago)
Author:
cneumuel
Message:

#1215

  • implemented population diversity analysis
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  
    493493      }
    494494    }
     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    }
    495504  }
    496505}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/ConstrainedValue.cs

    r5231 r5522  
    8686    #endregion
    8787
    88     void value_ToStringChanged(object sender, EventArgs e) {
     88    private void value_ToStringChanged(object sender, EventArgs e) {
    8989      OnToStringChanged();
    9090    }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/DoubleValueRange.cs

    r5337 r5522  
    4848      return solutions;
    4949    }
     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    }
    5056  }
    5157}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/IntValueRange.cs

    r5337 r5522  
    4747      return solutions;
    4848    }
     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    }
    4955  }
    5056}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/PercentValueRange.cs

    r5337 r5522  
    5252      return solutions;
    5353    }
     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    }
    5460  }
    5561}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/Range.cs

    r5144 r5522  
    208208
    209209    protected abstract T GetRandomSample(IRandom random);
     210
    210211    IItem IRange.GetRandomValue(IRandom random) {
    211212      return GetRandomValue(random);
     
    216217      return GetCombinations().Cast<IItem>().ToArray();
    217218    }
     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);
    218225  }
    219226}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ValueConfiguration.cs

    r5361 r5522  
    326326      return list;
    327327    }
     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    }
    328345  }
    329346}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj

    r5359 r5522  
    7575      <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath>
    7676    </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>
    7780    <Reference Include="HeuristicLab.Collections-3.3">
    7881      <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath>
     
    119122    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    120123      <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>
    121127    </Reference>
    122128    <Reference Include="HeuristicLab.SequentialEngine-3.3">
     
    133139  <ItemGroup>
    134140    <Compile Include="Analyzers\BestParameterConfigurationAnalyzer.cs" />
     141    <Compile Include="Analyzers\PMOPopulationDiversityAnalyzer.cs" />
    135142    <Compile Include="ConstrainedTypeValue.cs" />
    136143    <Compile Include="MetaOptimizationUtil.cs" />
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IOptimizable.cs

    r5340 r5522  
    2020    string ParameterInfoString { get; }
    2121    void CollectOptimizedParameterNames(List<string> parameterNames, string prefix);
     22    double CalculateSimilarity(IOptimizable optimizable);
    2223
    2324    /// <summary>
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IRange.cs

    r5144 r5522  
    1818
    1919    IEnumerable<IItem> GetCombinations();
     20
     21    double CalculateSimilarity(IItem a, IItem b);
    2022  }
    2123
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs

    r5359 r5522  
    107107      get { return Operators.OfType<SolutionCacheAnalyzer>().FirstOrDefault(); }
    108108    }
     109    private PMOPopulationDiversityAnalyzer PMOPopulationDiversityAnalyzer {
     110      get { return Operators.OfType<PMOPopulationDiversityAnalyzer>().FirstOrDefault(); }
     111    }   
    109112    #endregion
    110113
     
    170173      Operators.Add(new ReferenceQualityAnalyzer());
    171174      Operators.Add(new SolutionCacheAnalyzer());
     175      Operators.Add(new PMOPopulationDiversityAnalyzer());
    172176    }
    173177    private void ParameterizeSolutionCreator() {
     
    185189      if (RunsAnalyzer != null) {
    186190        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;
    187195      }
    188196    }
Note: See TracChangeset for help on using the changeset viewer.