- Timestamp:
- 11/25/14 03:26:00 (10 years ago)
- Location:
- branches/OptimizationNetworks
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks
- Property svn:mergeinfo changed
-
branches/OptimizationNetworks/HeuristicLab.Problems.ParameterOptimization/3.3/BestSolutionAnalyzer.cs
r11019 r11576 95 95 DoubleValue bestKnownQuality = BestKnownQualityParameter.ActualValue; 96 96 97 int ind = -1;98 if (!max) ind = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index;99 else ind = qualities.Select((x, index) => new { index, x.Value }).OrderByDescending(x => x.Value).First().index;97 int indexOfBest = -1; 98 if (!max) indexOfBest = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index; 99 else indexOfBest = qualities.Select((x, index) => new { index, x.Value }).OrderByDescending(x => x.Value).First().index; 100 100 101 var bestQuality = qualities[ind ].Value;102 var bestParameterVector = (RealVector)parameterVectors[ind ].Clone();101 var bestQuality = qualities[indexOfBest].Value; 102 var bestParameterVector = (RealVector)parameterVectors[indexOfBest].Clone(); 103 103 ResultCollection results = ResultsParameter.ActualValue; 104 104 … … 123 123 124 124 //update best known quality 125 if (bestKnownQuality == null || max && bestQuality > bestKnownQuality.Value 125 if (bestKnownQuality == null 126 || max && bestQuality > bestKnownQuality.Value 126 127 || !max && bestQuality < bestKnownQuality.Value) { 127 128 BestKnownQualityParameter.ActualValue = new DoubleValue(bestQuality); -
branches/OptimizationNetworks/HeuristicLab.Problems.ParameterOptimization/3.3/BestSolutionsAnalyzer.cs
r10594 r11576 121 121 var bestSolutions = (ItemSet<DoubleArray>)results[BestSolutionsResultName].Value; 122 122 //clear best solutions if new found quality is better than the existing one 123 if (max && bestQuality > previousBestQuality 124 || !max && bestQuality < previousBestQuality) 123 if (max && bestQuality > previousBestQuality || !max && bestQuality < previousBestQuality) 125 124 bestSolutions.Clear(); 126 125 … … 134 133 } 135 134 } 136 PreviousBestQualityParameter.ActualValue = (DoubleValue)BestQualityParameter.ActualValue.Clone();137 135 136 //update best quality 137 if (max && bestQuality >= BestQualityParameter.ActualValue.Value 138 || !max && bestQuality <= BestQualityParameter.ActualValue.Value) { 139 BestQualityParameter.ActualValue.Value = bestQuality; 140 } 138 141 //update best known quality 139 142 if (bestKnownQuality == null || max && bestQuality > bestKnownQuality.Value … … 141 144 BestKnownQualityParameter.ActualValue = new DoubleValue(bestQuality); 142 145 } 146 PreviousBestQualityParameter.ActualValue = (DoubleValue)BestQualityParameter.ActualValue.Clone(); 143 147 144 148 return base.Apply(); … … 156 160 public int GetHashCode(DoubleArray obj) { 157 161 if (obj == null) return 0; 158 return obj.Aggregate(23, (current, item) => current ^ (int)item);162 return (int)obj.Aggregate(23L, (current, item) => current ^ System.BitConverter.DoubleToInt64Bits(item)); 159 163 } 160 164 } -
branches/OptimizationNetworks/HeuristicLab.Problems.ParameterOptimization/3.3/ParameterOptimizationProblem.cs
r10594 r11576 94 94 : base(evaluator, new UniformRandomRealVectorCreator()) { 95 95 Parameters.Add(new FixedValueParameter<IntValue>(ProblemSizeParameterName, "The dimension of the parameter vector that is to be optimized.", new IntValue(1))); 96 Parameters.Add(new ValueParameter<DoubleMatrix>(BoundsParameterName, "The bounds for each dimension of the parameter vector. If fewer bounds are", new DoubleMatrix(new double[,] { { 0, 100 } }, new string[] { "LowerBound", "UpperBound" })));96 Parameters.Add(new ValueParameter<DoubleMatrix>(BoundsParameterName, "The bounds for each dimension of the parameter vector. If the number of bounds is smaller than the problem size then the bounds are reused in a cyclic manner.", new DoubleMatrix(new double[,] { { 0, 100 } }, new string[] { "LowerBound", "UpperBound" }))); 97 97 Parameters.Add(new ValueParameter<StringArray>(ParameterNamesParameterName, "The element names which are used to calculate the quality of a parameter vector.", new StringArray(new string[] { "Parameter0" }))); 98 98 … … 121 121 protected override void OnEvaluatorChanged() { 122 122 base.OnEvaluatorChanged(); 123 strategyVectorManipulator.GeneralLearningRateParameter.Value = new DoubleValue(1.0 / Math.Sqrt(2 * ProblemSize));124 strategyVectorManipulator.LearningRateParameter.Value = new DoubleValue(1.0 / Math.Sqrt(2 * Math.Sqrt(ProblemSize)));125 123 UpdateParameters(); 126 124 } … … 136 134 Evaluator.ParameterNamesParameter.ActualName = ParameterNamesParameter.Name; 137 135 138 var bestSolutionAnalyzer = Operators.OfType<BestSolutionAnalyzer>().First();139 bestSolutionAnalyzer.ParameterVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;140 bestSolutionAnalyzer.ParameterNamesParameter.ActualName = ParameterNamesParameter.Name;141 136 foreach (var bestSolutionAnalyzer in Operators.OfType<BestSolutionAnalyzer>()) { 137 bestSolutionAnalyzer.ParameterVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName; 138 bestSolutionAnalyzer.ParameterNamesParameter.ActualName = ParameterNamesParameter.Name; 139 } 142 140 Bounds = new DoubleMatrix(ProblemSize, 2); 143 141 Bounds.RowNames = ParameterNames; … … 171 169 if (string.IsNullOrEmpty(ParameterNames[i])) ParameterNames[i] = "Parameter" + i; 172 170 } 171 172 strategyVectorManipulator.GeneralLearningRateParameter.Value = new DoubleValue(1.0 / Math.Sqrt(2 * ProblemSize)); 173 strategyVectorManipulator.LearningRateParameter.Value = new DoubleValue(1.0 / Math.Sqrt(2 * Math.Sqrt(ProblemSize))); 173 174 } 174 175 -
branches/OptimizationNetworks/HeuristicLab.Problems.ParameterOptimization/3.3/Plugin.cs.frame
r10594 r11576 20 20 #endregion 21 21 22 using System;23 22 using HeuristicLab.PluginInfrastructure; 24 using Microsoft.Win32;25 23 26 24 namespace HeuristicLab.Problems.ParameterOptimization { … … 28 26 /// Plugin class for HeuristicLab.Problems.ParameterOptimization. 29 27 /// </summary> 30 [Plugin("HeuristicLab.Problems.ParameterOptimization", "3.3. 8.$WCREV$")]28 [Plugin("HeuristicLab.Problems.ParameterOptimization", "3.3.10.$WCREV$")] 31 29 [PluginFile("HeuristicLab.Problems.ParameterOptimization-3.3.dll", PluginFileType.Assembly)] 32 30 [PluginDependency("HeuristicLab.Collections", "3.3")] -
branches/OptimizationNetworks/HeuristicLab.Problems.ParameterOptimization/3.3/Properties/AssemblyInfo.cs.frame
r10605 r11576 27 27 // associated with an assembly. 28 28 [assembly: AssemblyTitle("HeuristicLab.Problems.ParameterOptimization")] 29 [assembly: AssemblyDescription("HeuristicLab problem sfor parameter optimization.")]29 [assembly: AssemblyDescription("HeuristicLab problem for parameter optimization.")] 30 30 [assembly: AssemblyConfiguration("")] 31 31 [assembly: AssemblyCompany("")] … … 53 53 // by using the '*' as shown below: 54 54 [assembly: AssemblyVersion("3.3.0.0")] 55 [assembly: AssemblyFileVersion("3.3. 9.$WCREV$")]55 [assembly: AssemblyFileVersion("3.3.10.$WCREV$")]
Note: See TracChangeset
for help on using the changeset viewer.