Changeset 14776 for branches/PerformanceComparison
- Timestamp:
- 03/22/17 16:52:36 (8 years ago)
- Location:
- branches/PerformanceComparison
- Files:
-
- 5 added
- 5 deleted
- 21 edited
- 5 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/Binary/SolutionModel/Univariate/BiasedModelTrainer.cs
r14563 r14776 26 26 using HeuristicLab.Data; 27 27 using HeuristicLab.Encodings.BinaryVectorEncoding; 28 using HeuristicLab.Encodings.BinaryVectorEncoding.SolutionModel; 28 29 using HeuristicLab.Optimization; 29 30 using HeuristicLab.Parameters; … … 31 32 32 33 namespace HeuristicLab.Algorithms.MemPR.Binary.SolutionModel.Univariate { 34 public enum ModelBiasOptions { Rank, Fitness } 35 33 36 [Item("Biased Univariate Model Trainer (binary)", "", ExcludeGenericTypeInfo = true)] 34 37 [StorableClass] … … 60 63 61 64 public void TrainModel(TContext context) { 62 context.Model = Trainer.TrainBiased(ModelBias, context.Random, context.Maximization, context.Population.Select(x => x.Solution), context.Population.Select(x => x.Fitness)); 65 var biasType = modelBiasParameter.Value.Value; 66 switch (biasType) { 67 case ModelBiasOptions.Fitness: 68 context.Model = UnivariateModelTrainer.TrainWithFitnessBias(context.Random, context.Maximization, 69 context.Population.Select(x => x.Solution), 70 context.Population.Select(x => x.Fitness)); 71 break; 72 case ModelBiasOptions.Rank: 73 context.Model = UnivariateModelTrainer.TrainWithRankBias(context.Random, context.Maximization, 74 context.Population.Select(x => x.Solution), 75 context.Population.Select(x => x.Fitness)); 76 break; 77 } 63 78 } 64 79 } -
branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/Binary/SolutionModel/Univariate/UnbiasedModelTrainer.cs
r14563 r14776 25 25 using HeuristicLab.Core; 26 26 using HeuristicLab.Encodings.BinaryVectorEncoding; 27 using HeuristicLab.Encodings.BinaryVectorEncoding.SolutionModel; 27 28 using HeuristicLab.Optimization; 28 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 49 50 50 51 public void TrainModel(TContext context) { 51 context.Model = Trainer.TrainUnbiased(context.Random, context.Population.Select(x => x.Solution));52 context.Model = UnivariateModelTrainer.TrainUnbiased(context.Random, context.Population.Select(x => x.Solution)); 52 53 } 53 54 } -
branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/HeuristicLab.Algorithms.MemPR-3.3.csproj
r14691 r14776 102 102 <Private>False</Private> 103 103 </Reference> 104 <Reference Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3">105 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath>106 <Private>False</Private>107 </Reference>108 <Reference Include="HeuristicLab.Encodings.LinearLinkageEncoding-3.4">109 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.LinearLinkageEncoding-3.4.dll</HintPath>110 <Private>False</Private>111 </Reference>112 104 <Reference Include="HeuristicLab.Operators-3.3"> 113 105 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath> … … 165 157 <Compile Include="Binary\LocalSearch\ExhaustiveBitflip.cs" /> 166 158 <Compile Include="Binary\LocalSearch\StaticAPI\ExhaustiveBitflip.cs" /> 167 <Compile Include="Binary\SolutionModel\Univariate\StaticAPI\Trainer.cs" />168 <Compile Include="Binary\SolutionModel\Univariate\UnivariateSolutionModel.cs" />169 159 <Compile Include="Binary\SolutionModel\Univariate\BiasedModelTrainer.cs" /> 170 160 <Compile Include="Binary\SolutionModel\Univariate\UnbiasedModelTrainer.cs" /> … … 179 169 <Compile Include="LinearLinkage\SolutionModel\Univariate\UnivariateSolutionModel.cs" /> 180 170 <Compile Include="MemPRAlgorithm.cs" /> 171 <Compile Include="Permutation\InversionPathRelinker.cs" /> 172 <Compile Include="Permutation\LocalSearch\ExhaustiveInversionImprover.cs" /> 181 173 <Compile Include="Permutation\PermutationMemPR.cs" /> 182 174 <Compile Include="Permutation\PermutationMemPRContext.cs" /> … … 212 204 <Private>False</Private> 213 205 </ProjectReference> 206 <ProjectReference Include="..\..\HeuristicLab.Encodings.BinaryVectorEncoding\3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj"> 207 <Project>{66d249c3-a01d-42a8-82a2-919bc8ec3d83}</Project> 208 <Name>HeuristicLab.Encodings.BinaryVectorEncoding-3.3</Name> 209 <Private>False</Private> 210 </ProjectReference> 211 <ProjectReference Include="..\..\HeuristicLab.Encodings.LinearLinkageEncoding\3.4\HeuristicLab.Encodings.LinearLinkageEncoding-3.4.csproj"> 212 <Project>{be698769-975a-429e-828c-72bb2b6182c8}</Project> 213 <Name>HeuristicLab.Encodings.LinearLinkageEncoding-3.4</Name> 214 <Private>False</Private> 215 </ProjectReference> 214 216 <ProjectReference Include="..\..\HeuristicLab.Encodings.PermutationEncoding\3.3\HeuristicLab.Encodings.PermutationEncoding-3.3.csproj"> 215 217 <Project>{dbecb8b0-b166-4133-baf1-ed67c3fd7fca}</Project> -
branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/Interfaces/Interfaces.cs
r14690 r14776 37 37 * ********************************************* * 38 38 *************************************************/ 39 40 public interface ISolutionModel<TSolution> : IItem {41 TSolution Sample();42 }43 39 44 40 public interface ISolutionSubspace<TSolution> : IItem { } … … 89 85 where TProblem : class, ISingleObjectiveHeuristicOptimizationProblem { 90 86 IEnumerable<ISingleObjectiveSolutionScope<TSolution>> Population { get; } 87 int PopulationCount { get; } 91 88 } 92 89 -
branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/LinearLinkage/SolutionModel/Univariate/StaticAPI/Trainer.cs
r14544 r14776 21 21 22 22 using System.Collections.Generic; 23 using HeuristicLab.Algorithms.MemPR.Interfaces;24 23 using HeuristicLab.Core; 25 24 using HeuristicLab.Encodings.LinearLinkageEncoding; 25 using HeuristicLab.Optimization; 26 26 27 27 namespace HeuristicLab.Algorithms.MemPR.Grouping.SolutionModel.Univariate { -
branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/LinearLinkage/SolutionModel/Univariate/UnivariateSolutionModel.cs
r14544 r14776 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Algorithms.MemPR.Interfaces;25 24 using HeuristicLab.Common; 26 25 using HeuristicLab.Core; 27 26 using HeuristicLab.Data; 28 27 using HeuristicLab.Encodings.LinearLinkageEncoding; 28 using HeuristicLab.Optimization; 29 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 30 -
branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/Permutation/SolutionModel/Univariate/StaticAPI/Trainer.cs
r14496 r14776 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Algorithms.MemPR.Interfaces;25 24 using HeuristicLab.Core; 26 25 using HeuristicLab.Encodings.PermutationEncoding; 26 using HeuristicLab.Optimization; 27 27 28 28 namespace HeuristicLab.Algorithms.MemPR.Permutation.SolutionModel.Univariate { -
branches/PerformanceComparison/HeuristicLab.Analysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Analysis merged: 14734,14737,14775
- Property svn:mergeinfo changed
-
branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/CharacteristicCalculator/AdaptiveWalkCalculator.cs
r13920 r14776 58 58 characteristics = cloner.Clone(original.characteristics); 59 59 } 60 public AdaptiveWalkCalculator() { 60 public AdaptiveWalkCalculator() : this(new AdaptiveWalk()) { } 61 public AdaptiveWalkCalculator(AdaptiveWalk walker) { 61 62 Name = ItemName; 62 63 Description = ItemDescription; 63 walker = new AdaptiveWalk();64 this.walker = walker; 64 65 characteristics = new CheckedItemList<StringValue>( 65 66 new[] { "AutoCorrelation1", "CorrelationLength", "InformationContent", 66 "PartialInformationContent", "DensityBasinInformation", "InformationStability", 67 "PartialInformationContent", "DensityBasinInformation", "InformationStability", 67 68 "Diversity", "Regularity", "TotalEntropy", "PeakInformationContent", 68 69 "PeakDensityBasinInformation" }.Select(x => new StringValue(x))); -
branches/PerformanceComparison/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj
r13794 r14776 187 187 <Compile Include="BestNScopesSolutionAnalyzer.cs" /> 188 188 <Compile Include="BestScopeSolutionAnalyzer.cs" /> 189 <Compile Include="DataVisualization\GanttData.cs" /> 189 190 <Compile Include="Clustering\CkMeans1D.cs"> 190 191 <SubType>Code</SubType> -
branches/PerformanceComparison/HeuristicLab.Analysis/3.3/QualityAnalysis/ExpectedRuntimeHelper.cs
r13803 r14776 30 30 if (successful.Count > 0) { 31 31 var succAvg = successful.Average(); 32 var succDev = successful.StandardDeviation() ;32 var succDev = successful.StandardDeviation() + 1e-7; 33 33 successful.RemoveAll(x => x < succAvg - 2 * succDev); 34 34 unsuccessful.RemoveAll(x => x < succAvg - 2 * succDev); -
branches/PerformanceComparison/HeuristicLab.Encodings.BinaryVectorEncoding/3.3
- Property svn:ignore
-
old new 5 5 *.vs10x 6 6 Plugin.cs 7 *.DotSettings
-
- Property svn:ignore
-
branches/PerformanceComparison/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj
r14660 r14776 99 99 </PropertyGroup> 100 100 <ItemGroup> 101 <Reference Include="HeuristicLab.Collections-3.3"> 102 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath> 103 <Private>False</Private> 104 </Reference> 105 <Reference Include="HeuristicLab.Common-3.3"> 106 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath> 107 <Private>False</Private> 108 </Reference> 109 <Reference Include="HeuristicLab.Core-3.3"> 110 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath> 111 <Private>False</Private> 112 </Reference> 113 <Reference Include="HeuristicLab.Data-3.3"> 114 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath> 115 <Private>False</Private> 116 </Reference> 117 <Reference Include="HeuristicLab.Operators-3.3"> 118 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath> 119 <Private>False</Private> 120 </Reference> 121 <Reference Include="HeuristicLab.Optimization.Operators-3.3"> 122 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath> 123 <Private>False</Private> 124 </Reference> 125 <Reference Include="HeuristicLab.Parameters-3.3"> 126 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath> 127 <Private>False</Private> 128 </Reference> 129 <Reference Include="HeuristicLab.Persistence-3.3"> 130 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath> 131 <Private>False</Private> 132 </Reference> 133 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 134 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 135 <Private>False</Private> 136 </Reference> 101 137 <Reference Include="System" /> 102 138 <Reference Include="System.Core"> … … 153 189 <Compile Include="Properties\AssemblyInfo.cs" /> 154 190 <Compile Include="ShakingOperators\BinaryVectorShakingOperator.cs" /> 155 </ItemGroup> 156 <ItemGroup> 157 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 158 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> 159 <Name>HeuristicLab.Collections-3.3</Name> 160 <Private>False</Private> 161 </ProjectReference> 162 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> 163 <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project> 164 <Name>HeuristicLab.Common-3.3</Name> 165 <Private>False</Private> 166 </ProjectReference> 167 <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj"> 168 <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project> 169 <Name>HeuristicLab.Core-3.3</Name> 170 <Private>False</Private> 171 </ProjectReference> 172 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> 173 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> 174 <Name>HeuristicLab.Data-3.3</Name> 175 <Private>False</Private> 176 </ProjectReference> 177 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> 178 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 179 <Name>HeuristicLab.Operators-3.3</Name> 180 <Private>False</Private> 181 </ProjectReference> 182 <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj"> 183 <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project> 184 <Name>HeuristicLab.Optimization.Operators-3.3</Name> 185 <Private>False</Private> 186 </ProjectReference> 191 <Compile Include="SolutionModel\Univariate\UnivariateModelTrainer.cs" /> 192 <Compile Include="SolutionModel\Univariate\UnivariateModel.cs" /> 193 <Compile Include="SolutionModel\SolutionSamplingOperator.cs" /> 194 <Compile Include="SolutionModel\Univariate\UnivariateModelTrainingOperator.cs" /> 195 </ItemGroup> 196 <ItemGroup> 187 197 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 188 198 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project> 189 199 <Name>HeuristicLab.Optimization-3.3</Name> 190 <Private>False</Private>191 </ProjectReference>192 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">193 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>194 <Name>HeuristicLab.Parameters-3.3</Name>195 <Private>False</Private>196 </ProjectReference>197 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">198 <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>199 <Name>HeuristicLab.Persistence-3.3</Name>200 <Private>False</Private>201 </ProjectReference>202 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">203 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>204 <Name>HeuristicLab.PluginInfrastructure-3.3</Name>205 200 <Private>False</Private> 206 201 </ProjectReference> -
branches/PerformanceComparison/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/SolutionModel/Univariate/UnivariateModel.cs
r14685 r14776 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 22 using System.Linq; 25 using HeuristicLab.Algorithms.MemPR.Interfaces;26 23 using HeuristicLab.Common; 27 24 using HeuristicLab.Core; 28 25 using HeuristicLab.Data; 29 using HeuristicLab. Encodings.BinaryVectorEncoding;26 using HeuristicLab.Optimization; 30 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 using HeuristicLab.Random;32 28 33 namespace HeuristicLab. Algorithms.MemPR.Binary.SolutionModel.Univariate{29 namespace HeuristicLab.Encodings.BinaryVectorEncoding.SolutionModel { 34 30 [Item("Univariate solution model (binary)", "")] 35 31 [StorableClass] … … 67 63 return vec; 68 64 } 69 70 public static ISolutionModel<BinaryVector> CreateWithoutBias(IRandom random, IEnumerable<BinaryVector> population) {71 double[] model = null;72 var popSize = 0;73 foreach (var p in population) {74 popSize++;75 if (model == null) model = new double[p.Length];76 for (var x = 0; x < model.Length; x++) {77 if (p[x]) model[x]++;78 }79 }80 if (model == null) throw new ArgumentException("Cannot train model from empty population.");81 // normalize to [0;1]82 var factor = 1.0 / popSize;83 for (var x = 0; x < model.Length; x++) {84 model[x] *= factor;85 }86 return new UnivariateModel(random, model);87 }88 89 public static ISolutionModel<BinaryVector> CreateWithRankBias(IRandom random, bool maximization, IEnumerable<BinaryVector> population, IEnumerable<double> qualities) {90 var popSize = 0;91 92 double[] model = null;93 var pop = population.Zip(qualities, (b, q) => new { Solution = b, Fitness = q });94 foreach (var ind in maximization ? pop.OrderBy(x => x.Fitness) : pop.OrderByDescending(x => x.Fitness)) {95 // from worst to best, worst solution has 1 vote, best solution N votes96 popSize++;97 if (model == null) model = new double[ind.Solution.Length];98 for (var x = 0; x < model.Length; x++) {99 if (ind.Solution[x]) model[x] += popSize;100 }101 }102 if (model == null) throw new ArgumentException("Cannot train model from empty population.");103 // normalize to [0;1]104 var factor = 2.0 / (popSize + 1);105 for (var i = 0; i < model.Length; i++) {106 model[i] *= factor / popSize;107 }108 return new UnivariateModel(random, model);109 }110 111 public static ISolutionModel<BinaryVector> CreateWithFitnessBias(IRandom random, bool maximization, IEnumerable<BinaryVector> population, IEnumerable<double> qualities) {112 var proportions = Util.Auxiliary.PrepareProportional(qualities, true, !maximization);113 var factor = 1.0 / proportions.Sum();114 double[] model = null;115 foreach (var ind in population.Zip(proportions, (p, q) => new { Solution = p, Proportion = q })) {116 if (model == null) model = new double[ind.Solution.Length];117 for (var x = 0; x < model.Length; x++) {118 if (ind.Solution[x]) model[x] += ind.Proportion * factor;119 }120 }121 if (model == null) throw new ArgumentException("Cannot train model from empty population.");122 return new UnivariateModel(random, model);123 }124 65 } 125 66 } -
branches/PerformanceComparison/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/SolutionModel/Univariate/UnivariateModelTrainer.cs
r14685 r14776 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Algorithms.MemPR.Interfaces;24 using System.Linq; 25 25 using HeuristicLab.Core; 26 using HeuristicLab.Encodings.BinaryVectorEncoding;27 26 28 namespace HeuristicLab.Algorithms.MemPR.Binary.SolutionModel.Univariate { 29 public enum ModelBiasOptions { Rank, Fitness } 27 namespace HeuristicLab.Encodings.BinaryVectorEncoding.SolutionModel { 28 public static class UnivariateModelTrainer { 29 /// <summary> 30 /// Creates a univariate sampling model out of a ranked population. 31 /// The first solution in <paramref name="rankedPopulation"/> is the 32 /// highest influential one, the last solution has the least influence. 33 /// </summary> 34 /// <param name="random">The model is stochastic and will use this RNG for sampling.</param> 35 /// <param name="maximization">Whether higher or lower qualities are better</param> 36 /// <param name="population">The population that is ranked from highest influential to least influential, e.g. best to worst.</param> 37 /// <param name="qualities">The solution quality of the respective solution.</param> 38 /// <returns>The sampling model which is created with the given population.</returns> 39 public static UnivariateModel TrainWithRankBias(IRandom random, bool maximization, IEnumerable<BinaryVector> population, IEnumerable<double> qualities) { 40 var popSize = 0; 41 double[] model = null; 42 var pop = population.Zip(qualities, (b, q) => new { Solution = b, Fitness = q }); 43 foreach (var ind in maximization ? pop.OrderBy(x => x.Fitness) : pop.OrderByDescending(x => x.Fitness)) { 44 // from worst to best, worst solution has 1 vote, best solution N votes 45 popSize++; 46 if (model == null) model = new double[ind.Solution.Length]; 47 for (var x = 0; x < model.Length; x++) { 48 if (ind.Solution[x]) model[x] += popSize; 49 } 50 } 51 if (model == null) throw new ArgumentException("Cannot train model from empty population."); 52 // normalize to [0;1] 53 var factor = 2.0 / (popSize + 1); 54 for (var i = 0; i < model.Length; i++) { 55 model[i] *= factor / popSize; 56 } 57 return new UnivariateModel(random, model); 58 } 30 59 31 public static class Trainer { 32 public static ISolutionModel<BinaryVector> TrainBiased(ModelBiasOptions modelBias, IRandom random, bool maximization, IEnumerable<BinaryVector> population, IEnumerable<double> qualities) { 33 switch (modelBias) { 34 case ModelBiasOptions.Rank: 35 return UnivariateModel.CreateWithRankBias(random, maximization, population, qualities); 36 case ModelBiasOptions.Fitness: 37 return UnivariateModel.CreateWithFitnessBias(random, maximization, population, qualities); 38 default: 39 throw new InvalidOperationException(string.Format("Unknown bias option {0}", modelBias)); 60 /// <summary> 61 /// Creates a univariate sampling model out of solutions and their given fitness. 62 /// The best solution's influence is proportional to its fitness, while the worst 63 /// solution does not have an influence at all (except if the fitness of worst and 64 /// best are equal). 65 /// </summary> 66 /// <param name="random">The model is stochastic and makes use of this RNG instance for sampling.</param> 67 /// <param name="maximization">Whether higher fitness values are better or lower ones.</param> 68 /// <param name="population">The solutions that will be used to create the model.</param> 69 /// <param name="qualities">The solutions' associated qualities.</param> 70 /// <returns>The sampling model which is created with the given population.</returns> 71 public static UnivariateModel TrainWithFitnessBias(IRandom random, bool maximization, IEnumerable<BinaryVector> population, IEnumerable<double> qualities) { 72 var proportions = PrepareProportional(qualities, true, !maximization); 73 var factor = 1.0 / proportions.Sum(); 74 double[] model = null; 75 foreach (var ind in population.Zip(proportions, (p, q) => new { Solution = p, Proportion = q })) { 76 if (model == null) model = new double[ind.Solution.Length]; 77 for (var x = 0; x < model.Length; x++) { 78 if (ind.Solution[x]) model[x] += ind.Proportion * factor; 79 } 80 } 81 if (model == null) throw new ArgumentException("Cannot train model from empty population."); 82 return new UnivariateModel(random, model); 83 } 84 85 /// <summary> 86 /// Creates a univariate sampling model out of solutions. Each of the solutions 87 /// has the same influence on the model. 88 /// </summary> 89 /// <param name="random">The model is stochastic and will make use of this RNG instance.</param> 90 /// <param name="population">The solutions that are used to create the model.</param> 91 /// <returns>The model created from the population.</returns> 92 public static UnivariateModel TrainUnbiased(IRandom random, IEnumerable<BinaryVector> population) { 93 double[] model = null; 94 var popSize = 0; 95 foreach (var p in population) { 96 popSize++; 97 if (model == null) model = new double[p.Length]; 98 for (var x = 0; x < model.Length; x++) { 99 if (p[x]) model[x]++; 100 } 101 } 102 if (model == null) throw new ArgumentException("Cannot train model from empty population."); 103 // normalize to [0;1] 104 var factor = 1.0 / popSize; 105 for (var x = 0; x < model.Length; x++) { 106 model[x] *= factor; 107 } 108 return new UnivariateModel(random, model); 109 } 110 111 // TODO: make PrepareProportional public in EnumerableExtensions 112 private static double[] PrepareProportional(IEnumerable<double> weights, bool windowing, bool inverseProportional) { 113 double maxValue = double.MinValue, minValue = double.MaxValue; 114 double[] valueArray = weights.ToArray(); 115 116 for (int i = 0; i < valueArray.Length; i++) { 117 if (valueArray[i] > maxValue) maxValue = valueArray[i]; 118 if (valueArray[i] < minValue) minValue = valueArray[i]; 119 } 120 if (minValue == maxValue) { // all values are equal 121 for (int i = 0; i < valueArray.Length; i++) { 122 valueArray[i] = 1.0; 123 } 124 } else { 125 if (windowing) { 126 if (inverseProportional) InverseProportionalScale(valueArray, maxValue); 127 else ProportionalScale(valueArray, minValue); 128 } else { 129 if (minValue < 0.0) throw new InvalidOperationException("Proportional selection without windowing does not work with values < 0."); 130 if (inverseProportional) InverseProportionalScale(valueArray, 2 * maxValue); 131 } 132 } 133 return valueArray; 134 } 135 private static void ProportionalScale(double[] values, double minValue) { 136 for (int i = 0; i < values.Length; i++) { 137 values[i] = values[i] - minValue; 40 138 } 41 139 } 42 43 public static ISolutionModel<BinaryVector> TrainUnbiased(IRandom random, IEnumerable<BinaryVector> population) { 44 return UnivariateModel.CreateWithoutBias(random, population); 140 private static void InverseProportionalScale(double[] values, double maxValue) { 141 for (int i = 0; i < values.Length; i++) { 142 values[i] = maxValue - values[i]; 143 } 45 144 } 46 145 } -
branches/PerformanceComparison/HeuristicLab.Encodings.LinearLinkageEncoding/3.4/HeuristicLab.Encodings.LinearLinkageEncoding-3.4.csproj
r14663 r14776 88 88 </PropertyGroup> 89 89 <ItemGroup> 90 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">91 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>92 <Name>HeuristicLab.Collections-3.3</Name>93 <Private>False</Private>94 </ProjectReference>95 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">96 <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>97 <Name>HeuristicLab.Common-3.3</Name>98 <Private>False</Private>99 </ProjectReference>100 <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">101 <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>102 <Name>HeuristicLab.Core-3.3</Name>103 <Private>False</Private>104 </ProjectReference>105 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">106 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>107 <Name>HeuristicLab.Data-3.3</Name>108 <Private>False</Private>109 </ProjectReference>110 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">111 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>112 <Name>HeuristicLab.Operators-3.3</Name>113 <Private>False</Private>114 </ProjectReference>115 <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj">116 <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project>117 <Name>HeuristicLab.Optimization.Operators-3.3</Name>118 <Private>False</Private>119 </ProjectReference>120 90 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 121 91 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project> … … 123 93 <Private>False</Private> 124 94 </ProjectReference> 125 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">126 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>127 <Name>HeuristicLab.Parameters-3.3</Name>128 <Private>False</Private>129 </ProjectReference>130 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">131 <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>132 <Name>HeuristicLab.Persistence-3.3</Name>133 <Private>False</Private>134 </ProjectReference>135 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">136 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>137 <Name>HeuristicLab.PluginInfrastructure-3.3</Name>138 <Private>False</Private>139 </ProjectReference>140 <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">141 <Project>{f4539fb6-4708-40c9-be64-0a1390aea197}</Project>142 <Name>HeuristicLab.Random-3.3</Name>143 <Private>False</Private>144 </ProjectReference>145 95 </ItemGroup> 146 96 <ItemGroup> 97 <Reference Include="HeuristicLab.Collections-3.3"> 98 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath> 99 <Private>False</Private> 100 </Reference> 101 <Reference Include="HeuristicLab.Common-3.3"> 102 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath> 103 <Private>False</Private> 104 </Reference> 105 <Reference Include="HeuristicLab.Core-3.3"> 106 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath> 107 <Private>False</Private> 108 </Reference> 109 <Reference Include="HeuristicLab.Data-3.3"> 110 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath> 111 <Private>False</Private> 112 </Reference> 113 <Reference Include="HeuristicLab.Operators-3.3"> 114 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath> 115 <Private>False</Private> 116 </Reference> 117 <Reference Include="HeuristicLab.Optimization.Operators-3.3"> 118 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath> 119 <Private>False</Private> 120 </Reference> 121 <Reference Include="HeuristicLab.Parameters-3.3"> 122 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath> 123 <Private>False</Private> 124 </Reference> 125 <Reference Include="HeuristicLab.Persistence-3.3"> 126 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath> 127 <Private>False</Private> 128 </Reference> 129 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 130 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 131 <Private>False</Private> 132 </Reference> 133 <Reference Include="HeuristicLab.Random-3.3"> 134 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath> 135 <Private>False</Private> 136 </Reference> 147 137 <Reference Include="System" /> 148 138 <Reference Include="System.Core" /> -
branches/PerformanceComparison/HeuristicLab.Optimization.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Optimization.Views merged: 14775
- Property svn:mergeinfo changed
-
branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionRLDView.cs
r14665 r14776 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 42 42 private List<Series> invisibleTargetSeries; 43 43 44 private const string All Runs = "All Runs";44 private const string AllInstances = "All Instances"; 45 45 46 46 private static readonly Color[] colors = new[] { … … 223 223 var groupings = Content.ParameterNames.OrderBy(x => x).ToArray(); 224 224 groupComboBox.Items.Clear(); 225 groupComboBox.Items.Add(All Runs);225 groupComboBox.Items.Add(AllInstances); 226 226 groupComboBox.Items.AddRange(groupings); 227 227 if (selectedGroupItem != null && groupComboBox.Items.Contains(selectedGroupItem)) { … … 241 241 242 242 var selectedProblemItem = (ProblemInstance)problemComboBox.SelectedItem; 243 problemComboBox.DataSource = null; 244 problemComboBox.Items.Clear(); 243 245 problems.Clear(); 244 246 problems.Add(ProblemInstance.MatchAll); 247 problemComboBox.DataSource = new BindingSource() { DataSource = problems }; 248 problemComboBox.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged; 245 249 if (problems[0].Equals(selectedProblemItem)) problemComboBox.SelectedItem = problems[0]; 246 250 foreach (var p in problemDict.ToList()) { … … 282 286 } 283 287 284 private Dictionary<string, Dictionary<ProblemInstance, List<IRun>>> GroupRuns() { 285 var groupedRuns = new Dictionary<string, Dictionary<ProblemInstance, List<IRun>>>(); 286 288 private IEnumerable<AlgorithmInstance> GroupRuns() { 287 289 var table = (string)dataTableComboBox.SelectedItem; 288 if (string.IsNullOrEmpty(table)) return groupedRuns;290 if (string.IsNullOrEmpty(table)) yield break; 289 291 290 292 var selectedGroup = (string)groupComboBox.SelectedItem; 291 if (string.IsNullOrEmpty(selectedGroup)) return groupedRuns;293 if (string.IsNullOrEmpty(selectedGroup)) yield break; 292 294 293 295 var selectedProblem = (ProblemInstance)problemComboBox.SelectedItem; 294 if (selectedProblem == null) return groupedRuns;296 if (selectedProblem == null) yield break; 295 297 296 298 foreach (var x in (from r in Content 297 where (selectedGroup == All Runs || r.Parameters.ContainsKey(selectedGroup))299 where (selectedGroup == AllInstances || r.Parameters.ContainsKey(selectedGroup)) 298 300 && selectedProblem.Match(r) 299 301 && r.Results.ContainsKey(table) 300 302 && r.Visible 301 let key = selectedGroup == All Runs ? AllRuns : r.Parameters[selectedGroup].ToString()303 let key = selectedGroup == AllInstances ? AllInstances : r.Parameters[selectedGroup].ToString() 302 304 group r by key into g 303 select Tuple.Create(g.Key, g.ToList()))) { 304 var pDict = problems.ToDictionary(r => r, _ => new List<IRun>()); 305 foreach (var y in x.Item2) { 306 var pd = new ProblemInstance(y); 307 List<IRun> l; 308 if (pDict.TryGetValue(pd, out l)) l.Add(y); 309 } 310 groupedRuns[x.Item1] = pDict.Where(a => a.Value.Count > 0).ToDictionary(a => a.Key, a => a.Value); 311 } 312 313 return groupedRuns; 305 select new AlgorithmInstance(g.Key, g, problems))) { 306 yield return x; 307 } 314 308 } 315 309 … … 326 320 if (targets == null) GenerateDefaultTargets(); 327 321 328 var groupedRuns = GroupRuns();329 if ( groupedRuns.Count == 0) return;322 var algInstances = GroupRuns().ToList(); 323 if (algInstances.Count == 0) return; 330 324 331 325 var xAxisTitles = new HashSet<string>(); … … 337 331 // how many targets have been left open at the point when the run ended 338 332 var misses = new Dictionary<string, SortedList<double, int>>(); 333 var totalRuns = new Dictionary<string, int>(); 339 334 340 335 var aggregate = aggregateTargetsCheckBox.Checked; 341 336 double minEff = double.MaxValue, maxEff = double.MinValue; 342 var noRuns = 0;343 foreach (var group in groupedRuns) {337 foreach (var alg in algInstances) { 338 var noRuns = 0; 344 339 SortedList<double, int> epdfHits = null, epdfMisses = null; 345 340 if (aggregate) { 346 hits[ group.Key] = epdfHits = new SortedList<double, int>();347 misses[ group.Key] = epdfMisses = new SortedList<double, int>();348 } 349 foreach (var problem in group.Value) {350 var max = problem. Key.IsMaximization();351 var absTargets = GetAbsoluteTargets(problem .Key).ToArray();352 foreach (var run in problem.Value) {341 hits[alg.Name] = epdfHits = new SortedList<double, int>(); 342 misses[alg.Name] = epdfMisses = new SortedList<double, int>(); 343 } 344 foreach (var problem in alg.GetProblemInstances()) { 345 var max = problem.IsMaximization(); 346 var absTargets = GetAbsoluteTargets(problem).ToArray(); 347 foreach (var run in alg.GetRuns(problem)) { 353 348 noRuns++; 354 349 var resultsTable = (IndexedDataTable<double>)run.Results[table]; … … 361 356 var e = efforts[idx]; 362 357 if (!aggregate) { 363 var key = group.Key+ "@" + (targetsAreRelative364 ? (targets[idx] * 100).ToString(CultureInfo.CurrentCulture.NumberFormat) + "%"365 : targets[idx].ToString(CultureInfo.CurrentCulture.NumberFormat));358 var key = alg.Name + "@" + (targetsAreRelative 359 ? (targets[idx] * 100).ToString(CultureInfo.CurrentCulture.NumberFormat) + "%" 360 : targets[idx].ToString(CultureInfo.CurrentCulture.NumberFormat)); 366 361 if (!hits.TryGetValue(key, out epdfHits)) 367 362 hits[key] = epdfHits = new SortedList<double, int>(); 368 363 if (!misses.TryGetValue(key, out epdfMisses)) 369 364 misses[key] = epdfMisses = new SortedList<double, int>(); 370 } 365 totalRuns[key] = noRuns; 366 }; 371 367 var list = e.Item1 ? epdfHits : epdfMisses; 372 368 int v; … … 377 373 } 378 374 } 375 if (aggregate) totalRuns[alg.Name] = noRuns; 379 376 } 380 377 381 378 UpdateTargetChartAxisXBounds(minEff, maxEff); 382 379 383 DrawTargetsEcdf(hits, misses, noRuns);380 DrawTargetsEcdf(hits, misses, totalRuns); 384 381 385 382 if (targets.Length == 1) { … … 392 389 targetChart.ChartAreas[0].CursorY.Interval = 0.05; 393 390 394 UpdateErtTables( groupedRuns);395 } 396 397 private void DrawTargetsEcdf(Dictionary<string, SortedList<double, int>> hits, Dictionary<string, SortedList<double, int>> misses, intnoRuns) {391 UpdateErtTables(algInstances); 392 } 393 394 private void DrawTargetsEcdf(Dictionary<string, SortedList<double, int>> hits, Dictionary<string, SortedList<double, int>> misses, Dictionary<string, int> noRuns) { 398 395 var colorCount = 0; 399 396 var lineStyleCount = 0; … … 418 415 var iter = misses[list.Key].GetEnumerator(); 419 416 var moreMisses = iter.MoveNext(); 420 var totalTargets = noRuns ;417 var totalTargets = noRuns[list.Key]; 421 418 if (aggregateTargetsCheckBox.Checked) totalTargets *= targets.Length; 422 419 var movingTargets = totalTargets; … … 594 591 } 595 592 596 private void UpdateErtTables( Dictionary<string, Dictionary<ProblemInstance, List<IRun>>> groupedRuns) {593 private void UpdateErtTables(List<AlgorithmInstance> algorithmInstances) { 597 594 ertTableView.Content = null; 598 595 var columns = 1 + targets.Length + 1; 599 var matrix = new string[ groupedRuns.Count * groupedRuns.Max(x => x.Value.Count) + groupedRuns.Max(x => x.Value.Count), columns];596 var matrix = new string[algorithmInstances.Count * algorithmInstances.Max(x => x.GetNumberOfProblemInstances()) + algorithmInstances.Max(x => x.GetNumberOfProblemInstances()), columns]; 600 597 var rowCount = 0; 601 598 … … 603 600 if (string.IsNullOrEmpty(tableName)) return; 604 601 605 var problems = groupedRuns.SelectMany(x => x.Value.Keys).Distinct().ToList();602 var problems = algorithmInstances.SelectMany(x => x.GetProblemInstances()).Distinct().ToList(); 606 603 607 604 foreach (var problem in problems) { … … 615 612 rowCount++; 616 613 617 foreach (var group in groupedRuns) { 618 matrix[rowCount, 0] = group.Key; 619 if (!group.Value.ContainsKey(problem)) { 614 foreach (var alg in algorithmInstances) { 615 matrix[rowCount, 0] = alg.Name; 616 var runs = alg.GetRuns(problem).ToList(); 617 if (runs.Count == 0) { 620 618 matrix[rowCount, columns - 1] = "N/A"; 621 619 rowCount++; 622 620 continue; 623 621 } 624 var runs = group.Value[problem];625 622 var result = default(ErtCalculationResult); 626 623 for (var i = 0; i < absTargets.Length; i++) { … … 648 645 if (budgets == null) GenerateDefaultBudgets(table); 649 646 650 var groupedRuns = GroupRuns();651 if ( groupedRuns.Count == 0) return;647 var algInstances = GroupRuns().ToList(); 648 if (algInstances.Count == 0) return; 652 649 653 650 var colorCount = 0; 654 651 var lineStyleCount = 0; 655 652 656 foreach (var group in groupedRuns) {653 foreach (var alg in algInstances) { 657 654 var hits = new Dictionary<string, SortedList<double, double>>(); 658 655 659 foreach (var problem in group.Value) {660 foreach (var run in problem.Value) {656 foreach (var problem in alg.GetProblemInstances()) { 657 foreach (var run in alg.GetRuns(problem)) { 661 658 var resultsTable = (IndexedDataTable<double>)run.Results[table]; 662 659 663 660 if (aggregateBudgetsCheckBox.Checked) { 664 CalculateHitsForAllBudgets(hits, resultsTable.Rows.First(), group.Value.Count, problem.Key, group.Key, problem.Value.Count);661 CalculateHitsForAllBudgets(hits, resultsTable.Rows.First(), alg.GetNumberOfProblemInstances(), problem, alg.Name, alg.GetNumberOfRuns(problem)); 665 662 } else { 666 CalculateHitsForEachBudget(hits, resultsTable.Rows.First(), group.Value.Count, problem.Key, group.Key, problem.Value.Count);663 CalculateHitsForEachBudget(hits, resultsTable.Rows.First(), alg.GetNumberOfProblemInstances(), problem, alg.Name, alg.GetNumberOfRuns(problem)); 667 664 } 668 665 } … … 697 694 698 695 private void GenerateDefaultBudgets(string table) { 699 var runs = GroupRuns().SelectMany(x => x.Value.Values).SelectMany(x => x).ToList();696 var runs = Content; 700 697 var min = runs.Select(x => ((IndexedDataTable<double>)x.Results[table]).Rows.First().Values.Select(y => y.Item1).Min()).Min(); 701 698 var max = runs.Select(x => ((IndexedDataTable<double>)x.Results[table]).Rows.First().Values.Select(y => y.Item1).Max()).Max(); … … 1172 1169 } 1173 1170 1171 private class AlgorithmInstance : INotifyPropertyChanged { 1172 private string name; 1173 public string Name { 1174 get { return name; } 1175 set { 1176 if (name == value) return; 1177 name = value; 1178 OnPropertyChanged("Name"); 1179 } 1180 } 1181 1182 private Dictionary<ProblemInstance, List<IRun>> performanceData; 1183 1184 public int GetNumberOfProblemInstances() { 1185 return performanceData.Count; 1186 } 1187 1188 public IEnumerable<ProblemInstance> GetProblemInstances() { 1189 return performanceData.Keys; 1190 } 1191 1192 public int GetNumberOfRuns(ProblemInstance p) { 1193 if (p == ProblemInstance.MatchAll) return performanceData.Select(x => x.Value.Count).Sum(); 1194 List<IRun> runs; 1195 if (performanceData.TryGetValue(p, out runs)) 1196 return runs.Count; 1197 1198 return 0; 1199 } 1200 1201 public IEnumerable<IRun> GetRuns(ProblemInstance p) { 1202 if (p == ProblemInstance.MatchAll) return performanceData.SelectMany(x => x.Value); 1203 List<IRun> runs; 1204 if (performanceData.TryGetValue(p, out runs)) 1205 return runs; 1206 1207 return Enumerable.Empty<IRun>(); 1208 } 1209 1210 public AlgorithmInstance(string name, IEnumerable<IRun> runs, IEnumerable<ProblemInstance> problems) { 1211 this.name = name; 1212 1213 var pDict = problems.ToDictionary(r => r, _ => new List<IRun>()); 1214 foreach (var y in runs) { 1215 var pd = new ProblemInstance(y); 1216 List<IRun> l; 1217 if (pDict.TryGetValue(pd, out l)) l.Add(y); 1218 } 1219 performanceData = pDict.Where(x => x.Value.Count > 0).ToDictionary(x => x.Key, x => x.Value); 1220 } 1221 1222 public override bool Equals(object obj) { 1223 var other = obj as AlgorithmInstance; 1224 if (other == null) return false; 1225 return name == other.name; 1226 } 1227 1228 public override int GetHashCode() { 1229 return name.GetHashCode(); 1230 } 1231 1232 public event PropertyChangedEventHandler PropertyChanged; 1233 protected virtual void OnPropertyChanged(string propertyName = null) { 1234 var handler = PropertyChanged; 1235 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 1236 } 1237 } 1238 1174 1239 private class ProblemInstance : INotifyPropertyChanged { 1175 1240 private readonly bool matchAll; -
branches/PerformanceComparison/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r13706 r14776 202 202 <Compile Include="Interfaces\IMultiObjectiveOperator.cs" /> 203 203 <Compile Include="Interfaces\IPreexistingSolutionCreator.cs" /> 204 <Compile Include="Interfaces\ISolutionModel.cs" /> 204 205 <Compile Include="Results\IResultParameter.cs" /> 205 206 <Compile Include="Interfaces\ISingleObjectiveOperator.cs" /> -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/KnowledgeCenter.cs
r14667 r14776 202 202 key2Idx.Add(kvp.Key, kvp.Index); 203 203 204 Func<double[], double[], double> euclid = (a, b) => Math.Sqrt(a.Zip(b, (x, y) => (x - y)).Sum(x => x * x)); 205 Func<DoubleArray, DoubleArray, double> euclidDArray = (a, b) => Math.Sqrt(a.Zip(b, (x, y) => (x - y)).Sum(x => x * x)); 204 206 #region MDS 205 Func<double[], double[], double> euclid = (a, b) => Math.Sqrt(a.Zip(b, (x, y) => (x - y)).Sum(x => x * x));206 207 var num = instances.Count; 207 208 var matrix = new DoubleMatrix(num, num); … … 243 244 tsneFeatures[key2Idx.GetByFirst(instance.Key)] = new DoubleArray(instance.Value); 244 245 } 245 var tsneCoords = TSNE<DoubleArray>.Run(tsneFeatures, 2, Math.Min((instances.Count - 1) / 3, 50), 0.1, (a, b) => Math.Sqrt(a.Zip(b, (c, d) => (c - d) * (c - d)).Sum()), new FastRandom(42)); 246 var tsne = new TSNE<DoubleArray>(new EuclidianDistance(), new FastRandom(42), stopLyingIter: 0, momSwitchIter: 0, momentum: 0, finalMomentum: 0, eta: 10); 247 var tsneCoords = tsne.Run(tsneFeatures, 2, Math.Min((instances.Count - 1) / 4, 50), 0); 248 //var tsneCoords = TSNE<DoubleArray>.Run(tsneFeatures, 2, Math.Min((instances.Count - 1) / 4, 50), 0, euclidDArray, new FastRandom(42)); 246 249 #endregion 247 250 -
branches/PerformanceComparison/PerformanceComparison.sln
r14691 r14776 27 27 EndProject 28 28 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances.QAPLIB-3.3", "HeuristicLab.Problems.Instances.QAPLIB\3.3\HeuristicLab.Problems.Instances.QAPLIB-3.3.csproj", "{73F29D43-5714-4069-8FAB-0D18FEB5F175}" 29 EndProject 30 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Encodings.BinaryVectorEncoding-3.3", "HeuristicLab.Encodings.BinaryVectorEncoding\3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj", "{66D249C3-A01D-42A8-82A2-919BC8EC3D83}" 31 EndProject 32 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Encodings.LinearLinkageEncoding-3.4", "HeuristicLab.Encodings.LinearLinkageEncoding\3.4\HeuristicLab.Encodings.LinearLinkageEncoding-3.4.csproj", "{BE698769-975A-429E-828C-72BB2B6182C8}" 29 33 EndProject 30 34 Global … … 182 186 {73F29D43-5714-4069-8FAB-0D18FEB5F175}.Release|x86.ActiveCfg = Release|x86 183 187 {73F29D43-5714-4069-8FAB-0D18FEB5F175}.Release|x86.Build.0 = Release|x86 188 {66D249C3-A01D-42A8-82A2-919BC8EC3D83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 189 {66D249C3-A01D-42A8-82A2-919BC8EC3D83}.Debug|Any CPU.Build.0 = Debug|Any CPU 190 {66D249C3-A01D-42A8-82A2-919BC8EC3D83}.Debug|x64.ActiveCfg = Debug|x64 191 {66D249C3-A01D-42A8-82A2-919BC8EC3D83}.Debug|x64.Build.0 = Debug|x64 192 {66D249C3-A01D-42A8-82A2-919BC8EC3D83}.Debug|x86.ActiveCfg = Debug|x86 193 {66D249C3-A01D-42A8-82A2-919BC8EC3D83}.Debug|x86.Build.0 = Debug|x86 194 {66D249C3-A01D-42A8-82A2-919BC8EC3D83}.Release|Any CPU.ActiveCfg = Release|Any CPU 195 {66D249C3-A01D-42A8-82A2-919BC8EC3D83}.Release|Any CPU.Build.0 = Release|Any CPU 196 {66D249C3-A01D-42A8-82A2-919BC8EC3D83}.Release|x64.ActiveCfg = Release|x64 197 {66D249C3-A01D-42A8-82A2-919BC8EC3D83}.Release|x64.Build.0 = Release|x64 198 {66D249C3-A01D-42A8-82A2-919BC8EC3D83}.Release|x86.ActiveCfg = Release|x86 199 {66D249C3-A01D-42A8-82A2-919BC8EC3D83}.Release|x86.Build.0 = Release|x86 200 {BE698769-975A-429E-828C-72BB2B6182C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 201 {BE698769-975A-429E-828C-72BB2B6182C8}.Debug|Any CPU.Build.0 = Debug|Any CPU 202 {BE698769-975A-429E-828C-72BB2B6182C8}.Debug|x64.ActiveCfg = Debug|x64 203 {BE698769-975A-429E-828C-72BB2B6182C8}.Debug|x64.Build.0 = Debug|x64 204 {BE698769-975A-429E-828C-72BB2B6182C8}.Debug|x86.ActiveCfg = Debug|x86 205 {BE698769-975A-429E-828C-72BB2B6182C8}.Debug|x86.Build.0 = Debug|x86 206 {BE698769-975A-429E-828C-72BB2B6182C8}.Release|Any CPU.ActiveCfg = Release|Any CPU 207 {BE698769-975A-429E-828C-72BB2B6182C8}.Release|Any CPU.Build.0 = Release|Any CPU 208 {BE698769-975A-429E-828C-72BB2B6182C8}.Release|x64.ActiveCfg = Release|x64 209 {BE698769-975A-429E-828C-72BB2B6182C8}.Release|x64.Build.0 = Release|x64 210 {BE698769-975A-429E-828C-72BB2B6182C8}.Release|x86.ActiveCfg = Release|x86 211 {BE698769-975A-429E-828C-72BB2B6182C8}.Release|x86.Build.0 = Release|x86 184 212 EndGlobalSection 185 213 GlobalSection(SolutionProperties) = preSolution -
branches/PerformanceComparison/ProblemInstanceIdentifier/InstanceExplorer.cs
r14696 r14776 74 74 } 75 75 76 public class AdaptiveWalkExplorer : InstanceExplorer { 77 public int Iterations { get; set; } 78 79 public override string Name { get { return "Adaptive-Walk Explorer"; } } 80 public override int Effort { get { return Iterations; } } 81 82 public AdaptiveWalkExplorer() { 83 84 } 85 86 public override InstanceDescriptor Explore(QuadraticAssignmentProblem problem, int? seed = null) { 87 var walk = new AdaptiveWalk() { 88 SeedParameter = { Value = { Value = seed ?? 0 } }, 89 SetSeedRandomlyParameter = { Value = { Value = seed.HasValue } }, 90 MaximumIterationsParameter = { Value = { Value = Iterations } }, 91 RepetitionsParameter = { Value = { Value = 1 } } 92 }; 93 walk.Problem = problem; 94 walk.Engine = new SequentialEngine(); 95 walk.MutatorParameter.Value = walk.MutatorParameter.ValidValues.First(x => x is Swap2Manipulator); 96 var calculator = new AdaptiveWalkCalculator(walk) { Problem = problem }; 97 var features = calculator.Calculate().ToDictionary(x => x.Name, x => x.Value); 98 99 return new InstanceDescriptor(problem.Name, InstanceDescriptor.GetClass(problem.Name), problem.Weights.Rows, 100 features.Keys.ToArray(), features.Values.Select(x => ((DoubleValue)x).Value).ToArray()); 101 } 102 } 103 76 104 public class MemPRExplorer : InstanceExplorer { 77 105 public int Seconds { get; set; } -
branches/PerformanceComparison/ProblemInstanceIdentifier/Program.cs
r14696 r14776 4 4 using System.Linq; 5 5 using System.Threading.Tasks; 6 using HeuristicLab.Algorithms.MemPR.Permutation;7 6 using HeuristicLab.PluginInfrastructure; 8 7 using HeuristicLab.Problems.Instances;
Note: See TracChangeset
for help on using the changeset viewer.