- Timestamp:
- 01/20/11 14:54:02 (14 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs
r5337 r5340 476 476 return list; 477 477 } 478 479 public void CollectOptimizedParameterNames(List<string> parameterNames, string prefix) { 480 foreach (var vc in ValueConfigurations) { 481 if (vc.Optimize) { 482 vc.CollectOptimizedParameterNames(parameterNames, prefix); 483 } 484 } 485 } 478 486 } 479 487 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ValueConfiguration.cs
r5303 r5340 280 280 return list; 281 281 } 282 283 public void CollectOptimizedParameterNames(List<string> parameterNames, string prefix) { 284 foreach (var pc in ParameterConfigurations) { 285 if (pc.Optimize) { 286 parameterNames.Add(prefix + pc.ParameterName); 287 pc.CollectOptimizedParameterNames(parameterNames, prefix + pc.ParameterName + "."); 288 } 289 } 290 } 282 291 } 283 292 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/ParameterConfigurationEvaluator.cs
r5337 r5340 129 129 private RunCollection ExecuteAlgorithm(ParameterConfigurationTree parameterConfiguration, IAlgorithm algorithm, IItemList<IProblem> problems) { 130 130 IAlgorithm algorithmClone = (IAlgorithm)algorithm.Clone(); 131 var parameterNames = new List<string>(); 132 var resultNames = new List<string> { "BestQuality", "Execution Time" }; 133 parameterConfiguration.CollectOptimizedParameterNames(parameterNames, ""); 131 134 132 135 // set parameters … … 154 157 int problemIndex = problems.IndexOf(problem) + 1; 155 158 IRun run = algorithmClone.Runs.Last(); 159 CleanRun(run, resultNames, parameterNames); 156 160 run.Results.Add("Meta.FromCache", new BoolValue(false)); 157 161 run.Results.Add("Meta.Generation", new IntValue(GenerationsParameter.ActualValue != null ? GenerationsParameter.ActualValue.Value : 0)); … … 165 169 } 166 170 171 /// <summary> 172 /// Removes all information from the run which is not needed for lated analysis 173 /// only keep the results which are important and the parameters which were optimized 174 /// </summary> 175 private void CleanRun(IRun run, IEnumerable<string> resultsToKeep, IEnumerable<string> parametersToKeep) { 176 var resultsToRemove = new List<string>(); 177 var parametersToRemove = new List<string>(); 178 foreach (var result in run.Results) { 179 if (!resultsToKeep.Contains(result.Key)) 180 resultsToRemove.Add(result.Key); 181 } 182 foreach (var parameter in run.Parameters) { 183 if (!parametersToKeep.Contains(parameter.Key)) 184 parametersToRemove.Add(parameter.Key); 185 } 186 187 foreach (var result in resultsToRemove) 188 run.Results.Remove(result); 189 foreach (var parameter in parametersToRemove) 190 run.Parameters.Remove(parameter); 191 } 192 167 193 public static double NormalizeQualities(ParameterConfigurationTree parameterConfigurationTree, double[] referenceQualities) { 168 194 double[] qualitiesNormalized = new double[referenceQualities.Length]; -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IOptimizable.cs
r5303 r5340 19 19 void Cross(IRandom random, IOptimizable other, CrossDelegate cross, IIntValueCrossover intValueCrossover, IDoubleValueCrossover doubleValueCrossover); 20 20 string ParameterInfoString { get; } 21 void CollectOptimizedParameterNames(List<string> parameterNames, string prefix); 21 22 22 23 /// <summary> -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs
r5337 r5340 224 224 IAlgorithm instance = (IAlgorithm)Activator.CreateInstance(AlgorithmType.Value); 225 225 this.ProblemType.ValidTypes = ApplicationManager.Manager.GetTypes(instance.ProblemType, true).ToList(); 226 this.ProblemType.Value = this.ProblemType.ValidTypes.First(); 227 ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(CreateAlgorithm(AlgorithmType.Value, ProblemType.Value)); 226 this.ProblemType.Value = this.ProblemType.ValidTypes.Where(t => t != typeof(MetaOptimizationProblem)).FirstOrDefault(); 227 if (ProblemType.Value != null) { 228 ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(CreateAlgorithm(AlgorithmType.Value, ProblemType.Value)); 229 } else { 230 ParameterConfigurationTreeParameter.ActualValue = null; 231 } 228 232 } 229 233
Note: See TracChangeset
for help on using the changeset viewer.