Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5653


Ignore:
Timestamp:
03/10/11 10:44:42 (12 years ago)
Author:
cneumuel
Message:

#1215

  • evaluation operator returns operatorgraph which creates a scope and an operation for each algorithm execution (each repetition and problem)
  • split ValueConfiguration into ParameterizedValueConfiguration and RangeValueConfiguration
Location:
branches/HeuristicLab.MetaOptimization
Files:
8 added
2 deleted
19 edited

Legend:

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

    • Property svn:ignore
      •  

        old new  
        22obj
        33HeuristicLab.MetaOptimization.Test.csproj.user
         4*.vs10x
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.Test/Program.cs

    r5576 r5653  
    22using System.Collections;
    33using System.Collections.Generic;
     4using System.Diagnostics;
    45using System.IO;
    56using System.Linq;
     7using System.Reflection;
    68using System.Text;
    79using System.Threading;
     10using System.Threading.Tasks;
    811using HeuristicLab.Algorithms.EvolutionStrategy;
    912using HeuristicLab.Algorithms.GeneticAlgorithm;
     
    1114using HeuristicLab.Core;
    1215using HeuristicLab.Data;
     16using HeuristicLab.Hive.ExperimentManager;
    1317using HeuristicLab.Optimization;
     18using HeuristicLab.Parameters;
    1419using HeuristicLab.PluginInfrastructure;
     20using HeuristicLab.PluginInfrastructure.Manager;
    1521using HeuristicLab.Problems.MetaOptimization;
    1622using HeuristicLab.Problems.TestFunctions;
    1723using HeuristicLab.Random;
    1824using HeuristicLab.Selection;
    19 using HeuristicLab.Parameters;
    20 using HeuristicLab.Operators;
    21 using System.Diagnostics;
    22 using HeuristicLab.Encodings.RealVectorEncoding;
    23 using HeuristicLab.Hive.ExperimentManager;
    24 using System.Threading.Tasks;
    25 using HeuristicLab.PluginInfrastructure.Manager;
    26 using System.Reflection;
    2725
    2826namespace HeuristicLab.MetaOptimization.Test {
     
    7068      //TestEnumeratorCollectionEnumerator();
    7169      //TestCombinations4(); return;
    72       //TestAlgorithmPerformanceIssue();
     70      //TestAlgorithmPerformanceIssue(); return;
    7371      //TestWaitAny();
    7472      //TestExecutionTimeUpdateInvervalPerformance();
     
    7674      //TestNormalCrossover();
    7775      //TestItemDictionary();
    78 
    79 
    80 
     76     
    8177      MetaOptimizationProblem metaOptimizationProblem = new MetaOptimizationProblem();
    8278      metaOptimizationProblem.Repetitions = new IntValue(metaProblemRepetitions);
     
    8783      //EvolutionStrategy metaLevelAlgorithm = GetMetaES(metaOptimizationProblem);
    8884
    89       IValueConfiguration algorithmVc = SetupGAAlgorithm(typeof(GeneticAlgorithm), metaOptimizationProblem);
     85      var algorithmVc = SetupGAAlgorithm(typeof(GeneticAlgorithm), metaOptimizationProblem);
    9086
    9187      //TestToString(algorithmVc);
     
    9490      //Console.WriteLine("Press enter to start");
    9591      //Console.ReadLine();
    96       //TestConfiguration(algorithmVc, baseLevelAlgorithm);
     92      //TestConfiguration(algorithmVc, new GeneticAlgorithm());
    9793
    9894      //Console.WriteLine("Press enter to start");
     
    140136      vc1.ParameterConfigurations.Single(x => x.Name == "Selector").Optimize = true;
    141137
    142       var vc2 = (IValueConfiguration)vc1.Clone();
     138      var vc2 = (ParameterConfigurationTree)vc1.Clone();
    143139      Console.WriteLine("Assert(1): {0}", vc1.CalculateSimilarity(vc2));
    144140
     
    289285          swx.Start();
    290286          ((EngineAlgorithm)alg).ExecutionTimeChanged += new EventHandler(Program_ExecutionTimeChanged);
    291           var executor = new AlgorithmExecutor((EngineAlgorithm)alg);
    292           executor.StartSync();
     287          ((EngineAlgorithm)alg).StartSync();
    293288          ((EngineAlgorithm)alg).ExecutionTimeChanged -= new EventHandler(Program_ExecutionTimeChanged);
    294289          swx.Stop();
     
    369364      Queue<TimeSpan> latestExecutionTimes = new Queue<TimeSpan>();
    370365      int size = 10;
     366      var random = new Random.MersenneTwister(0);
    371367
    372368      GeneticAlgorithm ga = new GeneticAlgorithm();
     
    374370      ga.MaximumGenerations.Value = 1;
    375371      ga.Engine = new SequentialEngine.SequentialEngine();
    376       throw new NotImplementedException("TODO: Set ga parameters correctly");
     372      ga.Problem = new SingleObjectiveTestFunctionProblem();
    377373
    378374      MetaOptimizationProblem metaOptimizationProblem = new MetaOptimizationProblem();
    379       metaOptimizationProblem.Repetitions = new IntValue(metaProblemRepetitions);
     375      //metaOptimizationProblem.Repetitions = new IntValue(metaProblemRepetitions);
    380376      GeneticAlgorithm metaLevelAlgorithm = GetMetaGA(metaOptimizationProblem);
    381377      ParameterConfigurationTree algorithmVc = SetupGAAlgorithm(typeof(GeneticAlgorithm), metaOptimizationProblem);
     378      algorithmVc.Randomize(random);
    382379      Stopwatch sw = new Stopwatch();
    383380
     381      var algs = new Queue<IAlgorithm>(); // keep them in memory
     382      // -> BINGO! -> .NET cannot hold more than 16 algorithms with their ThreadLocal<T> objects efficiently,
     383      // so if they are kept in memory, runtime at the 17. execution drops significantly
     384      // because creating ThreadLocal<T> takes all the runtime.
     385      // when the algs are not stored in a list however this effect does not occur.
     386     
     387
    384388      for (int i = 0; i < 1000; i++) {
    385         sw.Start();
    386389        GeneticAlgorithm clonedGa = (GeneticAlgorithm)ga.Clone();
    387390        clonedGa.Name = "CLONED GA";
    388         algorithmVc.Parameterize(clonedGa);
     391        //algorithmVc.Randomize(random);
     392        //algorithmVc.Parameterize(clonedGa);
    389393        clonedGa.Prepare(true);
    390         var executor = new AlgorithmExecutor(clonedGa);
    391         executor.StartSync();
     394        sw.Start();
     395        algs.Enqueue(clonedGa);
     396
     397        if (algs.Count > 24)
     398          algs.Dequeue();
     399        clonedGa.StartSync();
    392400        sw.Stop();
    393401        latestExecutionTimes.Enqueue(sw.Elapsed);
     
    549557    private static void TestTypeDiscovery() {
    550558      PluginLoader.pluginAssemblies.Any();
    551 
     559     
    552560      var items = ApplicationManager.Manager.GetInstances(typeof(DoubleArray)).ToArray();
    553561
     
    634642      ((IntValue)algorithmVc.ParameterConfigurations.Single(x => x.Name == "MaximumGenerations").ActualValue.Value).Value = baseAlgorithmMaxGenerations;
    635643
     644      metaOptimizationProblem.Problems.Clear();
    636645      metaOptimizationProblem.Problems.Add(new HeuristicLab.Problems.TestFunctions.SingleObjectiveTestFunctionProblem() {
    637646        Evaluator = new GriewankEvaluator(),
    638647        ProblemSize = new IntValue(2)
    639648      });
    640       metaOptimizationProblem.Problems.Add(new HeuristicLab.Problems.TestFunctions.SingleObjectiveTestFunctionProblem() {
    641         Evaluator = new GriewankEvaluator(),
    642         ProblemSize = new IntValue(20)
    643       });
    644       metaOptimizationProblem.Problems.Add(new HeuristicLab.Problems.TestFunctions.SingleObjectiveTestFunctionProblem() {
    645         Evaluator = new GriewankEvaluator(),
    646         ProblemSize = new IntValue(500)
    647       });
    648 
    649       ConfigurePopulationSize(algorithmVc, 5, 20, 1);
    650       ConfigureMutationRate(algorithmVc, 0.0, 1.0, 0.01);
     649      //metaOptimizationProblem.Problems.Add(new HeuristicLab.Problems.TestFunctions.SingleObjectiveTestFunctionProblem() {
     650      //  Evaluator = new GriewankEvaluator(),
     651      //  ProblemSize = new IntValue(20)
     652      //});
     653      //metaOptimizationProblem.Problems.Add(new HeuristicLab.Problems.TestFunctions.SingleObjectiveTestFunctionProblem() {
     654      //  Evaluator = new GriewankEvaluator(),
     655      //  ProblemSize = new IntValue(500)
     656      //});
     657
     658      //ConfigurePopulationSize(algorithmVc, 15, 20, 1);
     659      //ConfigureMutationRate(algorithmVc, 0.0, 1.0, 0.01);
    651660      ConfigureMutationOperator(algorithmVc);
    652       //ConfigureElites(algorithmVc, 0, 30, 1);
    653       ConfigureSelectionOperator(algorithmVc, true);
     661      //ConfigureElites(algorithmVc, 0, 8, 1);
     662      //ConfigureSelectionOperator(algorithmVc, true);
    654663      return algorithmVc;
    655664    }
    656665
    657     private static void TestConfiguration(IValueConfiguration algorithmVc, GeneticAlgorithm baseLevelAlgorithm) {
     666    private static void TestConfiguration(ParameterConfigurationTree algorithmVc, GeneticAlgorithm baseLevelAlgorithm) {
    658667      IRandom rand = new FastRandom(0);
    659668      // set random values
    660669      for (int i = 0; i < 10; i++) {
    661         IValueConfiguration clonedVc = (IValueConfiguration)algorithmVc.Clone();
     670        var clonedVc = (ParameterConfigurationTree)algorithmVc.Clone();
    662671        GeneticAlgorithm newAlg = (GeneticAlgorithm)baseLevelAlgorithm.Clone();
    663672        clonedVc.Randomize(rand);
     
    676685      // mutate
    677686      for (int i = 0; i < 10; i++) {
    678         IValueConfiguration clonedVc = (IValueConfiguration)algorithmVc.Clone();
     687        var clonedVc = (ParameterConfigurationTree)algorithmVc.Clone();
    679688        GeneticAlgorithm newAlg = (GeneticAlgorithm)baseLevelAlgorithm.Clone();
    680689        ParameterConfigurationManipulator.Apply(rand, clonedVc, new UniformIntValueManipulator(), new NormalDoubleValueManipulator());
     
    692701      // cross
    693702      for (int i = 0; i < 10; i++) {
    694         IValueConfiguration clonedVc1 = (IValueConfiguration)algorithmVc.Clone();
    695         IValueConfiguration clonedVc2 = (IValueConfiguration)algorithmVc.Clone();
     703        var clonedVc1 = (ParameterConfigurationTree)algorithmVc.Clone();
     704        var clonedVc2 = (ParameterConfigurationTree)algorithmVc.Clone();
    696705
    697706        GeneticAlgorithm first = (GeneticAlgorithm)baseLevelAlgorithm.Clone();
     
    725734    }
    726735
    727     private static void ConfigureMutationOperator(IValueConfiguration algorithmVc) {
     736    private static void ConfigureMutationOperator(ParameterConfigurationTree algorithmVc) {
    728737      var mutationOperator = algorithmVc.ParameterConfigurations.Where(x => x.Name == "Mutator").SingleOrDefault();
    729738      mutationOperator.Optimize = true;
     
    735744      }
    736745
    737       // add another normal
    738       mutationOperator.ValueConfigurations.Add(new ValueConfiguration(new NormalAllPositionsManipulator(), typeof(NormalAllPositionsManipulator)), true);
    739     }
    740 
    741     private static void ConfigureSelectionOperator(IValueConfiguration algorithmVc, bool configureTournamenSize) {
     746      // add another normal - don't do this with 'new', because ActualNames will not be set correctly. It should be copied from an existing one
     747      // mutationOperator.ValueConfigurations.Add(new ParameterizedValueConfiguration(new NormalAllPositionsManipulator(), typeof(NormalAllPositionsManipulator)), true);
     748    }
     749
     750    private static void ConfigureSelectionOperator(ParameterConfigurationTree algorithmVc, bool configureTournamenSize) {
    742751      var selectionOperatorPc = algorithmVc.ParameterConfigurations.Where(x => x.Name == "Selector").SingleOrDefault();
    743752      selectionOperatorPc.Optimize = true;
     
    748757          if (configureTournamenSize) {
    749758            vc.Optimize = true;
    750             ConfigureTournamentGroupSize(vc);
     759            ConfigureTournamentGroupSize((ParameterizedValueConfiguration)vc);
    751760          }
    752761        } else if (vc.ActualValue.ValueDataType == typeof(RandomSelector)) {
     
    758767    }
    759768
    760     private static void ConfigureTournamentGroupSize(IValueConfiguration tournamentVc) {
     769    private static void ConfigureTournamentGroupSize(ParameterizedValueConfiguration tournamentVc) {
    761770      var groupSizePc = tournamentVc.ParameterConfigurations.Where(x => x.ParameterName == "GroupSize").SingleOrDefault();
    762771      groupSizePc.Optimize = true;
    763 
    764       groupSizePc.ValueConfigurations.First().Optimize = true;
    765       groupSizePc.ValueConfigurations.First().RangeConstraint.LowerBound = new IntValue(0);
    766       groupSizePc.ValueConfigurations.First().RangeConstraint.UpperBound = new IntValue(10);
    767       groupSizePc.ValueConfigurations.First().RangeConstraint.StepSize = new IntValue(1);
    768     }
    769 
    770     private static void ConfigurePopulationSize(IValueConfiguration algorithmVc, int lower, int upper, int stepsize) {
     772      var groupSizeVc = (RangeValueConfiguration)groupSizePc.ValueConfigurations.First();
     773      groupSizeVc.Optimize = true;
     774      groupSizeVc.RangeConstraint.LowerBound = new IntValue(0);
     775      groupSizeVc.RangeConstraint.UpperBound = new IntValue(10);
     776      groupSizeVc.RangeConstraint.StepSize = new IntValue(1);
     777    }
     778
     779    private static void ConfigurePopulationSize(ParameterizedValueConfiguration algorithmVc, int lower, int upper, int stepsize) {
    771780      var populationSizePc = algorithmVc.ParameterConfigurations.Where(x => x.Name == "PopulationSize").SingleOrDefault();
    772781      populationSizePc.Optimize = true;
    773       var populationSizeVc = populationSizePc.ValueConfigurations.First();
     782      var populationSizeVc = (RangeValueConfiguration)populationSizePc.ValueConfigurations.First();
    774783      populationSizeVc.Optimize = true;
    775784      populationSizeVc.RangeConstraint.LowerBound = new IntValue(lower);
     
    778787    }
    779788
    780     private static void ConfigureMutationRate(IValueConfiguration algorithmVc, double lower, double upper, double stepsize) {
     789    private static void ConfigureMutationRate(ParameterizedValueConfiguration algorithmVc, double lower, double upper, double stepsize) {
    781790      var mutationRatePc = algorithmVc.ParameterConfigurations.Where(x => x.Name == "MutationProbability").SingleOrDefault();
    782791      mutationRatePc.Optimize = true;
    783       var mutationRateVc = mutationRatePc.ValueConfigurations.First();
     792      var mutationRateVc = (RangeValueConfiguration)mutationRatePc.ValueConfigurations.First();
    784793      mutationRateVc.Optimize = true;
    785794      mutationRateVc.RangeConstraint.LowerBound = new PercentValue(lower);
     
    788797    }
    789798
    790     private static void ConfigureElites(IValueConfiguration algorithmVc, int from, int to, int stepSize) {
     799    private static void ConfigureElites(ParameterizedValueConfiguration algorithmVc, int from, int to, int stepSize) {
    791800      var elitesPc = algorithmVc.ParameterConfigurations.Where(x => x.Name == "Elites").SingleOrDefault();
    792801      elitesPc.Optimize = true;
    793       var elitesVc = elitesPc.ValueConfigurations.First();
     802      var elitesVc = (RangeValueConfiguration)elitesPc.ValueConfigurations.First();
    794803      elitesVc.Optimize = true;
    795804      elitesVc.RangeConstraint.LowerBound = new IntValue(from);
     
    855864                var orderedRuns = rc.OrderBy(x => x.Results["AverageQualityNormalized"]);
    856865
    857                 TableBuilder tb = new TableBuilder("QNorm", "Qualities", "PoSi", "MutRa", /*"Eli",*/ "SelOp", "MutOp", "NrSelSubScopes");
     866                TableBuilder tb = new TableBuilder("QNorm", "Qualities"/*, "PoSi"/* "MutRa", "Eli", "SelOp", "MutOp", "NrSelSubScopes"*/);
    858867                foreach (IRun run in orderedRuns) {
    859                   string selector;
    860                   if (run.Parameters["Selector"] is TournamentSelector) {
    861                     selector = string.Format("{0} ({1})", run.Parameters["Selector"].ToString(), ((TournamentSelector)run.Parameters["Selector"]).GroupSizeParameter.Value.ToString());
    862                   } else {
    863                     selector = string.Format("{0}", run.Parameters["Selector"].ToString());
    864                   }
     868                  //string selector;
     869                  //if (run.Parameters["Selector"] is TournamentSelector) {
     870                  //  selector = string.Format("{0} ({1})", run.Parameters["Selector"].ToString(), ((TournamentSelector)run.Parameters["Selector"]).GroupSizeParameter.Value.ToString());
     871                  //} else {
     872                  //  selector = string.Format("{0}", run.Parameters["Selector"].ToString());
     873                  //}
    865874
    866875                  tb.AppendRow(
    867876                    ((DoubleValue)run.Results["AverageQualityNormalized"]).Value.ToString("#0.0000"),
    868                     ((DoubleArray)run.Results["RunsAverageQualities"]).ToString(),
    869                     ((IntValue)run.Parameters["PopulationSize"]).Value.ToString(),
    870                     ((DoubleValue)run.Parameters["MutationProbability"]).Value.ToString("0.0000"),
     877                    ((DoubleArray)run.Results["RunsAverageQualities"]).ToString()
     878                    //((IntValue)run.Parameters["PopulationSize"]).Value.ToString(),
     879                    //((DoubleValue)run.Parameters["MutationProbability"]).Value.ToString("0.0000"),
    871880                    //((IntValue)run.Parameters["Elites"]).Value.ToString(),
    872                     Shorten(selector, 20),
    873                     Shorten(run.Parameters.ContainsKey("Mutator") ? run.Parameters["Mutator"].ToString() : "null", 40),
    874                     ((ISelector)run.Parameters["Selector"]).NumberOfSelectedSubScopesParameter.Value.ToString());
     881                    //Shorten(selector, 20),
     882                    //Shorten(run.Parameters.ContainsKey("Mutator") ? run.Parameters["Mutator"].ToString() : "null", 40),
     883                    //((ISelector)run.Parameters["Selector"]).NumberOfSelectedSubScopesParameter.Value.ToString()
     884                    );
    875885                }
    876886                sb.AppendLine(tb.ToString());
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.sln

    r5522 r5653  
    1010Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F96C8DD1-9B68-4F2D-AD4F-1A174F596041}"
    1111  ProjectSection(SolutionItems) = preProject
    12     Performance1.psess = Performance1.psess
    1312    PreBuildEvent.cmd = PreBuildEvent.cmd
    1413  EndProjectSection
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3

    • Property svn:ignore
      •  

        old new  
        33HeuristicLab.Problems.MetaOptimization.Views-3.3.csproj.user
        44HeuristicLabProblemsMetaOptimizationViewsPlugin.cs
         5*.vs10x
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/OptimizableView.cs

    r5087 r5653  
    11using System;
    2 using System.Collections.Generic;
    3 using System.ComponentModel;
    4 using System.Drawing;
    5 using System.Data;
    6 using System.Linq;
    7 using System.Text;
    82using HeuristicLab.Core.Views;
     3using HeuristicLab.Data;
    94using HeuristicLab.MainForm;
    10 using HeuristicLab.Parameters;
    11 using HeuristicLab.Core;
    12 using HeuristicLab.Data;
    135
    146namespace HeuristicLab.Problems.MetaOptimization.Views.ValueConfigurationViews {
     
    4739        if (Content.Optimize) {
    4840          this.viewHost.ViewType = null;
    49           if (Content is IParameterConfiguration) {
     41
     42          var pc = Content as IParameterConfiguration;
     43          var vc = Content as IValueConfiguration;
     44
     45          if (pc != null) {
    5046            this.viewHost.Content = ((IParameterConfiguration)Content).ValueConfigurations;
    51           } else if (Content is IValueConfiguration) {
    52             if (Content.ActualValue.ValueDataType == typeof(IntValue) ||
     47          } else if(vc != null) {
     48            var rvc = Content as RangeValueConfiguration;
     49            if (rvc != null) {
     50              if (Content.ActualValue.ValueDataType == typeof(IntValue) ||
    5351                Content.ActualValue.ValueDataType == typeof(DoubleValue) ||
    5452                Content.ActualValue.ValueDataType == typeof(PercentValue)) {
    55               this.viewHost.ViewsLabelVisible = true;
    56               this.viewHost.Content = ((IValueConfiguration)Content).RangeConstraint;
    57             } else if(Content.ActualValue.ValueDataType == typeof(BoolValue)) {
    58               this.viewHost.Content = null; // no configuration required
    59             } else {
     53                this.viewHost.ViewsLabelVisible = true;
     54                this.viewHost.Content = rvc.RangeConstraint;
     55              } else if (Content.ActualValue.ValueDataType == typeof(BoolValue)) {
     56                this.viewHost.Content = null; // no configuration required
     57              }
     58            }
     59
     60            var pvc = Content as ParameterizedValueConfiguration;
     61            if (pvc != null) {
    6062              this.viewHost.ViewsLabelVisible = false;
    61               this.viewHost.Content = ((IValueConfiguration)Content).ParameterConfigurations;
     63              this.viewHost.Content = pvc.ParameterConfigurations;
    6264            }
    6365          } else {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ValueConfigurationViews/ValueConfigurationCheckedItemList.cs

    r5277 r5653  
    11using System;
    2 using System.Collections.Generic;
    3 using System.ComponentModel;
    4 using System.Drawing;
    5 using System.Data;
    62using System.Linq;
    7 using System.Text;
     3using System.Windows.Forms;
     4using HeuristicLab.Collections;
     5using HeuristicLab.Core;
    86using HeuristicLab.Core.Views;
    97using HeuristicLab.MainForm;
    10 using HeuristicLab.Core;
    11 using System.Windows.Forms;
    128using HeuristicLab.PluginInfrastructure;
    13 using HeuristicLab.Collections;
    149
    1510namespace HeuristicLab.Problems.MetaOptimization.Views {
     
    7671          if (value is NullValue) {
    7772            return new NullValueConfiguration();
     73          } else if(value is IParameterizedItem) {
     74            return new ParameterizedValueConfiguration(value, value.GetType());
    7875          } else {
    79             return new ValueConfiguration(value, value.GetType());
    80           }
     76            return new RangeValueConfiguration(value, value.GetType());
     77          } 
    8178        }
    8279        catch (Exception ex) {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3

    • Property svn:ignore
      •  

        old new  
        33obj
        44HeuristicLabProblemsMetaOptimizationPlugin.cs
         5*.vs10x
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers/ReferenceQualityAnalyzer.cs

    r5359 r5653  
    6868      DoubleArray referenceQualities = new DoubleArray(ProblemsParameter.ActualValue.Count);
    6969      for (int pi = 0; pi < ProblemsParameter.ActualValue.Count; pi++) {
    70         referenceQualities[pi] = solutions.Select(x => x.AverageQualities[pi]).Min(); // todo: respect minimization / maximization
     70        referenceQualities[pi] = solutions.Where(x => x.AverageQualities != null).Select(x => x.AverageQualities[pi]).Min(); // todo: respect minimization / maximization
    7171      }
    7272      return referenceQualities;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/Crossovers/ParameterConfigurationCrossover.cs

    r5293 r5653  
    9797
    9898    private static void Cross(IRandom random, IOptimizable configuartion, IOptimizable other, IIntValueCrossover intValueCrossover, IDoubleValueCrossover doubleValueCrossover) {
    99       var vc = configuartion as IValueConfiguration;
     99      var vc = configuartion as RangeValueConfiguration;
    100100      var pc = configuartion as IParameterConfiguration;
    101101      if (vc != null) {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/Manipulators/ParameterConfigurationManipulator.cs

    r5303 r5653  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
     1using System.Linq;
     2using HeuristicLab.Common;
     3using HeuristicLab.Core;
     4using HeuristicLab.Data;
    55using HeuristicLab.Operators;
    66using HeuristicLab.Optimization;
    7 using HeuristicLab.Core;
    87using HeuristicLab.Parameters;
    9 using HeuristicLab.Common;
    108using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    11 using HeuristicLab.Data;
    129
    1310namespace HeuristicLab.Problems.MetaOptimization {
     
    5552
    5653    protected static void Mutate(IRandom random, IOptimizable configuration, IIntValueManipulator intValueManipulator, IDoubleValueManipulator doubleValueManipulator) {
    57       var vc = configuration as IValueConfiguration;
     54      var vc = configuration as RangeValueConfiguration;
    5855      var pc = configuration as IParameterConfiguration;
    5956
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterCombinationsEnumerator.cs

    r5357 r5653  
    11using System;
     2using System.Collections;
    23using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 using System.Collections;
    64using HeuristicLab.Core;
    75
     
    2523        if (!initialized)
    2624          throw new SystemException("Enumeration not started. Call MoveNext!");
    27         return Current; 
     25        return Current;
    2826      }
    2927    }
     
    9492      }
    9593
    96       var vc = node as IValueConfiguration;
    97       if (vc != null) {
    98         if (vc.RangeConstraint != null) {
    99           valueEnumerator = new EnumeratorCollectionEnumerator<IItem>();
    100           valueEnumerator.AddEnumerator(vc.RangeConstraint.GetCombinations().GetEnumerator());
    101           valueEnumerator.Reset();
    102           enumerators.Add(valueEnumerator);
    103         } else {
    104           foreach (var parameterConfiguration in vc.ParameterConfigurations) {
    105             if (parameterConfiguration.Optimize) {
    106               var enumerator = new ParameterCombinationsEnumerator(parameterConfiguration);
    107               enumerator.Reset();
    108               enumerators.Add(enumerator);
    109             }
     94      var rangeVc = node as RangeValueConfiguration;
     95      if (rangeVc != null) {
     96        valueEnumerator = new EnumeratorCollectionEnumerator<IItem>();
     97        valueEnumerator.AddEnumerator(rangeVc.RangeConstraint.GetCombinations().GetEnumerator());
     98        valueEnumerator.Reset();
     99        enumerators.Add(valueEnumerator);
     100      }
     101
     102      var parameterizedVc = node as ParameterizedValueConfiguration;
     103      if (parameterizedVc != null) {
     104        foreach (var parameterConfiguration in parameterizedVc.ParameterConfigurations) {
     105          if (parameterConfiguration.Optimize) {
     106            var enumerator = new ParameterCombinationsEnumerator(parameterConfiguration);
     107            enumerator.Reset();
     108            enumerators.Add(enumerator);
    110109          }
    111           enumerators.Reverse(); // this makes the list of combinations better readable
    112110        }
     111        enumerators.Reverse(); // this makes the list of combinations better readable
    113112      }
    114113    }
     
    129128    }
    130129
    131     public void Dispose() {  }
     130    public void Dispose() { }
    132131
    133132    public T Current {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurationTree.cs

    r5576 r5653  
    11using System;
     2using System.Collections;
    23using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
     4using HeuristicLab.Common;
    55using HeuristicLab.Core;
    6 using HeuristicLab.Common;
     6using HeuristicLab.Data;
     7using HeuristicLab.Optimization;
    78using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    8 using HeuristicLab.Optimization;
    9 using HeuristicLab.Data;
    10 using System.Collections;
    119
    1210namespace HeuristicLab.Problems.MetaOptimization {
    1311  // todo: storable, name, descr, ...
    1412  [StorableClass]
    15   public class ParameterConfigurationTree : ValueConfiguration, IEnumerable {
     13  public class ParameterConfigurationTree : ParameterizedValueConfiguration, IEnumerable {
    1614
    1715    [Storable]
     
    189187    public Experiment GenerateExperiment(IAlgorithm algorithm, bool createBatchRuns, int repetitions) {
    190188      Experiment experiment = new Experiment();
    191       foreach (IValueConfiguration combination in this) {
     189      foreach (ParameterizedValueConfiguration combination in this) {
    192190        IAlgorithm clonedAlg = (IAlgorithm)algorithm.Clone();
    193191        clonedAlg.Name = combination.ParameterInfoString;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs

    r5522 r5653  
    22using System.Collections;
    33using System.Collections.Generic;
     4using System.Drawing;
    45using System.Linq;
     6using System.Text;
     7using HeuristicLab.Collections;
    58using HeuristicLab.Common;
    69using HeuristicLab.Core;
     
    912using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    1013using HeuristicLab.PluginInfrastructure;
    11 using System.Text;
    12 using System.Reflection;
    13 using HeuristicLab.Optimization;
    14 using HeuristicLab.Collections;
    15 using System.Drawing;
    1614
    1715namespace HeuristicLab.Problems.MetaOptimization {
     
    147145      this.ActualValue = new ConstrainedValue(
    148146        valueParameter.Value != null ? valueParameter.Value : null, // don't clone here; otherwise settings of a non-optimized ValueParameter will not be synchronized with the ConstrainedValue
    149         valueParameter.DataType, 
    150         this.validValues != null ? new ItemSet<IItem>(this.validValues) : CreateValidValues(), 
     147        valueParameter.DataType,
     148        this.validValues != null ? new ItemSet<IItem>(this.validValues) : CreateValidValues(),
    151149        this.IsNullable);
    152150      if (Optimize) {
     
    200198      if (this.ActualValue != null) this.ActualValue.ToStringChanged -= new EventHandler(ActualValue_ToStringChanged);
    201199    }
    202    
     200
    203201    private void PopulateValueConfigurations() {
    204202      foreach (Type t in this.validTypes) {
     
    212210            val = CreateItem(t);
    213211          }
    214           this.ValueConfigurations.Add(new ValueConfiguration(val, val.GetType()), true);
     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);
     216          }
    215217        }
    216218      }
     
    224226      // return only one type for ValueTypeValues<> (Int, Double, Percent, Bool). Otherwise 2 types would be returned for DoubleValue (PercentValue which is derived)
    225227      if (IsSubclassOfRawGeneric(typeof(ValueTypeValue<>), parameter.DataType))
    226         return new List<Type> { parameter.DataType }; 
    227      
     228        return new List<Type> { parameter.DataType };
     229
    228230      if (IsSubclassOfRawGeneric(typeof(OptionalConstrainedValueParameter<>), parameter.GetType())) {
    229231        // use existing validvalues if known
     
    252254      if (type == typeof(NullValue))
    253255        return new NullValue();
    254      
     256
    255257      // copy value from ValidValues; this ensures that previously set ActualNames for a type are kept
    256258      IItem value = this.validValues.Where(v => v.GetType() == type).SingleOrDefault();
    257       if (value != null) 
     259      if (value != null)
    258260        return value;
    259261
     
    404406      if (Optimize) {
    405407        if (this.ActualValue.Value is IParameterizedItem) {
    406           this.ValueConfigurations[actualValueConfigurationIndex].Parameterize((IParameterizedItem)this.ActualValue.Value);
     408          ((ParameterizedValueConfiguration)this.ValueConfigurations[actualValueConfigurationIndex]).Parameterize((IParameterizedItem)this.ActualValue.Value);
    407409        }
    408410      }
    409411      var clonedValue = this.ActualValue.Value != null ? (IItem)this.ActualValue.Value.Clone() : null;
    410       AdaptValidValues(parameter, clonedValue);
     412      if(clonedValue != null) AdaptValidValues(parameter, clonedValue);
    411413      parameter.Value = clonedValue;
    412414    }
     
    433435        foreach (var vc in this.ValueConfigurations) {
    434436          if (this.ValueConfigurations.ItemChecked(vc)) {
    435             vc.Randomize(random);
     437            if (vc.Optimize) vc.Randomize(random);
    436438          }
    437439        }
     
    447449        foreach (var vc in this.ValueConfigurations) {
    448450          if (this.ValueConfigurations.ItemChecked(vc)) {
    449             vc.Mutate(random, mutate, intValueManipulator, doubleValueManipulator);
     451            if (vc.Optimize) vc.Mutate(random, mutate, intValueManipulator, doubleValueManipulator);
    450452          }
    451453        }
     
    459461        for (int i = 0; i < this.ValueConfigurations.Count; i++) {
    460462          if (this.ValueConfigurations.ItemChecked(this.ValueConfigurations[i])) {
    461             this.ValueConfigurations[i].Cross(random, otherPc.ValueConfigurations[i], cross, intValueCrossover, doubleValueCrossover);
     463            if (this.ValueConfigurations[i].Optimize) this.ValueConfigurations[i].Cross(random, otherPc.ValueConfigurations[i], cross, intValueCrossover, doubleValueCrossover);
    462464          }
    463465        }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/NullValueConfiguration.cs

    r5112 r5653  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
     1using System.Collections.Generic;
     2using HeuristicLab.Common;
    53using HeuristicLab.Core;
    64using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    7 using HeuristicLab.Common;
    85
    96namespace HeuristicLab.Problems.MetaOptimization {
     
    129
    1310    public NullValueConfiguration() {
    14       this.ParameterConfigurations = new ItemList<IParameterConfiguration>();
    1511      this.ActualValue = new ConstrainedValue(null, null, null, true);
    1612      this.IsOptimizable = false;
     
    2824      return "null";
    2925    }
     26
     27    public override void Randomize(IRandom random) { }
     28
     29    public override void Mutate(IRandom random, MutateDelegate mutate, IIntValueManipulator intValueManipulator, IDoubleValueManipulator doubleValueManipulator) { }
     30
     31    public override void Cross(IRandom random, IOptimizable other, CrossDelegate cross, IIntValueCrossover intValueCrossover, IDoubleValueCrossover doubleValueCrossover) { }
     32
     33    public override double CalculateSimilarity(IOptimizable optimizable) {
     34      return 1.0;
     35    }
     36
     37    public override string ParameterInfoString {
     38      get { return "null"; }
     39    }
     40
     41    public override void CollectOptimizedParameterNames(List<string> parameterNames, string prefix) { }
     42
     43    public override List<IOptimizable> GetAllOptimizables() {
     44      return new List<IOptimizable>();
     45    }
    3046  }
    3147}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ValueConfiguration.cs

    r5522 r5653  
    11using System;
     2using System.Collections.Generic;
     3using System.Drawing;
    24using System.Linq;
    35using HeuristicLab.Common;
    46using HeuristicLab.Core;
    57using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    6 using HeuristicLab.Data;
    7 using System.Drawing;
    8 using HeuristicLab.Encodings.RealVectorEncoding;
    9 using HeuristicLab.Encodings.IntegerVectorEncoding;
    108using HeuristicLab.PluginInfrastructure;
    11 using System.Collections.Generic;
    12 using System.Text;
    139
    1410namespace HeuristicLab.Problems.MetaOptimization {
    1511  // TODO: ItemName/Descr, storability
    1612  [StorableClass]
    17   public class ValueConfiguration : NamedItem, IValueConfiguration {
     13  public abstract class ValueConfiguration : NamedItem, IValueConfiguration {
    1814    public override bool CanChangeName {
    1915      get { return true; }
     
    3834    [Storable]
    3935    protected bool optimize;
    40     public bool Optimize {
     36    public virtual bool Optimize {
    4137      get { return optimize; }
    4238      set {
    4339        if (optimize != value) {
    4440          optimize = value;
    45           if (optimize) {
    46             ClearParameterConfigurations();
    47             if (this.actualValue.Value is IParameterizedNamedItem) PopulateParameterConfigurations(this.actualValue.Value as IParameterizedNamedItem);
    48           } else {
    49             ClearParameterConfigurations();
    50           }
    5141          OnOptimizeChanged();
    5242          OnToStringChanged();
    5343        }
    5444      }
    55     }
    56 
    57     [Storable]
    58     protected IItemCollection<IParameterConfiguration> parameterConfigurations = new ItemCollection<IParameterConfiguration>();
    59     public IItemCollection<IParameterConfiguration> ParameterConfigurations {
    60       get { return new ReadOnlyItemCollection<IParameterConfiguration>(this.parameterConfigurations); }
    61       protected set { this.parameterConfigurations = value; }
    6245    }
    6346
     
    6952        if (this.actualValue != value) {
    7053          DeregisterActualValueEvents();
    71           ClearParameterConfigurations();
    7254          this.actualValue = value;
    73           if (this.actualValue.Value is IParameterizedNamedItem) PopulateParameterConfigurations(this.actualValue.Value as IParameterizedNamedItem);
    7455          OnValueChanged();
    7556          OnToStringChanged();
    76           RegisterActualValueEvents();
    77         }
    78       }
    79     }
    80 
    81     [Storable]
    82     protected IRange rangeConstraint;
    83     public IRange RangeConstraint {
    84       get { return rangeConstraint; }
    85       private set {
    86         if (rangeConstraint != value) {
    87           DeregisterRangeConstraintEvents();
    88           rangeConstraint = value;
    8957          RegisterActualValueEvents();
    9058        }
     
    10674    #region Constructors and Cloning
    10775    public ValueConfiguration(IItem value, Type valueDataType) {
    108       this.ParameterConfigurations = new ItemList<IParameterConfiguration>();
    10976      var validTypes = ApplicationManager.Manager.GetTypes(valueDataType).OrderBy(x => x.Name).ToArray();
    11077      this.ActualValue = new ConstrainedValue(value, valueDataType, new ItemSet<IItem> { value }, false);
    11178      this.IsOptimizable = true;
    112       if (actualValue.ValueDataType == typeof(IntValue)) {
    113         RangeConstraint = new IntValueRange(new IntValue(0), (IntValue)value, new IntValue(1));
    114       } else if (actualValue.ValueDataType == typeof(DoubleValue)) {
    115         RangeConstraint = new DoubleValueRange(new DoubleValue(0), (DoubleValue)value, new DoubleValue(0.01));
    116       } else if (actualValue.ValueDataType == typeof(PercentValue)) {
    117         RangeConstraint = new PercentValueRange(new PercentValue(0), new PercentValue(1), new PercentValue(0.01));
    118       } else if (actualValue.ValueDataType == typeof(BoolValue)) {
    119         this.IsOptimizable = false; // there is nothing to configure for bools
    120       } else {
    121         RangeConstraint = null;
    122       }
    12379    }
    12480
     
    12884    protected ValueConfiguration(ValueConfiguration original, Cloner cloner)
    12985      : base(original, cloner) {
    130       this.ParameterConfigurations = cloner.Clone(original.parameterConfigurations);
    13186      this.actualValue = cloner.Clone(original.ActualValue);
    132       this.rangeConstraint = cloner.Clone(original.RangeConstraint);
    13387      this.isOptimizable = original.isOptimizable;
    13488      this.optimize = original.optimize;
    13589      this.number = original.number;
    13690      RegisterActualValueEvents();
    137       RegisterRangeConstraintEvents();
    138     }
    139     public override IDeepCloneable Clone(Cloner cloner) {
    140       return new ValueConfiguration(this, cloner);
    141     }
    142     [StorableHook(HookType.AfterDeserialization)]
    143     private void AfterDeserialization() {
    144       RegisterRangeConstraintEvents();
    14591    }
    14692    #endregion
    14793
    148     protected virtual void PopulateParameterConfigurations(IParameterizedNamedItem parameterizedItem) {
    149       foreach (var childParameter in parameterizedItem.Parameters) {
    150         var pc = ParameterConfiguration.Create(parameterizedItem, childParameter);
    151         if (pc != null) this.parameterConfigurations.Add(pc);
    152       }
    153     }
    154     protected virtual void ClearParameterConfigurations() {
    155       parameterConfigurations.Clear();
    156     }
    157 
    158     private void RegisterRangeConstraintEvents() {
    159       if (this.RangeConstraint != null) this.RangeConstraint.ToStringChanged += new EventHandler(RangeConstraint_ToStringChanged);
    160     }
    161     private void DeregisterRangeConstraintEvents() {
    162       if (this.RangeConstraint != null) this.RangeConstraint.ToStringChanged -= new EventHandler(RangeConstraint_ToStringChanged);
    163     }
    16494    private void RegisterActualValueEvents() {
    16595      if (this.actualValue != null) this.actualValue.ToStringChanged += new EventHandler(actualValue_ToStringChanged);
     
    170100
    171101    #region Events
    172     void actualValue_ToStringChanged(object sender, EventArgs e) {
    173       OnToStringChanged();
    174     }
    175     void RangeConstraint_ToStringChanged(object sender, EventArgs e) {
     102    private void actualValue_ToStringChanged(object sender, EventArgs e) {
    176103      OnToStringChanged();
    177104    }
     
    212139    #endregion
    213140
    214     public override string ToString() {
    215       if (ActualValue != null && ActualValue.Value != null) {
    216         string name = NumberedName;
    217 
    218         if (ActualValue.Value is IParameterizedItem) {
    219           if (Optimize) {
    220             return string.Format("{0} (Optimize)", name);
    221           } else {
    222             return string.Format("{0}", name);
    223           }
    224         } else {
    225           if (Optimize) {
    226             return string.Format("{0} (Optimize: {1})", name, RangeConstraint);
    227           } else {
    228             return string.Format("{0}: {1}", name, ActualValue.Value);
    229           }
    230         }
    231       } else {
    232         return base.ToString();
    233       }
    234     }
    235 
    236141    public string NumberedName {
    237142      get {
     
    244149    }
    245150
    246     public string ParameterInfoString {
    247       get {
    248         StringBuilder sb = new StringBuilder();
    249         if (this.Optimize && this.ParameterConfigurations.Count > 0) {
    250           var parameterInfos = new List<string>();
    251           foreach (var pc in this.ParameterConfigurations) {
    252             if (pc.Optimize) parameterInfos.Add(pc.ParameterInfoString);
    253           }
    254           sb.Append(string.Join(", ", parameterInfos.ToArray()));
    255         }
    256         return sb.ToString();
    257       }
    258     }
    259 
    260     public virtual void Parameterize(IParameterizedItem item) {
    261       foreach (IParameterConfiguration pc in this.ParameterConfigurations) {
    262         pc.Parameterize((IValueParameter)item.Parameters[pc.ParameterName]);
    263       }
    264     }
    265 
    266     public void Randomize(IRandom random) {
    267       if (Optimize) {
    268         if (rangeConstraint != null) {
    269           this.actualValue.Value = rangeConstraint.GetRandomValue(random);
    270         } else {
    271           foreach (IParameterConfiguration pc in this.ParameterConfigurations) {
    272             pc.Randomize(random);
    273           }
    274         }
    275       }
    276     }
    277 
    278     public void Mutate(IRandom random, MutateDelegate mutate, IIntValueManipulator intValueManipulator, IDoubleValueManipulator doubleValueManipulator) {
    279       if (Optimize) {
    280         if (rangeConstraint != null) {
    281           mutate(random, this, intValueManipulator, doubleValueManipulator);
    282         } else {
    283           foreach (IParameterConfiguration pc in this.ParameterConfigurations) {
    284             pc.Mutate(random, mutate, intValueManipulator, doubleValueManipulator);
    285           }
    286         }
    287       }
    288     }
    289 
    290     public void Cross(IRandom random, IOptimizable other, CrossDelegate cross, IIntValueCrossover intValueCrossover, IDoubleValueCrossover doubleValueCrossover) {
    291       if (Optimize) {
    292         if (rangeConstraint != null) {
    293           cross(random, this, other, intValueCrossover, doubleValueCrossover);
    294         } else {
    295           IValueConfiguration otherVc = (IValueConfiguration)other;
    296           for (int i = 0; i < this.ParameterConfigurations.Count; i++) {
    297             this.ParameterConfigurations.ElementAt(i).Cross(random, otherVc.ParameterConfigurations.ElementAt(i), cross, intValueCrossover, doubleValueCrossover);
    298           }
    299         }
    300       }
    301     }
    302 
    303     public List<IOptimizable> GetAllOptimizables() {
    304       var list = new List<IOptimizable>();
    305       foreach (var pc in ParameterConfigurations) {
    306         if (pc.Optimize) {
    307           if (pc.ValueConfigurations.CheckedItems.Count() > 1) list.Add(pc); // only add if there are more than 1 choices. otherwise it makes no sense to optimize which VC is selected
    308           list.AddRange(pc.GetAllOptimizables());
    309         }
    310       }
    311       return list;
    312     }
    313 
    314     public void CollectOptimizedParameterNames(List<string> parameterNames, string prefix) {
    315       foreach (var pc in ParameterConfigurations) {
    316         if (pc.Optimize) {
    317           parameterNames.Add(prefix + pc.ParameterName);
    318           pc.CollectOptimizedParameterNames(parameterNames, prefix + pc.ParameterName + ".");
    319         }
    320       }
    321     }
    322 
    323     public IEnumerable<string> GetOptimizedParameterNames() {
    324       var list = new List<string>();
    325       this.CollectOptimizedParameterNames(list, "");
    326       return list;
    327     }
    328 
    329     public double CalculateSimilarity(IOptimizable optimizable) {
    330       var other = (IValueConfiguration)optimizable;
    331       if (rangeConstraint != null) {
    332         return this.RangeConstraint.CalculateSimilarity(this.ActualValue.Value, other.ActualValue.Value);
    333       } else {
    334         double sum = 0;
    335         int count = 0;
    336         for (int i = 0; i < ParameterConfigurations.Count; i++) {
    337           if (this.ParameterConfigurations.ElementAt(i).Optimize) {
    338             sum += this.ParameterConfigurations.ElementAt(i).CalculateSimilarity(other.ParameterConfigurations.ElementAt(i));
    339             count++;
    340           }
    341         }
    342         return count == 0 ? 1.0 : sum / (double)count;
    343       }
    344     }
     151    public abstract void Randomize(IRandom random);
     152    public abstract void Mutate(IRandom random, MutateDelegate mutate, IIntValueManipulator intValueManipulator, IDoubleValueManipulator doubleValueManipulator);
     153    public abstract void Cross(IRandom random, IOptimizable other, CrossDelegate cross, IIntValueCrossover intValueCrossover, IDoubleValueCrossover doubleValueCrossover);
     154    public abstract double CalculateSimilarity(IOptimizable optimizable);
     155    public abstract string ParameterInfoString { get; }
     156    public abstract void CollectOptimizedParameterNames(List<string> parameterNames, string prefix);
     157    public abstract List<IOptimizable> GetAllOptimizables();
    345158  }
    346159}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj

    r5576 r5653  
    143143    <Compile Include="Analyzers\PMOPopulationDiversityAnalyzer.cs" />
    144144    <Compile Include="ConstrainedTypeValue.cs" />
     145    <Compile Include="Encoding\ValueConfigurations\RangeValueConfiguration.cs" />
     146    <Compile Include="Encoding\ValueConfigurations\ParameterizedValueConfiguration.cs" />
     147    <Compile Include="Evaluators\AlgorithmEvaluator.cs" />
     148    <Compile Include="Evaluators\AlgorithmRunsAnalyzer.cs" />
     149    <Compile Include="Evaluators\AlgorithmSubScopesCreator.cs" />
     150    <Compile Include="Evaluators\PMOEvaluator.cs" />
    145151    <Compile Include="MetaOptimizationUtil.cs" />
    146152    <Compile Include="Operators\Crossovers\MultiIntValueCrossover.cs" />
     
    167173    <Compile Include="Encoding\ValueConfigurations\ValueConfiguration.cs" />
    168174    <Compile Include="Encoding\ValueConfigurations\CheckedValueConfigurationCollection.cs" />
    169     <Compile Include="Evaluators\AlgorithmExecutor.cs" />
     175    <Compile Include="AlgorithmExecutor.cs" />
    170176    <Compile Include="Interfaces\IParameterConfigurationCrossover.cs" />
    171177    <Compile Include="Interfaces\ICheckedValueConfigurationCollection.cs" />
     
    185191    <Compile Include="Interfaces\IParameterConfigurationOperator.cs" />
    186192    <Compile Include="Interfaces\IRange.cs" />
    187     <Compile Include="Evaluators\ParameterConfigurationEvaluator.cs" />
    188193    <Compile Include="Interfaces\IParameterConfigurationEvaluator.cs" />
    189194    <Compile Include="Interfaces\IParameterConfiguration.cs" />
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IOptimizable.cs

    r5522 r5653  
    11using System;
    22using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    53using HeuristicLab.Core;
    6 using HeuristicLab.Common;
    74
    85namespace HeuristicLab.Problems.MetaOptimization {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IValueConfiguration.cs

    r5359 r5653  
    11using System;
    22using HeuristicLab.Core;
    3 using HeuristicLab.Data;
    4 using System.Collections.Generic;
    53
    64namespace HeuristicLab.Problems.MetaOptimization {
    75  public interface IValueConfiguration : IOptimizable, IItem {
    8     IItemCollection<IParameterConfiguration> ParameterConfigurations { get; }
    9     IRange RangeConstraint { get; }
    106    int Number { get; set; } // if larger than 0 it will be visible in the name. this can be used when multiple ValueConfiguration with the same name exist in a list
    117    string NumberedName { get; }
     
    139    event EventHandler ValueChanged;
    1410   
    15     void Parameterize(IParameterizedItem item);
     11    //void Parameterize(IParameterizedItem item);
    1612  }
    1713}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs

    r5576 r5653  
    137137      Maximization = new BoolValue(false);
    138138      SolutionCreator = new RandomParameterConfigurationCreator();
    139       Evaluator = new ParameterConfigurationEvaluator();
     139      Evaluator = new PMOEvaluator();
    140140
    141141      InitializeOperators();
     
    186186    }
    187187    private void ParameterizeEvaluator() {
    188       ((ParameterConfigurationEvaluator)Evaluator).ParameterConfigurationParameter.ActualName = ((RandomParameterConfigurationCreator)SolutionCreator).ParameterConfigurationParameter.ActualName;
     188      ((PMOEvaluator)Evaluator).ParameterConfigurationParameter.ActualName = ((RandomParameterConfigurationCreator)SolutionCreator).ParameterConfigurationParameter.ActualName;
    189189    }
    190190    private void ParameterizeAnalyzer() {
     
    246246      IAlgorithm instance = (IAlgorithm)Activator.CreateInstance(AlgorithmType.Value);
    247247      this.ProblemType.ValidTypes = ApplicationManager.Manager.GetTypes(instance.ProblemType, true).ToList();
    248       this.ProblemType.Value = this.ProblemType.ValidTypes.Where(t => t != typeof(MetaOptimizationProblem)).FirstOrDefault();
     248      this.ProblemType.Value = this.ProblemType.ValidTypes.SingleOrDefault(t => t == typeof(SingleObjectiveTestFunctionProblem)) ?? this.ProblemType.ValidTypes.Where(t => t != typeof(MetaOptimizationProblem)).FirstOrDefault();
    249249      if (ProblemType.Value != null) {
    250250        ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(CreateAlgorithm(AlgorithmType.Value, ProblemType.Value));
     251        Problems.Add((IProblem)Activator.CreateInstance(this.ProblemType.Value));
    251252      } else {
    252253        ParameterConfigurationTreeParameter.ActualValue = null;
Note: See TracChangeset for help on using the changeset viewer.