Changeset 6018 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding
- Timestamp:
- 04/17/11 18:22:28 (14 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurationTree.cs
r5927 r6018 16 16 17 17 [Storable] 18 private DoubleValue averageQualityNormalized;19 public DoubleValue AverageQualityNormalized{20 get { return averageQualityNormalized; }21 set { 22 if ( averageQualityNormalized!= value) {23 averageQualityNormalized= value;18 private DoubleValue quality; 19 public DoubleValue Quality { 20 get { return quality; } 21 set { 22 if (quality != value) { 23 quality = value; 24 24 OnQualityChanged(); 25 25 } … … 28 28 29 29 [Storable] 30 private DoubleArray qualitiesNormalized; 31 public DoubleArray QualitiesNormalized { 32 get { return qualitiesNormalized; } 33 set { 34 if (qualitiesNormalized != value) { 35 qualitiesNormalized = value; 36 } 37 } 38 } 39 30 private DoubleArray normalizedQualityAverages; 31 public DoubleArray NormalizedQualityAverages { 32 get { return normalizedQualityAverages; } 33 set { 34 if (normalizedQualityAverages != value) { 35 normalizedQualityAverages = value; 36 } 37 } 38 } 39 40 [Storable] 41 private DoubleArray normalizedQualityDeviations; 42 public DoubleArray NormalizedQualityDeviations { 43 get { return normalizedQualityDeviations; } 44 set { 45 if (normalizedQualityDeviations != value) { 46 normalizedQualityDeviations = value; 47 } 48 } 49 } 50 51 [Storable] 52 private DoubleArray normalizedEvaluatedSolutions; 53 public DoubleArray NormalizedEvaluatedSolutions { 54 get { return normalizedEvaluatedSolutions; } 55 set { 56 if (normalizedEvaluatedSolutions != value) { 57 normalizedEvaluatedSolutions = value; 58 } 59 } 60 } 61 40 62 [Storable] 41 63 private DoubleArray bestQualities; … … 85 107 86 108 [Storable] 109 private DoubleArray averageEvaluatedSolutions; 110 public DoubleArray AverageEvaluatedSolutions { 111 get { return averageEvaluatedSolutions; } 112 set { averageEvaluatedSolutions = value; } 113 } 114 115 [Storable] 87 116 private IntValue repetitions; 88 117 public IntValue Repetitions { … … 116 145 } 117 146 } 118 119 //[Storable]120 //protected string name;121 //public string Name {122 // get { return name; }123 // set { name = value; }124 //}125 147 126 148 #region constructors and cloning … … 136 158 algproblemitem.ProblemParameter.Value = problem; 137 159 this.discoverValidValues = false; 138 160 139 161 this.parameterConfigurations.Add(new SingleValuedParameterConfiguration("Algorithm", algproblemitem.AlgorithmParameter)); 140 162 this.parameterConfigurations.Add(new SingleValuedParameterConfiguration("Problem", algproblemitem.ProblemParameter)); … … 145 167 protected ParameterConfigurationTree(ParameterConfigurationTree original, Cloner cloner) 146 168 : base(original, cloner) { 147 this.averageQualityNormalized = cloner.Clone(original.averageQualityNormalized); 148 this.qualitiesNormalized = cloner.Clone(original.qualitiesNormalized); 169 this.quality = cloner.Clone(original.quality); 170 this.normalizedQualityAverages = cloner.Clone(original.normalizedQualityAverages); 171 this.normalizedQualityDeviations = cloner.Clone(original.normalizedQualityDeviations); 172 this.normalizedEvaluatedSolutions = cloner.Clone(original.normalizedEvaluatedSolutions); 149 173 this.bestQualities = cloner.Clone(original.BestQualities); 150 174 this.averageQualities = cloner.Clone(original.averageQualities); … … 153 177 this.qualityVariances = cloner.Clone(original.qualityVariances); 154 178 this.averageExecutionTimes = cloner.Clone(original.averageExecutionTimes); 179 this.averageEvaluatedSolutions = cloner.Clone(original.averageEvaluatedSolutions); 155 180 this.repetitions = cloner.Clone(original.repetitions); 156 181 this.runs = cloner.Clone(original.runs); … … 171 196 public virtual void CollectResultValues(IDictionary<string, IItem> values) { 172 197 values.Add("RunsAverageExecutionTimes", AverageExecutionTimes); 198 values.Add("RunsAverageEvaluatedSolutions", AverageEvaluatedSolutions); 173 199 values.Add("Repetitions", Repetitions); 174 200 values.Add("RunsBestQualities", BestQualities); … … 177 203 values.Add("RunsQualityVariances", QualityVariances); 178 204 values.Add("RunsQualityStandardDeviations", QualityStandardDeviations); 179 values.Add("QualitiesNormalized", QualitiesNormalized);180 values.Add("AverageQualityNormalized", AverageQualityNormalized);205 values.Add("QualitiesNormalized", NormalizedQualityAverages); 206 values.Add("AverageQualityNormalized", Quality); 181 207 values.Add("Runs", Runs); 182 208 } … … 209 235 210 236 algorithm.CollectParameterValues(this.Parameters); 211 //((IProblem)ProblemConfiguration.ActualValue.Value).CollectParameterValues(this.Parameters); 212 //CollectAlgorithmParameterValues((IAlgorithm)AlgorithmConfiguration.ActualValue.Value, parameters); 213 } 214 215 //protected virtual void CollectAlgorithmParameterValues(IAlgorithm algorithm, IDictionary<string, IItem> values) { 216 // var algorithmValues = new Dictionary<string, IItem>(); 217 // algorithm.CollectParameterValues(algorithmValues); 218 // foreach (var value in algorithmValues) { 219 // values.Add("Algorithm." + value.Key, value.Value); 220 // } 221 //} 237 } 222 238 223 239 public Experiment GenerateExperiment(IAlgorithm algorithm, bool createBatchRuns, int repetitions) { … … 294 310 var sb = new StringBuilder(); 295 311 if (!string.IsNullOrEmpty(algorithmInfo)) { 296 sb.Append("Algorithm :");312 sb.Append("Algorithm ("); 297 313 sb.Append(algorithmInfo); 314 sb.Append(")"); 298 315 } 299 316 if (!string.IsNullOrEmpty(problemInfo)) { 300 317 if (sb.Length > 0) 301 318 sb.Append(", "); 302 sb.Append("Problem :");319 sb.Append("Problem( "); 303 320 sb.Append(problemInfo); 321 sb.Append(")"); 304 322 } 305 323 return sb.ToString(); … … 311 329 ProblemConfiguration.CollectOptimizedParameterNames(parameterNames, string.Empty); 312 330 } 313 314 315 331 } 316 332 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs
r6017 r6018 92 92 if (this.valueConfigurations != null) DeregisterValueConfigurationEvents(); 93 93 this.valueConfigurations = value; 94 KeepActualValueConfigurationIndexConsistent(); 94 95 if (this.valueConfigurations != null) RegisterValueConfigurationEvents(); 95 96 } … … 144 145 set { autoPopulateValueConfigurations = value; } 145 146 } 146 147 147 148 148 149 #region Constructors and Cloning … … 258 259 } else { 259 260 IItem val; 260 if (ActualValue.Value != null && ActualValue.Value DataType== t) {261 if (ActualValue.Value != null && ActualValue.Value.GetType() == t) { 261 262 val = (IItem)ActualValue.Value.Clone(); // use existing value for that type (if available) 262 263 } else { … … 363 364 void ValueConfigurations_CheckedItemsChanged(object sender, Collections.CollectionItemsChangedEventArgs<IndexedItem<IValueConfiguration>> e) { 364 365 OnToStringChanged(); 365 } 366 KeepActualValueConfigurationIndexConsistent(); 367 } 368 366 369 void ValueConfigurations_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<IndexedItem<IValueConfiguration>> e) { 367 370 OnToStringChanged(); 371 KeepActualValueConfigurationIndexConsistent(); 368 372 } 369 373 void ValueConfigurations_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<IndexedItem<IValueConfiguration>> e) { 370 374 OnToStringChanged(); 375 KeepActualValueConfigurationIndexConsistent(); 371 376 } 372 377 … … 440 445 } 441 446 442 public string ParameterInfoString {447 public virtual string ParameterInfoString { 443 448 get { 444 449 StringBuilder sb = new StringBuilder(); … … 455 460 } 456 461 457 if (this. ActualValue.Value is IParameterizedItem) {462 if (this.ValueConfigurations[actualValueConfigurationIndex] is ParameterizedValueConfiguration) { 458 463 string subParams = this.ValueConfigurations[actualValueConfigurationIndex].ParameterInfoString; 459 464 if (!string.IsNullOrEmpty(subParams)) { … … 583 588 } 584 589 } 590 591 /// <summary> 592 /// Ensures that the ActualValueConfigurationIndex has a valid value 593 /// Only indices of items which are checked are allowed 594 /// </summary> 595 private void KeepActualValueConfigurationIndexConsistent() { 596 if (this.valueConfigurations != null && this.valueConfigurations.CheckedItems.Count() > 0) { 597 if(this.valueConfigurations.Count <= this.actualValueConfigurationIndex && 598 this.valueConfigurations.CheckedItems.Count(x => x.Index == this.actualValueConfigurationIndex) == 1) { 599 // everything is ok; do nothing 600 } else { 601 // current index is invalid, set new one 602 this.ActualValueConfigurationIndex = this.valueConfigurations.CheckedItems.First().Index; 603 } 604 } else { 605 // no checked valueConfiguration is available; cannot be used 606 this.ActualValueConfigurationIndex = -1; 607 } 608 } 585 609 } 586 610 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/SingleValuedParameterConfiguration.cs
r5927 r6018 24 24 this.discoverValidValues = false; 25 25 this.validValues = new ItemSet<IItem> { valueConfiguration.ActualValue.Value }; 26 this.validTypes = new Type[] { valueConfiguration.ActualValue.ValueDataType};26 this.validTypes = new Type[] { valueConfiguration.ActualValue.ValueDataType }; 27 27 this.IsNullable = false; 28 28 this.itemImage = valueConfiguration.ItemImage; … … 69 69 OnToStringChanged(); 70 70 } 71 72 public override string ParameterInfoString { 73 get { 74 if (this.Optimize) { 75 return string.Format("{0} ({1})", this.Name, this.ValueConfigurations.Single().ParameterInfoString); 76 } else { 77 return string.Empty; 78 } 79 } 80 } 71 81 } 72 82 }
Note: See TracChangeset
for help on using the changeset viewer.