Changeset 5665 for branches/HeuristicLab.MetaOptimization
- Timestamp:
- 03/10/11 19:26:58 (14 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.Test/Program.cs
r5653 r5665 90 90 //Console.WriteLine("Press enter to start"); 91 91 //Console.ReadLine(); 92 //TestConfiguration(algorithmVc, new GeneticAlgorithm());93 94 //Console.WriteLine("Press enter to start");95 //Console.ReadLine();92 TestConfiguration(algorithmVc, new GeneticAlgorithm() { Problem = new SingleObjectiveTestFunctionProblem() }); 93 94 Console.WriteLine("Press enter to start"); 95 Console.ReadLine(); 96 96 TestOptimization(metaLevelAlgorithm); 97 97 … … 131 131 Console.WriteLine("\nValueConfigurations:"); 132 132 var vc1 = SetupGAAlgorithm(typeof(GeneticAlgorithm), new MetaOptimizationProblem()); 133 vc1. ParameterConfigurations.Single(x => x.Name == "Elites").Optimize = true;134 vc1. ParameterConfigurations.Single(x => x.Name == "PopulationSize").Optimize = true;135 vc1. ParameterConfigurations.Single(x => x.Name == "MutationProbability").Optimize = true;136 vc1. ParameterConfigurations.Single(x => x.Name == "Selector").Optimize = true;133 vc1.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "Elites").Optimize = true; 134 vc1.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "PopulationSize").Optimize = true; 135 vc1.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "MutationProbability").Optimize = true; 136 vc1.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "Selector").Optimize = true; 137 137 138 138 var vc2 = (ParameterConfigurationTree)vc1.Clone(); 139 139 Console.WriteLine("Assert(1): {0}", vc1.CalculateSimilarity(vc2)); 140 140 141 ((IntValue)vc2. ParameterConfigurations.Single(x => x.Name == "PopulationSize").ValueConfigurations[0].ActualValue.Value).Value = 75;141 ((IntValue)vc2.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "PopulationSize").ValueConfigurations[0].ActualValue.Value).Value = 75; 142 142 Console.WriteLine("{0}", vc1.CalculateSimilarity(vc2)); 143 143 144 ((PercentValue)vc2. ParameterConfigurations.Single(x => x.Name == "MutationProbability").ValueConfigurations[0].ActualValue.Value).Value = 0.15;144 ((PercentValue)vc2.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "MutationProbability").ValueConfigurations[0].ActualValue.Value).Value = 0.15; 145 145 Console.WriteLine("{0}", vc1.CalculateSimilarity(vc2)); 146 146 147 ((PercentValue)vc2. ParameterConfigurations.Single(x => x.Name == "MutationProbability").ValueConfigurations[0].ActualValue.Value).Value = 0.25;147 ((PercentValue)vc2.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "MutationProbability").ValueConfigurations[0].ActualValue.Value).Value = 0.25; 148 148 Console.WriteLine("{0}", vc1.CalculateSimilarity(vc2)); 149 ((PercentValue)vc2. ParameterConfigurations.Single(x => x.Name == "MutationProbability").ValueConfigurations[0].ActualValue.Value).Value = 0.35;149 ((PercentValue)vc2.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "MutationProbability").ValueConfigurations[0].ActualValue.Value).Value = 0.35; 150 150 Console.WriteLine("{0}", vc1.CalculateSimilarity(vc2)); 151 ((PercentValue)vc2. ParameterConfigurations.Single(x => x.Name == "MutationProbability").ValueConfigurations[0].ActualValue.Value).Value = 0.45;151 ((PercentValue)vc2.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "MutationProbability").ValueConfigurations[0].ActualValue.Value).Value = 0.45; 152 152 Console.WriteLine("{0}", vc1.CalculateSimilarity(vc2)); 153 ((PercentValue)vc2. ParameterConfigurations.Single(x => x.Name == "MutationProbability").ValueConfigurations[0].ActualValue.Value).Value = 0.55;153 ((PercentValue)vc2.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "MutationProbability").ValueConfigurations[0].ActualValue.Value).Value = 0.55; 154 154 Console.WriteLine("{0}", vc1.CalculateSimilarity(vc2)); 155 155 156 vc2. ParameterConfigurations.Single(x => x.Name == "Selector").ActualValueConfigurationIndex = 3;156 vc2.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "Selector").ActualValueConfigurationIndex = 3; 157 157 Console.WriteLine("{0}", vc1.CalculateSimilarity(vc2)); 158 158 … … 491 491 ga.Engine = new SequentialEngine.SequentialEngine(); 492 492 493 ParameterConfigurationTree vc = new ParameterConfigurationTree(ga );493 ParameterConfigurationTree vc = new ParameterConfigurationTree(ga, new SingleObjectiveTestFunctionProblem()); 494 494 495 495 ConfigurePopulationSize(vc, 20, 100, 20); … … 640 640 metaOptimizationProblem.ProblemType.Value = typeof(SingleObjectiveTestFunctionProblem); 641 641 ParameterConfigurationTree algorithmVc = metaOptimizationProblem.ParameterConfigurationTree; 642 ((IntValue)algorithmVc. ParameterConfigurations.Single(x => x.Name == "MaximumGenerations").ActualValue.Value).Value = baseAlgorithmMaxGenerations;642 ((IntValue)algorithmVc.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "MaximumGenerations").ActualValue.Value).Value = baseAlgorithmMaxGenerations; 643 643 644 644 metaOptimizationProblem.Problems.Clear(); … … 656 656 //}); 657 657 658 //ConfigurePopulationSize(algorithmVc, 15, 20, 1);659 //ConfigureMutationRate(algorithmVc, 0.0, 1.0, 0.01);660 ConfigureMutationOperator(algorithmVc);658 ConfigurePopulationSize(algorithmVc, 15, 20, 1); 659 ConfigureMutationRate(algorithmVc, 0.0, 1.0, 0.01); 660 //ConfigureMutationOperator(algorithmVc); 661 661 //ConfigureElites(algorithmVc, 0, 8, 1); 662 662 //ConfigureSelectionOperator(algorithmVc, true); … … 735 735 736 736 private static void ConfigureMutationOperator(ParameterConfigurationTree algorithmVc) { 737 var mutationOperator = algorithmVc. ParameterConfigurations.Where(x => x.Name == "Mutator").SingleOrDefault();737 var mutationOperator = algorithmVc.AlgorithmConfiguration.ParameterConfigurations.Where(x => x.Name == "Mutator").SingleOrDefault(); 738 738 mutationOperator.Optimize = true; 739 739 … … 749 749 750 750 private static void ConfigureSelectionOperator(ParameterConfigurationTree algorithmVc, bool configureTournamenSize) { 751 var selectionOperatorPc = algorithmVc. ParameterConfigurations.Where(x => x.Name == "Selector").SingleOrDefault();751 var selectionOperatorPc = algorithmVc.AlgorithmConfiguration.ParameterConfigurations.Where(x => x.Name == "Selector").SingleOrDefault(); 752 752 selectionOperatorPc.Optimize = true; 753 753 … … 777 777 } 778 778 779 private static void ConfigurePopulationSize(Parameter izedValueConfigurationalgorithmVc, int lower, int upper, int stepsize) {780 var populationSizePc = algorithmVc. ParameterConfigurations.Where(x => x.Name == "PopulationSize").SingleOrDefault();779 private static void ConfigurePopulationSize(ParameterConfigurationTree algorithmVc, int lower, int upper, int stepsize) { 780 var populationSizePc = algorithmVc.AlgorithmConfiguration.ParameterConfigurations.Where(x => x.Name == "PopulationSize").SingleOrDefault(); 781 781 populationSizePc.Optimize = true; 782 782 var populationSizeVc = (RangeValueConfiguration)populationSizePc.ValueConfigurations.First(); … … 787 787 } 788 788 789 private static void ConfigureMutationRate(Parameter izedValueConfigurationalgorithmVc, double lower, double upper, double stepsize) {790 var mutationRatePc = algorithmVc. ParameterConfigurations.Where(x => x.Name == "MutationProbability").SingleOrDefault();789 private static void ConfigureMutationRate(ParameterConfigurationTree algorithmVc, double lower, double upper, double stepsize) { 790 var mutationRatePc = algorithmVc.AlgorithmConfiguration.ParameterConfigurations.Where(x => x.Name == "MutationProbability").SingleOrDefault(); 791 791 mutationRatePc.Optimize = true; 792 792 var mutationRateVc = (RangeValueConfiguration)mutationRatePc.ValueConfigurations.First(); … … 797 797 } 798 798 799 private static void ConfigureElites(Parameter izedValueConfigurationalgorithmVc, int from, int to, int stepSize) {800 var elitesPc = algorithmVc. ParameterConfigurations.Where(x => x.Name == "Elites").SingleOrDefault();799 private static void ConfigureElites(ParameterConfigurationTree algorithmVc, int from, int to, int stepSize) { 800 var elitesPc = algorithmVc.AlgorithmConfiguration.ParameterConfigurations.Where(x => x.Name == "Elites").SingleOrDefault(); 801 801 elitesPc.Optimize = true; 802 802 var elitesVc = (RangeValueConfiguration)elitesPc.ValueConfigurations.First(); -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/OptimizableView.cs
r5653 r5665 1 1 using System; 2 using System.Linq; 2 3 using HeuristicLab.Core.Views; 3 4 using HeuristicLab.Data; … … 44 45 45 46 if (pc != null) { 46 this.viewHost.Content = ((IParameterConfiguration)Content).ValueConfigurations; 47 } else if(vc != null) { 47 if (pc is SingleValuedParameterConfiguration) { 48 this.viewHost.Content = ((ParameterizedValueConfiguration)pc.ValueConfigurations.Single()).ParameterConfigurations; 49 } else { 50 this.viewHost.Content = pc.ValueConfigurations; 51 } 52 } else if (vc != null) { 48 53 var rvc = Content as RangeValueConfiguration; 49 54 if (rvc != null) { -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ValueConfigurationViews/ValueConfigurationCheckedItemCollectionView.cs
r5654 r5665 52 52 return new NullValueConfiguration(); 53 53 } else if(value is IParameterizedItem) { 54 return new ParameterizedValueConfiguration(value, value.GetType() );54 return new ParameterizedValueConfiguration(value, value.GetType(), true); 55 55 } else { 56 56 return new RangeValueConfiguration(value, value.GetType()); -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurationTree.cs
r5653 r5665 2 2 using System.Collections; 3 3 using System.Collections.Generic; 4 using System.Linq; 5 using System.Text; 4 6 using HeuristicLab.Common; 5 7 using HeuristicLab.Core; … … 103 105 } 104 106 105 [Storable] 106 protected string name; 107 public string Name { 108 get { return name; } 109 set { name = value; } 110 } 107 public ParameterizedValueConfiguration AlgorithmConfiguration { 108 get { 109 return this.ParameterConfigurations.ElementAt(0).ValueConfigurations.First() as ParameterizedValueConfiguration; 110 } 111 } 112 113 public ParameterizedValueConfiguration ProblemConfiguration { 114 get { 115 return this.ParameterConfigurations.ElementAt(1).ValueConfigurations.First() as ParameterizedValueConfiguration; 116 } 117 } 118 119 //[Storable] 120 //protected string name; 121 //public string Name { 122 // get { return name; } 123 // set { name = value; } 124 //} 111 125 112 126 #region constructors and cloning 113 public ParameterConfigurationTree(IAlgorithm algorithm) 114 : base(null, algorithm.GetType()) { 115 this.Optimize = true; // root must always be optimized 127 public ParameterConfigurationTree(IAlgorithm algorithm, IProblem problem) 128 : base(null, algorithm.GetType(), false) { 129 this.Optimize = false; 130 this.IsOptimizable = false; 116 131 this.parameters = new Dictionary<string, IItem>(); 117 132 this.Name = algorithm.ItemName; 118 PopulateParameterConfigurations(algorithm); 119 } 120 public ParameterConfigurationTree() { 121 } 133 134 var algproblemitem = new AlgorithmProblemItem(); 135 algproblemitem.AlgorithmParameter.Value = algorithm; 136 algproblemitem.ProblemParameter.Value = problem; 137 this.discoverValidValues = false; 138 139 this.parameterConfigurations.Add(new SingleValuedParameterConfiguration("Algorithm", algproblemitem.AlgorithmParameter)); 140 this.parameterConfigurations.Add(new SingleValuedParameterConfiguration("Problem", algproblemitem.ProblemParameter)); 141 } 142 public ParameterConfigurationTree() { } 122 143 [StorableConstructor] 123 144 protected ParameterConfigurationTree(bool deserializing) : base(deserializing) { } … … 138 159 this.parameters.Add(p.Key, cloner.Clone(p.Value)); 139 160 } 140 this.name = original.name;161 //this.name = original.name; 141 162 } 142 163 public override IDeepCloneable Clone(Cloner cloner) { … … 181 202 public override void Parameterize(IParameterizedItem item) { 182 203 this.parameters.Clear(); 183 base.Parameterize(item); 184 ((IAlgorithm)item).CollectParameterValues(this.Parameters); 204 var algorithm = item as IAlgorithm; 205 var problem = algorithm.Problem; 206 207 AlgorithmConfiguration.Parameterize(algorithm); 208 ProblemConfiguration.Parameterize(problem); 209 210 //((IAlgorithm)AlgorithmConfiguration.ActualValue.Value).CollectParameterValues(this.Parameters); 211 //((IProblem)ProblemConfiguration.ActualValue.Value).CollectParameterValues(this.Parameters); 185 212 } 186 213 … … 251 278 return run; 252 279 } 280 281 public override string ParameterInfoString { 282 get { 283 string algorithmInfo = this.AlgorithmConfiguration.ParameterInfoString; 284 string problemInfo = this.ProblemConfiguration.ParameterInfoString; 285 var sb = new StringBuilder(); 286 if (!string.IsNullOrEmpty(algorithmInfo)) { 287 sb.Append("Algorithm: "); 288 sb.Append(algorithmInfo); 289 } 290 if (!string.IsNullOrEmpty(problemInfo)) { 291 if (sb.Length > 0) 292 sb.Append(", "); 293 sb.Append("Problem: "); 294 sb.Append(problemInfo); 295 } 296 return sb.ToString(); 297 } 298 } 253 299 } 254 300 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs
r5653 r5665 128 128 129 129 [Storable] 130 protected bool discoverValidValues; 131 public bool DiscoverValidValues { 132 get { return discoverValidValues; } 133 set { discoverValidValues = value; } 134 } 135 136 [Storable] 130 137 protected IItemSet<IItem> validValues; 131 138 132 139 #region Constructors and Cloning 133 public ParameterConfiguration(string parameterName, IValueParameter valueParameter ) {140 public ParameterConfiguration(string parameterName, IValueParameter valueParameter, bool discoverValidValues) { 134 141 this.ParameterName = parameterName; 135 142 this.parameterDataType = valueParameter.GetType(); 136 143 this.valueDataType = valueParameter.DataType; 137 this.validValues = GetValidValues(valueParameter); 144 this.discoverValidValues = discoverValidValues; 145 this.validValues = discoverValidValues ? GetValidValues(valueParameter) : new ItemSet<IItem> { valueParameter.Value }; 138 146 this.validTypes = GetValidTypes(valueParameter).ToArray(); 139 147 this.IsNullable = valueParameter.ItemName.StartsWith("Optional"); … … 169 177 this.isNullable = original.isNullable; 170 178 this.itemImage = original.itemImage; 179 this.discoverValidValues = original.discoverValidValues; 171 180 if (this.valueConfigurations != null) RegisterValueConfigurationEvents(); 172 181 } … … 210 219 val = CreateItem(t); 211 220 } 212 if (val is IParameterizedItem) { 213 this.ValueConfigurations.Add(new ParameterizedValueConfiguration(val, val.GetType()), true); 214 } else { 215 this.ValueConfigurations.Add(new RangeValueConfiguration(val, val.GetType()), true); 221 if (val != null) { // val can be null when ValidValues does not contain the type (this can happen when discoverValidValues=false) 222 if (val is IParameterizedItem) { 223 this.ValueConfigurations.Add(new ParameterizedValueConfiguration(val, val.GetType(), true), true); 224 } else { 225 this.ValueConfigurations.Add(new RangeValueConfiguration(val, val.GetType()), true); 226 } 216 227 } 217 228 } … … 395 406 } 396 407 397 public static IParameterConfiguration Create(IParameterizedNamedItem parent, IParameter parameter ) {408 public static IParameterConfiguration Create(IParameterizedNamedItem parent, IParameter parameter, bool discoverValidValues) { 398 409 if (parameter is IValueParameter) { 399 410 IValueParameter valueParameter = parameter as IValueParameter; 400 return new ParameterConfiguration(parameter.Name, valueParameter );411 return new ParameterConfiguration(parameter.Name, valueParameter, discoverValidValues); 401 412 } 402 413 return null; … … 410 421 } 411 422 var clonedValue = this.ActualValue.Value != null ? (IItem)this.ActualValue.Value.Clone() : null; 412 if (clonedValue != null) AdaptValidValues(parameter, clonedValue);423 if (clonedValue != null) AdaptValidValues(parameter, clonedValue); 413 424 parameter.Value = clonedValue; 414 425 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ParameterizedValueConfiguration.cs
r5653 r5665 12 12 [Storable] 13 13 protected IItemCollection<IParameterConfiguration> parameterConfigurations = new ItemCollection<IParameterConfiguration>(); 14 public IItemCollection<IParameterConfiguration> ParameterConfigurations {14 public virtual IItemCollection<IParameterConfiguration> ParameterConfigurations { 15 15 get { return new ReadOnlyItemCollection<IParameterConfiguration>(this.parameterConfigurations); } 16 16 protected set { this.parameterConfigurations = value; } … … 23 23 if (optimize) { 24 24 ClearParameterConfigurations(); 25 if (this.actualValue.Value is IParameterizedNamedItem) PopulateParameterConfigurations(this.actualValue.Value as IParameterizedNamedItem );25 if (this.actualValue.Value is IParameterizedNamedItem) PopulateParameterConfigurations(this.actualValue.Value as IParameterizedNamedItem, this.discoverValidValues); 26 26 } else { 27 27 ClearParameterConfigurations(); … … 35 35 ClearParameterConfigurations(); 36 36 base.ActualValue = value; 37 if(this.actualValue.Value != null) PopulateParameterConfigurations(this.actualValue.Value as IParameterizedNamedItem );37 if(this.actualValue.Value != null) PopulateParameterConfigurations(this.actualValue.Value as IParameterizedNamedItem, this.discoverValidValues); 38 38 } 39 } 40 41 [Storable] 42 protected bool discoverValidValues; 43 public bool DiscoverValidValues { 44 get { return discoverValidValues; } 45 set { discoverValidValues = value; } 39 46 } 40 47 … … 45 52 this.ParameterConfigurations = new ItemList<IParameterConfiguration>(); 46 53 } 47 public ParameterizedValueConfiguration(IItem value, Type valueDataType )54 public ParameterizedValueConfiguration(IItem value, Type valueDataType, bool discoverValidValues) 48 55 : base(value, valueDataType) { 56 this.discoverValidValues = discoverValidValues; 49 57 } 50 58 protected ParameterizedValueConfiguration(ParameterizedValueConfiguration original, Cloner cloner) 51 59 : base(original, cloner) { 60 this.discoverValidValues = original.discoverValidValues; 52 61 this.ParameterConfigurations = cloner.Clone(original.parameterConfigurations); 53 62 } … … 57 66 #endregion 58 67 59 protected virtual void PopulateParameterConfigurations(IParameterizedNamedItem parameterizedItem ) {68 protected virtual void PopulateParameterConfigurations(IParameterizedNamedItem parameterizedItem, bool discoverValidValues) { 60 69 foreach (var childParameter in parameterizedItem.Parameters) { 61 var pc = ParameterConfiguration.Create(parameterizedItem, childParameter); 62 if (pc != null) this.parameterConfigurations.Add(pc); 70 IValueParameter valueParameter = childParameter as IValueParameter; 71 if (valueParameter != null) { 72 var pc = new ParameterConfiguration(valueParameter.Name, valueParameter, discoverValidValues); 73 this.parameterConfigurations.Add(pc); 74 } 63 75 } 64 76 } … … 71 83 get { 72 84 StringBuilder sb = new StringBuilder(); 73 if ( this.Optimize&& this.ParameterConfigurations.Count > 0) {85 if ((this.Optimize) && this.ParameterConfigurations.Count > 0) { 74 86 var parameterInfos = new List<string>(); 75 87 foreach (var pc in this.ParameterConfigurations) { -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ValueConfiguration.cs
r5653 r5665 2 2 using System.Collections.Generic; 3 3 using System.Drawing; 4 using System.Linq;5 4 using HeuristicLab.Common; 6 5 using HeuristicLab.Core; 7 6 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 8 using HeuristicLab.PluginInfrastructure;9 7 10 8 namespace HeuristicLab.Problems.MetaOptimization { … … 74 72 #region Constructors and Cloning 75 73 public ValueConfiguration(IItem value, Type valueDataType) { 76 var validTypes = ApplicationManager.Manager.GetTypes(valueDataType).OrderBy(x => x.Name).ToArray();77 74 this.ActualValue = new ConstrainedValue(value, valueDataType, new ItemSet<IItem> { value }, false); 78 75 this.IsOptimizable = true; -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/AlgorithmSubScopesCreator.cs
r5653 r5665 1 1 using System; 2 using System.Collections.Generic;3 using System.Linq;4 using System.Text;2 using HeuristicLab.Common; 3 using HeuristicLab.Core; 4 using HeuristicLab.Data; 5 5 using HeuristicLab.Operators; 6 using HeuristicLab.Optimization; 7 using HeuristicLab.Parameters; 6 8 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 7 using HeuristicLab.Core;8 using HeuristicLab.Common;9 using HeuristicLab.Parameters;10 using HeuristicLab.Optimization;11 using HeuristicLab.Data;12 using HeuristicLab.Algorithms.GeneticAlgorithm;13 9 14 10 namespace HeuristicLab.Problems.MetaOptimization { -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj
r5655 r5665 146 146 <Compile Include="Analyzers\PMOPopulationDiversityAnalyzer.cs" /> 147 147 <Compile Include="ConstrainedTypeValue.cs" /> 148 <Compile Include="Encoding\AlgorithmProblemItem.cs" /> 149 <Compile Include="Encoding\ParameterConfigurations\SingleValuedParameterConfiguration.cs" /> 148 150 <Compile Include="Encoding\ValueConfigurations\RangeValueConfiguration.cs" /> 149 151 <Compile Include="Encoding\ValueConfigurations\ParameterizedValueConfiguration.cs" /> -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs
r5655 r5665 269 269 // the first problem in the list is always the instance for the algorithm - this way some basic wiring between problem and algorithm can be sustained 270 270 if (e.Items.Single().Index == 0) { 271 ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(CreateAlgorithm(AlgorithmType.Value, e.Items.Single().Value) );271 ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(CreateAlgorithm(AlgorithmType.Value, e.Items.Single().Value), e.Items.Single().Value); 272 272 273 273 // special for DataAnalysisProblem: Because of wiring between algorithm and problem, ParameterConfigurationTree needs to be recreated on Reset event … … 291 291 292 292 private void DataAnalysisProblem_Reset(object sender, EventArgs e) { 293 ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(CreateAlgorithm(AlgorithmType.Value, Problems.First()) );293 ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(CreateAlgorithm(AlgorithmType.Value, Problems.First()), Problems.First()); 294 294 } 295 295 #endregion … … 304 304 AlgorithmType.Value = algorithm.GetType(); 305 305 if (algorithm.Problem != null) ProblemType.Value = algorithm.Problem.GetType(); 306 ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(algorithm); 307 if (algorithm.Problem != null) Problems.Add((IProblem)algorithm.Problem); 306 if (algorithm.Problem != null) { 307 Problems.Clear(); 308 Problems.Add((IProblem)algorithm.Problem); 309 } 310 ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(algorithm, Problems.First()); 311 308 312 } 309 313 }
Note: See TracChangeset
for help on using the changeset viewer.