Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5665


Ignore:
Timestamp:
03/10/11 19:26:58 (14 years ago)
Author:
cneumuel
Message:

#1215

  • implemented optimization of problem parameters
Location:
branches/HeuristicLab.MetaOptimization
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.Test/Program.cs

    r5653 r5665  
    9090      //Console.WriteLine("Press enter to start");
    9191      //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();
    9696      TestOptimization(metaLevelAlgorithm);
    9797
     
    131131      Console.WriteLine("\nValueConfigurations:");
    132132      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;
    137137
    138138      var vc2 = (ParameterConfigurationTree)vc1.Clone();
    139139      Console.WriteLine("Assert(1): {0}", vc1.CalculateSimilarity(vc2));
    140140
    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;
    142142      Console.WriteLine("{0}", vc1.CalculateSimilarity(vc2));
    143143
    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;
    145145      Console.WriteLine("{0}", vc1.CalculateSimilarity(vc2));
    146146
    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;
    148148      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;
    150150      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;
    152152      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;
    154154      Console.WriteLine("{0}", vc1.CalculateSimilarity(vc2));
    155155
    156       vc2.ParameterConfigurations.Single(x => x.Name == "Selector").ActualValueConfigurationIndex = 3;
     156      vc2.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "Selector").ActualValueConfigurationIndex = 3;
    157157      Console.WriteLine("{0}", vc1.CalculateSimilarity(vc2));
    158158
     
    491491      ga.Engine = new SequentialEngine.SequentialEngine();
    492492
    493       ParameterConfigurationTree vc = new ParameterConfigurationTree(ga);
     493      ParameterConfigurationTree vc = new ParameterConfigurationTree(ga, new SingleObjectiveTestFunctionProblem());
    494494
    495495      ConfigurePopulationSize(vc, 20, 100, 20);
     
    640640      metaOptimizationProblem.ProblemType.Value = typeof(SingleObjectiveTestFunctionProblem);
    641641      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;
    643643
    644644      metaOptimizationProblem.Problems.Clear();
     
    656656      //});
    657657
    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);
    661661      //ConfigureElites(algorithmVc, 0, 8, 1);
    662662      //ConfigureSelectionOperator(algorithmVc, true);
     
    735735
    736736    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();
    738738      mutationOperator.Optimize = true;
    739739
     
    749749
    750750    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();
    752752      selectionOperatorPc.Optimize = true;
    753753
     
    777777    }
    778778
    779     private static void ConfigurePopulationSize(ParameterizedValueConfiguration algorithmVc, 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();
    781781      populationSizePc.Optimize = true;
    782782      var populationSizeVc = (RangeValueConfiguration)populationSizePc.ValueConfigurations.First();
     
    787787    }
    788788
    789     private static void ConfigureMutationRate(ParameterizedValueConfiguration algorithmVc, 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();
    791791      mutationRatePc.Optimize = true;
    792792      var mutationRateVc = (RangeValueConfiguration)mutationRatePc.ValueConfigurations.First();
     
    797797    }
    798798
    799     private static void ConfigureElites(ParameterizedValueConfiguration algorithmVc, 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();
    801801      elitesPc.Optimize = true;
    802802      var elitesVc = (RangeValueConfiguration)elitesPc.ValueConfigurations.First();
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/OptimizableView.cs

    r5653 r5665  
    11using System;
     2using System.Linq;
    23using HeuristicLab.Core.Views;
    34using HeuristicLab.Data;
     
    4445
    4546          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) {
    4853            var rvc = Content as RangeValueConfiguration;
    4954            if (rvc != null) {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ValueConfigurationViews/ValueConfigurationCheckedItemCollectionView.cs

    r5654 r5665  
    5252            return new NullValueConfiguration();
    5353          } else if(value is IParameterizedItem) {
    54             return new ParameterizedValueConfiguration(value, value.GetType());
     54            return new ParameterizedValueConfiguration(value, value.GetType(), true);
    5555          } else {
    5656            return new RangeValueConfiguration(value, value.GetType());
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurationTree.cs

    r5653 r5665  
    22using System.Collections;
    33using System.Collections.Generic;
     4using System.Linq;
     5using System.Text;
    46using HeuristicLab.Common;
    57using HeuristicLab.Core;
     
    103105    }
    104106
    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    //}
    111125
    112126    #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;
    116131      this.parameters = new Dictionary<string, IItem>();
    117132      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() { }
    122143    [StorableConstructor]
    123144    protected ParameterConfigurationTree(bool deserializing) : base(deserializing) { }
     
    138159        this.parameters.Add(p.Key, cloner.Clone(p.Value));
    139160      }
    140       this.name = original.name;
     161      //this.name = original.name;
    141162    }
    142163    public override IDeepCloneable Clone(Cloner cloner) {
     
    181202    public override void Parameterize(IParameterizedItem item) {
    182203      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);
    185212    }
    186213
     
    251278      return run;
    252279    }
     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    }
    253299  }
    254300}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs

    r5653 r5665  
    128128
    129129    [Storable]
     130    protected bool discoverValidValues;
     131    public bool DiscoverValidValues {
     132      get { return discoverValidValues; }
     133      set { discoverValidValues = value; }
     134    }
     135
     136    [Storable]
    130137    protected IItemSet<IItem> validValues;
    131138
    132139    #region Constructors and Cloning
    133     public ParameterConfiguration(string parameterName, IValueParameter valueParameter) {
     140    public ParameterConfiguration(string parameterName, IValueParameter valueParameter, bool discoverValidValues) {
    134141      this.ParameterName = parameterName;
    135142      this.parameterDataType = valueParameter.GetType();
    136143      this.valueDataType = valueParameter.DataType;
    137       this.validValues = GetValidValues(valueParameter);
     144      this.discoverValidValues = discoverValidValues;
     145      this.validValues = discoverValidValues ? GetValidValues(valueParameter) : new ItemSet<IItem> { valueParameter.Value };
    138146      this.validTypes = GetValidTypes(valueParameter).ToArray();
    139147      this.IsNullable = valueParameter.ItemName.StartsWith("Optional");
     
    169177      this.isNullable = original.isNullable;
    170178      this.itemImage = original.itemImage;
     179      this.discoverValidValues = original.discoverValidValues;
    171180      if (this.valueConfigurations != null) RegisterValueConfigurationEvents();
    172181    }
     
    210219            val = CreateItem(t);
    211220          }
    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            }
    216227          }
    217228        }
     
    395406    }
    396407
    397     public static IParameterConfiguration Create(IParameterizedNamedItem parent, IParameter parameter) {
     408    public static IParameterConfiguration Create(IParameterizedNamedItem parent, IParameter parameter, bool discoverValidValues) {
    398409      if (parameter is IValueParameter) {
    399410        IValueParameter valueParameter = parameter as IValueParameter;
    400         return new ParameterConfiguration(parameter.Name, valueParameter);
     411        return new ParameterConfiguration(parameter.Name, valueParameter, discoverValidValues);
    401412      }
    402413      return null;
     
    410421      }
    411422      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);
    413424      parameter.Value = clonedValue;
    414425    }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ParameterizedValueConfiguration.cs

    r5653 r5665  
    1212    [Storable]
    1313    protected IItemCollection<IParameterConfiguration> parameterConfigurations = new ItemCollection<IParameterConfiguration>();
    14     public IItemCollection<IParameterConfiguration> ParameterConfigurations {
     14    public virtual IItemCollection<IParameterConfiguration> ParameterConfigurations {
    1515      get { return new ReadOnlyItemCollection<IParameterConfiguration>(this.parameterConfigurations); }
    1616      protected set { this.parameterConfigurations = value; }
     
    2323        if (optimize) {
    2424          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);
    2626        } else {
    2727          ClearParameterConfigurations();
     
    3535        ClearParameterConfigurations();
    3636        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);
    3838      }
     39    }
     40
     41    [Storable]
     42    protected bool discoverValidValues;
     43    public bool DiscoverValidValues {
     44      get { return discoverValidValues; }
     45      set { discoverValidValues = value; }
    3946    }
    4047
     
    4552      this.ParameterConfigurations = new ItemList<IParameterConfiguration>();
    4653    }
    47     public ParameterizedValueConfiguration(IItem value, Type valueDataType)
     54    public ParameterizedValueConfiguration(IItem value, Type valueDataType, bool discoverValidValues)
    4855      : base(value, valueDataType) {
     56      this.discoverValidValues = discoverValidValues;
    4957    }
    5058    protected ParameterizedValueConfiguration(ParameterizedValueConfiguration original, Cloner cloner)
    5159      : base(original, cloner) {
     60      this.discoverValidValues = original.discoverValidValues;
    5261      this.ParameterConfigurations = cloner.Clone(original.parameterConfigurations);
    5362    }
     
    5766    #endregion
    5867
    59     protected virtual void PopulateParameterConfigurations(IParameterizedNamedItem parameterizedItem) {
     68    protected virtual void PopulateParameterConfigurations(IParameterizedNamedItem parameterizedItem, bool discoverValidValues) {
    6069      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        }
    6375      }
    6476    }
     
    7183      get {
    7284        StringBuilder sb = new StringBuilder();
    73         if (this.Optimize && this.ParameterConfigurations.Count > 0) {
     85        if ((this.Optimize) && this.ParameterConfigurations.Count > 0) {
    7486          var parameterInfos = new List<string>();
    7587          foreach (var pc in this.ParameterConfigurations) {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ValueConfiguration.cs

    r5653 r5665  
    22using System.Collections.Generic;
    33using System.Drawing;
    4 using System.Linq;
    54using HeuristicLab.Common;
    65using HeuristicLab.Core;
    76using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    8 using HeuristicLab.PluginInfrastructure;
    97
    108namespace HeuristicLab.Problems.MetaOptimization {
     
    7472    #region Constructors and Cloning
    7573    public ValueConfiguration(IItem value, Type valueDataType) {
    76       var validTypes = ApplicationManager.Manager.GetTypes(valueDataType).OrderBy(x => x.Name).ToArray();
    7774      this.ActualValue = new ConstrainedValue(value, valueDataType, new ItemSet<IItem> { value }, false);
    7875      this.IsOptimizable = true;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/AlgorithmSubScopesCreator.cs

    r5653 r5665  
    11using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
     2using HeuristicLab.Common;
     3using HeuristicLab.Core;
     4using HeuristicLab.Data;
    55using HeuristicLab.Operators;
     6using HeuristicLab.Optimization;
     7using HeuristicLab.Parameters;
    68using 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;
    139
    1410namespace HeuristicLab.Problems.MetaOptimization {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj

    r5655 r5665  
    146146    <Compile Include="Analyzers\PMOPopulationDiversityAnalyzer.cs" />
    147147    <Compile Include="ConstrainedTypeValue.cs" />
     148    <Compile Include="Encoding\AlgorithmProblemItem.cs" />
     149    <Compile Include="Encoding\ParameterConfigurations\SingleValuedParameterConfiguration.cs" />
    148150    <Compile Include="Encoding\ValueConfigurations\RangeValueConfiguration.cs" />
    149151    <Compile Include="Encoding\ValueConfigurations\ParameterizedValueConfiguration.cs" />
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs

    r5655 r5665  
    269269      // 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
    270270      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);
    272272
    273273        // special for DataAnalysisProblem: Because of wiring between algorithm and problem, ParameterConfigurationTree needs to be recreated on Reset event
     
    291291
    292292    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());
    294294    }
    295295    #endregion
     
    304304      AlgorithmType.Value = algorithm.GetType();
    305305      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     
    308312    }
    309313  }
Note: See TracChangeset for help on using the changeset viewer.