Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/01/11 17:15:41 (14 years ago)
Author:
cneumuel
Message:

#1215

  • worked on configurability of SymbolicExpressionGrammar
Location:
branches/HeuristicLab.MetaOptimization
Files:
3 added
15 edited

Legend:

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

    r5522 r5927  
    5353      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.ALGLIB-3.1.0.dll</HintPath>
    5454    </Reference>
    55     <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.3">
    56       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.DataAnalysis-3.3.dll</HintPath>
    57     </Reference>
    58     <Reference Include="HeuristicLab.Algorithms.DataAnalysis.Views-3.3">
    59       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.DataAnalysis.Views-3.3.dll</HintPath>
     55    <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.4">
     56      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.DataAnalysis-3.4.dll</HintPath>
     57    </Reference>
     58    <Reference Include="HeuristicLab.Algorithms.DataAnalysis.Views-3.4">
     59      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.DataAnalysis.Views-3.4.dll</HintPath>
    6060    </Reference>
    6161    <Reference Include="HeuristicLab.Algorithms.EvolutionStrategy-3.3">
     
    6868      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.LocalSearch-3.3.dll</HintPath>
    6969    </Reference>
     70    <Reference Include="HeuristicLab.Algorithms.NSGA2-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     71      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.NSGA2-3.3.dll</HintPath>
     72    </Reference>
    7073    <Reference Include="HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3">
    7174      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.dll</HintPath>
    7275    </Reference>
     76    <Reference Include="HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     77      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3.dll</HintPath>
     78    </Reference>
    7379    <Reference Include="HeuristicLab.Algorithms.SimulatedAnnealing-3.3">
    7480      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.SimulatedAnnealing-3.3.dll</HintPath>
     
    7783      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.TabuSearch-3.3.dll</HintPath>
    7884    </Reference>
     85    <Reference Include="HeuristicLab.Algorithms.VariableNeighborhoodSearch-3.3">
     86      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.VariableNeighborhoodSearch-3.3.dll</HintPath>
     87    </Reference>
    7988    <Reference Include="HeuristicLab.Analysis-3.3">
    8089      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Analysis-3.3.dll</HintPath>
     
    113122      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.DataAccess-3.3.dll</HintPath>
    114123    </Reference>
     124    <Reference Include="HeuristicLab.DebugEngine-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     125      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.DebugEngine-3.3.dll</HintPath>
     126    </Reference>
    115127    <Reference Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3">
    116128      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath>
     
    128140      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath>
    129141    </Reference>
    130     <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3">
    131       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.dll</HintPath>
    132     </Reference>
    133     <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3">
    134       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3.dll</HintPath>
     142    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
     143      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
     144    </Reference>
     145    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4">
     146      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.dll</HintPath>
    135147    </Reference>
    136148    <Reference Include="HeuristicLab.Hive.Contracts-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     
    236248      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
    237249    </Reference>
    238     <Reference Include="HeuristicLab.Problems.ArtificialAnt-3.3">
    239       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ArtificialAnt-3.3.dll</HintPath>
    240     </Reference>
    241     <Reference Include="HeuristicLab.Problems.ArtificialAnt.Views-3.3">
    242       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ArtificialAnt.Views-3.3.dll</HintPath>
    243     </Reference>
    244     <Reference Include="HeuristicLab.Problems.DataAnalysis-3.3">
    245       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis-3.3.dll</HintPath>
    246     </Reference>
    247     <Reference Include="HeuristicLab.Problems.DataAnalysis.Classification-3.3">
    248       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Classification-3.3.dll</HintPath>
    249     </Reference>
    250     <Reference Include="HeuristicLab.Problems.DataAnalysis.Classification.Views-3.3">
    251       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Classification.Views-3.3.dll</HintPath>
    252     </Reference>
    253     <Reference Include="HeuristicLab.Problems.DataAnalysis.Regression-3.3">
    254       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Regression-3.3.dll</HintPath>
    255     </Reference>
    256     <Reference Include="HeuristicLab.Problems.DataAnalysis.Views-3.3">
    257       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Views-3.3.dll</HintPath>
     250    <Reference Include="HeuristicLab.Problems.ArtificialAnt-3.4">
     251      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ArtificialAnt-3.4.dll</HintPath>
     252    </Reference>
     253    <Reference Include="HeuristicLab.Problems.ArtificialAnt.Views-3.4">
     254      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ArtificialAnt.Views-3.4.dll</HintPath>
     255    </Reference>
     256    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4">
     257      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
     258    </Reference>
     259    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4">
     260      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath>
     261    </Reference>
     262    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4">
     263      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.dll</HintPath>
     264    </Reference>
     265    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4">
     266      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4.dll</HintPath>
     267    </Reference>
     268    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4">
     269      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll</HintPath>
     270    </Reference>
     271    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views-3.4">
     272      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views-3.4.dll</HintPath>
     273    </Reference>
     274    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4">
     275      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.dll</HintPath>
     276    </Reference>
     277    <Reference Include="HeuristicLab.Problems.DataAnalysis.Views-3.4">
     278      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Views-3.4.dll</HintPath>
    258279    </Reference>
    259280    <Reference Include="HeuristicLab.Problems.ExternalEvaluation-3.3">
    260281      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ExternalEvaluation-3.3.dll</HintPath>
    261282    </Reference>
    262     <Reference Include="HeuristicLab.Problems.ExternalEvaluation.GP-3.3">
    263       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ExternalEvaluation.GP-3.3.dll</HintPath>
     283    <Reference Include="HeuristicLab.Problems.ExternalEvaluation.GP-3.4">
     284      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ExternalEvaluation.GP-3.4.dll</HintPath>
    264285    </Reference>
    265286    <Reference Include="HeuristicLab.Problems.ExternalEvaluation.GP.Views-3.3">
     
    274295    <Reference Include="HeuristicLab.Problems.Knapsack.Views-3.3">
    275296      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.Knapsack.Views-3.3.dll</HintPath>
    276     </Reference>
    277     <Reference Include="HeuristicLab.Problems.MetaOptimization-3.3">
    278       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.MetaOptimization-3.3.dll</HintPath>
    279     </Reference>
    280     <Reference Include="HeuristicLab.Problems.MetaOptimization.Views-3.3">
    281       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.MetaOptimization.Views-3.3.dll</HintPath>
    282297    </Reference>
    283298    <Reference Include="HeuristicLab.Problems.OneMax-3.3">
     
    372387    <None Include="app.config" />
    373388  </ItemGroup>
     389  <ItemGroup>
     390    <ProjectReference Include="..\HeuristicLab.Problems.MetaOptimization.Views\3.3\HeuristicLab.Problems.MetaOptimization.Views-3.3.csproj">
     391      <Project>{59567338-A551-4386-8405-A8C0DF3E376D}</Project>
     392      <Name>HeuristicLab.Problems.MetaOptimization.Views-3.3</Name>
     393    </ProjectReference>
     394    <ProjectReference Include="..\HeuristicLab.Problems.MetaOptimization\3.3\HeuristicLab.Problems.MetaOptimization-3.3.csproj">
     395      <Project>{ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}</Project>
     396      <Name>HeuristicLab.Problems.MetaOptimization-3.3</Name>
     397    </ProjectReference>
     398  </ItemGroup>
    374399  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    375400  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.Test/Program.cs

    r5665 r5927  
    1414using HeuristicLab.Core;
    1515using HeuristicLab.Data;
     16using HeuristicLab.Encodings.RealVectorEncoding;
    1617using HeuristicLab.Hive.ExperimentManager;
    1718using HeuristicLab.Optimization;
     
    1920using HeuristicLab.PluginInfrastructure;
    2021using HeuristicLab.PluginInfrastructure.Manager;
     22using HeuristicLab.Problems.DataAnalysis.Symbolic;
     23using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
    2124using HeuristicLab.Problems.MetaOptimization;
    2225using HeuristicLab.Problems.TestFunctions;
     
    4649    //private static int baseAlgorithmMaxGenerations = 1000;
    4750
    48     private static int metaAlgorithmPopulationSize = 5;
     51    private static int metaAlgorithmPopulationSize = 10;
    4952    private static int metaAlgorithmMaxGenerations = 15;
    50     private static int metaProblemRepetitions = 2;
    51     private static int baseAlgorithmMaxGenerations = 5;
     53    private static int metaProblemRepetitions = 3;
     54    private static int baseAlgorithmMaxGenerations = 10;
    5255    private static double mutationProbability = 0.10;
    5356
     
    7477      //TestNormalCrossover();
    7578      //TestItemDictionary();
    76      
     79
     80      //TestSymbolicDataAnalysisGrammar(); return;
     81
    7782      MetaOptimizationProblem metaOptimizationProblem = new MetaOptimizationProblem();
    7883      metaOptimizationProblem.Repetitions = new IntValue(metaProblemRepetitions);
     
    9095      //Console.WriteLine("Press enter to start");
    9196      //Console.ReadLine();
    92       TestConfiguration(algorithmVc, new GeneticAlgorithm() { Problem = new SingleObjectiveTestFunctionProblem() });
     97      TestConfiguration(algorithmVc, typeof(GeneticAlgorithm), metaOptimizationProblem.Problems.First());
    9398
    9499      Console.WriteLine("Press enter to start");
     
    99104
    100105      Console.ReadLine();
     106    }
     107
     108    private void TestSymbolicDataAnalysisGrammar() {
     109      var random = new MersenneTwister();
     110
     111      var grammar1 = new TypeCoherentExpressionGrammar();
     112      var grammar2 = new TypeCoherentExpressionGrammar();
     113
     114      grammar2.Symbols.Single(x => x.Name == "Addition").InitialFrequency = 0.5;
     115
     116      Console.WriteLine("========== Grammar1: ==========");
     117      PrintGrammar(grammar1);
     118      Console.WriteLine("========== Grammar2: ==========");
     119      PrintGrammar(grammar2);
     120
     121
     122      RealVector v1 = GetInitialFrequenciesAsRealVector(grammar1);
     123      RealVector v2 = GetInitialFrequenciesAsRealVector(grammar2);
     124
     125      for (int i = 0; i < 10; i++) {
     126        RealVector v3 = DiscreteCrossover.Apply(random, new ItemArray<RealVector>(new List<RealVector> { v1, v2 }));
     127
     128        var grammar3 = new TypeCoherentExpressionGrammar();
     129        SetInitialFrequenciesFromRealVector(grammar3, v3);
     130
     131        Console.WriteLine("\n========== Crossed: ==========");
     132        PrintGrammar(grammar3);
     133      }
     134
     135    }
     136
     137    private static void PrintGrammar(TypeCoherentExpressionGrammar grammar) {
     138      foreach (var symbol in grammar.Symbols) {
     139        Console.WriteLine("{0} ({1})", symbol.ToString(), symbol.InitialFrequency);
     140      }
     141    }
     142
     143    private static RealVector GetInitialFrequenciesAsRealVector(TypeCoherentExpressionGrammar grammar) {
     144      var vector = new RealVector(grammar.Symbols.Count());
     145      for (int i = 0; i < grammar.Symbols.Count(); i++) {
     146        vector[i] = grammar.Symbols.ElementAt(i).InitialFrequency;
     147      }
     148      return vector;
     149    }
     150
     151    private static void SetInitialFrequenciesFromRealVector(TypeCoherentExpressionGrammar grammar, RealVector vector) {
     152      for (int i = 0; i < grammar.Symbols.Count(); i++) {
     153        grammar.Symbols.ElementAt(i).InitialFrequency = vector[i];
     154      }
    101155    }
    102156
     
    384438      // because creating ThreadLocal<T> takes all the runtime.
    385439      // when the algs are not stored in a list however this effect does not occur.
    386      
     440
    387441
    388442      for (int i = 0; i < 1000; i++) {
     
    557611    private static void TestTypeDiscovery() {
    558612      PluginLoader.pluginAssemblies.Any();
    559      
     613
    560614      var items = ApplicationManager.Manager.GetInstances(typeof(DoubleArray)).ToArray();
    561615
     
    638692    private static ParameterConfigurationTree SetupGAAlgorithm(Type baseLevelAlgorithmType, MetaOptimizationProblem metaOptimizationProblem) {
    639693      metaOptimizationProblem.AlgorithmType.Value = baseLevelAlgorithmType;
    640       metaOptimizationProblem.ProblemType.Value = typeof(SingleObjectiveTestFunctionProblem);
    641       ParameterConfigurationTree algorithmVc = metaOptimizationProblem.ParameterConfigurationTree;
    642       ((IntValue)algorithmVc.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "MaximumGenerations").ActualValue.Value).Value = baseAlgorithmMaxGenerations;
    643 
    644       metaOptimizationProblem.Problems.Clear();
    645       metaOptimizationProblem.Problems.Add(new HeuristicLab.Problems.TestFunctions.SingleObjectiveTestFunctionProblem() {
    646         Evaluator = new GriewankEvaluator(),
    647         ProblemSize = new IntValue(2)
    648       });
     694      //metaOptimizationProblem.Problems.Clear();
     695
     696      //metaOptimizationProblem.ProblemType.Value = typeof(SingleObjectiveTestFunctionProblem);
     697      //metaOptimizationProblem.Problems.Add(new HeuristicLab.Problems.TestFunctions.SingleObjectiveTestFunctionProblem() {
     698      //  Evaluator = new GriewankEvaluator(),
     699      //  ProblemSize = new IntValue(2)
     700      //});
    649701      //metaOptimizationProblem.Problems.Add(new HeuristicLab.Problems.TestFunctions.SingleObjectiveTestFunctionProblem() {
    650702      //  Evaluator = new GriewankEvaluator(),
     
    656708      //});
    657709
    658       ConfigurePopulationSize(algorithmVc, 15, 20, 1);
     710      metaOptimizationProblem.ProblemType.Value = typeof(SymbolicRegressionSingleObjectiveProblem);
     711     
     712      ParameterConfigurationTree algorithmVc = metaOptimizationProblem.ParameterConfigurationTree;
     713      ((IntValue)algorithmVc.AlgorithmConfiguration.ParameterConfigurations.Single(x => x.Name == "MaximumGenerations").ActualValue.Value).Value = baseAlgorithmMaxGenerations;
     714
     715      //ConfigurePopulationSize(algorithmVc, 15, 20, 1);
    659716      ConfigureMutationRate(algorithmVc, 0.0, 1.0, 0.01);
    660       //ConfigureMutationOperator(algorithmVc);
     717      ConfigureMutationOperator(algorithmVc);
    661718      //ConfigureElites(algorithmVc, 0, 8, 1);
    662719      //ConfigureSelectionOperator(algorithmVc, true);
     720
     721      ConfigureSymbolicExpressionGrammar(algorithmVc);
     722
    663723      return algorithmVc;
    664724    }
    665725
    666     private static void TestConfiguration(ParameterConfigurationTree algorithmVc, GeneticAlgorithm baseLevelAlgorithm) {
     726    private static void ConfigureSymbolicExpressionGrammar(ParameterConfigurationTree vc) {
     727      var pc = vc.ProblemConfiguration.ParameterConfigurations.Single(x => x.Name == "SymbolicExpressionTreeGrammar");
     728      pc.Optimize = true;
     729
     730      SymbolicExpressionGrammarValueConfiguration symbolicExpressionGrammarVc = null;
     731      foreach (var valconf in pc.ValueConfigurations) {
     732        if (valconf.ActualValue.Value.ItemName != "TypeCoherentExpressionGrammar") {
     733          pc.ValueConfigurations.SetItemCheckedState(valconf, false);
     734        } else {
     735          symbolicExpressionGrammarVc = valconf as SymbolicExpressionGrammarValueConfiguration;
     736        }
     737      }
     738      symbolicExpressionGrammarVc.Optimize = true;
     739
     740      var additionPc = symbolicExpressionGrammarVc.ParameterConfigurations.Single(x => x.Name == "Addition");
     741      additionPc.Optimize = true;
     742      var initialFrequencyVc = ((ParameterizedValueConfiguration)additionPc.ValueConfigurations.First()).ParameterConfigurations.Single(x => x.Name == "InitialFrequency");
     743      initialFrequencyVc.Optimize = true;
     744    }
     745
     746    private static void TestConfiguration(ParameterConfigurationTree algorithmVc, Type baseLevelAlgorithmType, IProblem problem) {
    667747      IRandom rand = new FastRandom(0);
     748      var baseLevelAlgorithm = (GeneticAlgorithm)MetaOptimizationUtil.CreateParameterizedAlgorithmInstance(algorithmVc, baseLevelAlgorithmType, problem);
     749
    668750      // set random values
    669751      for (int i = 0; i < 10; i++) {
     
    739821
    740822      // uncheck multiMutator to avoid Michalewicz issue
    741       var multiMutator = mutationOperator.ValueConfigurations.Where(x => x.ActualValue.Value != null && x.ActualValue.Value.ItemName.StartsWith("Multi")).SingleOrDefault();
    742       if (multiMutator != null) {
    743         mutationOperator.ValueConfigurations.SetItemCheckedState(multiMutator, false);
    744       }
     823      //var multiMutator = mutationOperator.ValueConfigurations.Where(x => x.ActualValue.Value != null && x.ActualValue.Value.ItemName.StartsWith("Multi")).SingleOrDefault();
     824      //if (multiMutator != null) {
     825      //  mutationOperator.ValueConfigurations.SetItemCheckedState(multiMutator, false);
     826      //}
    745827
    746828      // add another normal - don't do this with 'new', because ActualNames will not be set correctly. It should be copied from an existing one
     
    864946                var orderedRuns = rc.OrderBy(x => x.Results["AverageQualityNormalized"]);
    865947
    866                 TableBuilder tb = new TableBuilder("QNorm", "Qualities"/*, "PoSi"/* "MutRa", "Eli", "SelOp", "MutOp", "NrSelSubScopes"*/);
     948                TableBuilder tb = new TableBuilder("QNorm", "Qualities"/*, "PoSi"*/ ,"MutRa" /*,"Eli", "SelOp"*/, "MutOp"/*, "NrSelSubScopes"*/);
    867949                foreach (IRun run in orderedRuns) {
    868950                  //string selector;
     
    874956
    875957                  tb.AppendRow(
    876                     ((DoubleValue)run.Results["AverageQualityNormalized"]).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"),
    880                     //((IntValue)run.Parameters["Elites"]).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()
     958                    ((DoubleValue)run.Results["AverageQualityNormalized"]).Value.ToString("#0.0000")
     959                    ,((DoubleArray)run.Results["RunsAverageQualities"]).ToString()
     960                    //,((IntValue)run.Parameters["PopulationSize"]).Value.ToString()
     961                    ,((DoubleValue)run.Parameters["MutationProbability"]).Value.ToString("0.0000")
     962                    //,((IntValue)run.Parameters["Elites"]).Value.ToString()
     963                    //,Shorten(selector, 20)
     964                    ,Shorten(run.Parameters.ContainsKey("Mutator") ? run.Parameters["Mutator"].ToString() : "null", 40)
     965                    //,((ISelector)run.Parameters["Selector"]).NumberOfSelectedSubScopesParameter.Value.ToString()
    884966                    );
    885967                }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/MetaOptimizationProblemView.Designer.cs

    r5313 r5927  
    3131      //
    3232      this.parameterCollectionView.AllowDrop = true;
    33       this.parameterCollectionView.Size = new System.Drawing.Size(604, 353);
     33      this.parameterCollectionView.Size = new System.Drawing.Size(604, 373);
    3434      this.parameterCollectionView.DragDrop += new System.Windows.Forms.DragEventHandler(this.parameterCollectionView_DragDrop);
    3535      this.parameterCollectionView.DragEnter += new System.Windows.Forms.DragEventHandler(this.parameterCollectionView_DragEnterOver);
     
    4040      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    4141      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    42       this.nameTextBox.Size = new System.Drawing.Size(532, 20);
    43       //
    44       // descriptionTextBox
    45       //
    46       this.descriptionTextBox.Size = new System.Drawing.Size(532, 20);
     42      this.nameTextBox.Size = new System.Drawing.Size(542, 20);
    4743      //
    4844      // createExperimentButton
     
    5046      this.createExperimentButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
    5147                  | System.Windows.Forms.AnchorStyles.Right)));
    52       this.createExperimentButton.Location = new System.Drawing.Point(0, 411);
     48      this.createExperimentButton.Location = new System.Drawing.Point(0, 405);
    5349      this.createExperimentButton.Name = "createExperimentButton";
    5450      this.createExperimentButton.Size = new System.Drawing.Size(604, 24);
     
    6460      this.Controls.Add(this.createExperimentButton);
    6561      this.Name = "MetaOptimizationProblemView";
    66       this.Size = new System.Drawing.Size(604, 437);
     62      this.Size = new System.Drawing.Size(604, 431);
    6763      this.Controls.SetChildIndex(this.createExperimentButton, 0);
     64      this.Controls.SetChildIndex(this.infoLabel, 0);
    6865      this.Controls.SetChildIndex(this.nameTextBox, 0);
    6966      this.Controls.SetChildIndex(this.nameLabel, 0);
    70       this.Controls.SetChildIndex(this.descriptionLabel, 0);
    71       this.Controls.SetChildIndex(this.descriptionTextBox, 0);
    7267      this.Controls.SetChildIndex(this.parameterCollectionView, 0);
    7368      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/MetaOptimizationProblemView.resx

    r5313 r5927  
    121121    <value>107, 17</value>
    122122  </metadata>
    123   <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    124     <value>107, 17</value>
    125   </metadata>
    126123  <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    127124    <value>17, 17</value>
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/OptimizableView.cs

    r5665 r5927  
    6868              this.viewHost.Content = pvc.ParameterConfigurations;
    6969            }
     70
     71            //var symbolicVc = Content as SymbolicExpressionGrammarValueConfiguration;
     72            //if (symbolicVc != null) {
     73            //  this.viewHost.ViewsLabelVisible = false;
     74            //  this.viewHost.Content = symbolicVc.ParameterConfigurations;
     75            //}
    7076          } else {
    7177            throw new NotSupportedException("Only IParameterConfiguration and IValueConfiguration types are allowed.");
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurationTree.cs

    r5665 r5927  
    208208      ProblemConfiguration.Parameterize(problem);
    209209
    210       //((IAlgorithm)AlgorithmConfiguration.ActualValue.Value).CollectParameterValues(this.Parameters);
     210      algorithm.CollectParameterValues(this.Parameters);
    211211      //((IProblem)ProblemConfiguration.ActualValue.Value).CollectParameterValues(this.Parameters);
    212     }
     212      //CollectAlgorithmParameterValues((IAlgorithm)AlgorithmConfiguration.ActualValue.Value, parameters);
     213    }
     214
     215    //protected virtual void CollectAlgorithmParameterValues(IAlgorithm algorithm, IDictionary<string, IItem> values) {
     216    //  var algorithmValues = new Dictionary<string, IItem>();
     217    //  algorithm.CollectParameterValues(algorithmValues);
     218    //  foreach (var value in algorithmValues) {
     219    //    values.Add("Algorithm." + value.Key, value.Value);
     220    //  }
     221    //}
    213222
    214223    public Experiment GenerateExperiment(IAlgorithm algorithm, bool createBatchRuns, int repetitions) {
     
    297306      }
    298307    }
     308
     309    public override void CollectOptimizedParameterNames(List<string> parameterNames, string prefix) {
     310      AlgorithmConfiguration.CollectOptimizedParameterNames(parameterNames, string.Empty);
     311      ProblemConfiguration.CollectOptimizedParameterNames(parameterNames, string.Empty);
     312    }
     313
     314   
    299315  }
    300316}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs

    r5665 r5927  
    99using HeuristicLab.Core;
    1010using HeuristicLab.Data;
     11using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    1112using HeuristicLab.Parameters;
    1213using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    2526    [Storable]
    2627    protected bool optimize;
    27     public bool Optimize {
     28    public virtual bool Optimize {
    2829      get { return optimize; }
    2930      set {
     
    3334            PopulateValueConfigurations();
    3435          } else {
    35             this.ValueConfigurations.Clear();
     36            ClearValueConfigurations();
    3637          }
    3738          OnOptimizeChanged();
     
    4243
    4344    [Storable]
    44     private Image itemImage;
    45     public virtual Image ItemImage {
     45    protected Image itemImage;
     46    public override Image ItemImage {
    4647      get { return itemImage ?? base.ItemImage; }
    4748    }
     
    160161      }
    161162    }
    162 
     163    public ParameterConfiguration(string parameterName, Type type, IItem actualValue, IEnumerable<IValueConfiguration> valueConfigurations) {
     164      this.ParameterName = parameterName;
     165      this.parameterDataType = type;
     166      this.valueDataType = type;
     167      this.discoverValidValues = false;
     168      this.validValues = null; // maybe use values from valueConfigurations
     169      this.validTypes = new Type[] { type };
     170      this.IsNullable = false;
     171      this.itemImage = valueConfigurations.Count() > 0 ? valueConfigurations.FirstOrDefault().ItemImage : null;
     172      this.ValueConfigurations = new CheckedValueConfigurationList(valueConfigurations);
     173      this.ActualValue = new ConstrainedValue(actualValue, type, CreateValidValues(), this.IsNullable);
     174    }
     175    public ParameterConfiguration(string parameterName, Type type, IItem actualValue) {
     176      this.ParameterName = parameterName;
     177      this.parameterDataType = type;
     178      this.valueDataType = type;
     179      this.discoverValidValues = false;
     180      this.validValues = null;
     181      this.validTypes = new Type[] { type };
     182      this.IsNullable = false;
     183      this.itemImage = actualValue.ItemImage;
     184      this.ValueConfigurations = new CheckedValueConfigurationList();
     185      this.ActualValue = new ConstrainedValue(actualValue, type, CreateValidValues(), this.IsNullable);
     186      if (Optimize) {
     187        PopulateValueConfigurations();
     188      }
     189    }
    163190    public ParameterConfiguration() { }
    164191    [StorableConstructor]
     
    180207      if (this.valueConfigurations != null) RegisterValueConfigurationEvents();
    181208    }
     209
     210
    182211    public override IDeepCloneable Clone(Cloner cloner) {
    183212      return new ParameterConfiguration(this, cloner);
     
    208237    }
    209238
    210     private void PopulateValueConfigurations() {
     239    protected virtual void PopulateValueConfigurations() {
    211240      foreach (Type t in this.validTypes) {
    212241        if (t == typeof(NullValue)) {
     
    220249          }
    221250          if (val != null) { // val can be null when ValidValues does not contain the type (this can happen when discoverValidValues=false)
     251            IValueConfiguration valueConfiguration;
    222252            if (val is IParameterizedItem) {
    223               this.ValueConfigurations.Add(new ParameterizedValueConfiguration(val, val.GetType(), true), true);
     253              valueConfiguration = new ParameterizedValueConfiguration(val, val.GetType(), true);
    224254            } else {
    225               this.ValueConfigurations.Add(new RangeValueConfiguration(val, val.GetType()), true);
     255              if (val is ISymbolicExpressionGrammar) {
     256                valueConfiguration = new SymbolicExpressionGrammarValueConfiguration((ISymbolicExpressionGrammar)val);
     257              } else {
     258                valueConfiguration = new RangeValueConfiguration(val, val.GetType());
     259              }
    226260            }
    227           }
    228         }
    229       }
     261            this.ValueConfigurations.Add(valueConfiguration, true);
     262          }
     263        }
     264      }
     265    }
     266
     267    protected virtual void ClearValueConfigurations() {
     268      this.ValueConfigurations.Clear();
    230269    }
    231270
     
    260299    public IItem CreateItem(Type type) {
    261300      // no valid values; just instantiate
    262       if (validValues == null)
    263         return (IItem)Activator.CreateInstance(type);
     301      try {
     302        if (validValues == null)
     303          return (IItem)Activator.CreateInstance(type);
     304      }
     305      catch (MissingMemberException) {
     306        return null; // can happen, when ApplicationManager.Manager.GetTypes(type, OnlyInstantiable=true) returns objects which have no default constructor
     307      }
    264308
    265309      if (type == typeof(NullValue))
     
    279323        try {
    280324          var val = CreateItem(t);
    281           validValues.Add(val);
     325          if (val != null) validValues.Add(val);
    282326        }
    283327        catch (MissingMethodException) { /* Constructor is missing, don't use those types */ }
     
    415459
    416460    public void Parameterize(IValueParameter parameter) {
     461      if (parameter is IFixedValueParameter)
     462        return;
     463
    417464      if (Optimize) {
    418465        if (this.ActualValue.Value is IParameterizedItem) {
    419466          ((ParameterizedValueConfiguration)this.ValueConfigurations[actualValueConfigurationIndex]).Parameterize((IParameterizedItem)this.ActualValue.Value);
     467        }
     468        if (this.ActualValue.Value is ISymbolicExpressionGrammar) {
     469          ((SymbolicExpressionGrammarValueConfiguration)this.ValueConfigurations[actualValueConfigurationIndex]).Parameterize((ISymbolicExpressionGrammar)this.ActualValue.Value);
    420470        }
    421471      }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/SingleValuedParameterConfiguration.cs

    r5665 r5927  
    1 using System.Linq;
     1using System;
     2using System.Linq;
    23using HeuristicLab.Common;
    34using HeuristicLab.Core;
     
    1415      : base(parameterName, valueParameter, false) {
    1516      this.Optimize = true;
     17      base.PopulateValueConfigurations();
    1618      this.ValueConfigurations.Single().Optimize = true;
     19    }
     20    public SingleValuedParameterConfiguration(string parameterName, IValueConfiguration valueConfiguration) {
     21      this.ParameterName = parameterName;
     22      this.parameterDataType = valueConfiguration.ActualValue.ValueDataType;
     23      this.valueDataType = valueConfiguration.ActualValue.ValueDataType;
     24      this.discoverValidValues = false;
     25      this.validValues = new ItemSet<IItem> { valueConfiguration.ActualValue.Value };
     26      this.validTypes = new Type[] {valueConfiguration.ActualValue.ValueDataType};
     27      this.IsNullable = false;
     28      this.itemImage = valueConfiguration.ItemImage;
     29      this.ValueConfigurations = new CheckedValueConfigurationList { valueConfiguration };
     30      this.ValueConfigurations.Single().Optimize = true;
     31      valueConfiguration.ToStringChanged += new EventHandler(valueConfiguration_ToStringChanged);
     32      this.ActualValue = new ConstrainedValue(
     33        valueConfiguration.ActualValue.Value,
     34        valueConfiguration.ActualValue.ValueDataType,
     35        this.validValues,
     36        this.IsNullable);
    1737    }
    1838    public SingleValuedParameterConfiguration() { }
     
    2444    }
    2545    #endregion
     46
     47    protected override void PopulateValueConfigurations() {
     48      // don't change valueconfigurations, since it only contains the one element specified in constructor
     49    }
     50
     51    protected override void ClearValueConfigurations() {
     52      // do nothing
     53    }
     54
     55    public override string ToString() {
     56      if (this.valueConfigurations.First() is SymbolValueConfiguration) {
     57        var syVc = (SymbolValueConfiguration)this.valueConfigurations.First();
     58        if (this.Optimize) {
     59          return syVc.ToString() + " (Optimize)";
     60        } else {
     61          return syVc.ToString();
     62        }
     63      } else {
     64        return base.ToString();
     65      }
     66    }
     67
     68    private void valueConfiguration_ToStringChanged(object sender, EventArgs e) {
     69      OnToStringChanged();
     70    }
    2671  }
    2772}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/CheckedValueConfigurationCollection.cs

    r5361 r5927  
    1 using System;
    2 using System.Collections.Generic;
     1using System.Collections.Generic;
    32using System.Linq;
    4 using System.Text;
     3using HeuristicLab.Collections;
     4using HeuristicLab.Common;
    55using HeuristicLab.Core;
    6 using HeuristicLab.Common;
    76using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    8 using HeuristicLab.Collections;
    97
    108namespace HeuristicLab.Problems.MetaOptimization {
     
    2927      RegisterEvents();
    3028    }
     29    public CheckedValueConfigurationList(IEnumerable<IValueConfiguration> collection)
     30      : base(collection) {
     31      validValues = null;
     32      // event wiring not needed
     33    }
    3134    public CheckedValueConfigurationList() {
    3235      RegisterEvents();
     
    4346      RegisterEvents();
    4447    }
     48
    4549    public override IDeepCloneable Clone(Cloner cloner) {
    4650      return new CheckedValueConfigurationList(this, cloner);
     
    6165    }
    6266
    63     void CheckedValueConfigurationList_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IValueConfiguration>> e) {
     67    private void CheckedValueConfigurationList_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IValueConfiguration>> e) {
    6468      foreach (var item in e.Items) {
    6569        var matchingItems = this.Where(x => x != item.Value && x.ActualValue.ValueDataType == item.Value.ActualValue.ValueDataType);
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ParameterizedValueConfiguration.cs

    r5665 r5927  
    2020      get { return base.Optimize; }
    2121      set {
    22         base.Optimize = value;
    23         if (optimize) {
    24           ClearParameterConfigurations();
    25           if (this.actualValue.Value is IParameterizedNamedItem) PopulateParameterConfigurations(this.actualValue.Value as IParameterizedNamedItem, this.discoverValidValues);
    26         } else {
    27           ClearParameterConfigurations();
     22        if (this.optimize != value) {
     23          base.Optimize = value;
     24          if (optimize) {
     25            ClearParameterConfigurations();
     26            PopulateParameterConfigurations(this.actualValue.Value, this.discoverValidValues);
     27          } else {
     28            ClearParameterConfigurations();
     29          }
    2830        }
    2931      }
     
    3537        ClearParameterConfigurations();
    3638        base.ActualValue = value;
    37         if(this.actualValue.Value != null) PopulateParameterConfigurations(this.actualValue.Value as IParameterizedNamedItem, this.discoverValidValues);
     39        if (this.Optimize && this.actualValue.Value != null) PopulateParameterConfigurations(this.actualValue.Value, this.discoverValidValues);
    3840      }
    3941    }
     
    6668    #endregion
    6769
    68     protected virtual void PopulateParameterConfigurations(IParameterizedNamedItem parameterizedItem, bool discoverValidValues) {
    69       foreach (var childParameter in parameterizedItem.Parameters) {
    70         IValueParameter valueParameter = childParameter as IValueParameter;
    71         if (valueParameter != null) {
    72           var pc = new ParameterConfiguration(valueParameter.Name, valueParameter, discoverValidValues);
    73           this.parameterConfigurations.Add(pc);
     70    protected virtual void PopulateParameterConfigurations(IItem item, bool discoverValidValues) {
     71      var parameterizedItem = item as IParameterizedItem;
     72      if (parameterizedItem != null) {
     73        foreach (var childParameter in parameterizedItem.Parameters) {
     74          IValueParameter valueParameter = childParameter as IValueParameter;
     75          if (valueParameter != null) {
     76            var pc = new ParameterConfiguration(valueParameter.Name, valueParameter, discoverValidValues);
     77            this.parameterConfigurations.Add(pc);
     78          }
    7479        }
    7580      }
     
    126131    }
    127132
    128     public IEnumerable<string> GetOptimizedParameterNames() {
     133    public virtual IEnumerable<string> GetOptimizedParameterNames() {
    129134      var list = new List<string>();
    130       this.CollectOptimizedParameterNames(list, "");
     135      this.CollectOptimizedParameterNames(list, string.Empty);
    131136      return list;
    132137    }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ValueConfiguration.cs

    r5665 r5927  
    2020    [Storable]
    2121    protected bool isOptimizable;
    22     public bool IsOptimizable {
     22    public virtual bool IsOptimizable {
    2323      get { return isOptimizable; }
    2424      set {
     
    3636      set {
    3737        if (optimize != value) {
     38          if (value == true && !this.IsOptimizable)
     39            throw new NotSupportedException("This value is not optimizable.");
     40
    3841          optimize = value;
    3942          OnOptimizeChanged();
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/AlgorithmSubScopesCreator.cs

    r5665 r5927  
    5959        for (int j = 0; j < problems.Count; j++) {
    6060          IScope child = new Scope(string.Format("Problem {0}, Repetition {1}", j, i));
    61           var algorithm = (IAlgorithm)Activator.CreateInstance(algorithmType);
    62           algorithm.Problem = (IProblem)problems[j].Clone();
    63           ((EngineAlgorithm)algorithm).Engine = new SequentialEngine.SequentialEngine();
    64 
    65           //((GeneticAlgorithm)algorithm).PopulationSize.Value = 10;
    66           //((GeneticAlgorithm)algorithm).MaximumGenerations.Value = 10;
    67 
    68           parameterConfiguration.Parameterize(algorithm);
     61          var algorithm = MetaOptimizationUtil.CreateParameterizedAlgorithmInstance(parameterConfiguration, algorithmType, (IProblem)problems[j].Clone());
    6962          child.Variables.Add(new Variable("Algorithm", algorithm));
    7063          child.Variables.Add(new Variable("ProblemIndex", new IntValue(j)));
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj

    r5665 r5927  
    102102      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath>
    103103    </Reference>
     104    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
     105      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
     106    </Reference>
    104107    <Reference Include="HeuristicLab.Operators-3.3">
    105108      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Operators-3.3.dll</HintPath>
     
    117120      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
    118121    </Reference>
    119     <Reference Include="HeuristicLab.Problems.DataAnalysis-3.3">
    120       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis-3.3.dll</HintPath>
     122    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4">
     123      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
     124    </Reference>
     125    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4">
     126      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath>
    121127    </Reference>
    122128    <Reference Include="HeuristicLab.Problems.TestFunctions-3.3">
     
    148154    <Compile Include="Encoding\AlgorithmProblemItem.cs" />
    149155    <Compile Include="Encoding\ParameterConfigurations\SingleValuedParameterConfiguration.cs" />
     156    <Compile Include="Encoding\SymbolicRegression\SymbolValueConfiguration.cs" />
     157    <Compile Include="Encoding\SymbolicRegression\SymbolicExpressionGrammarValueConfiguration.cs" />
    150158    <Compile Include="Encoding\ValueConfigurations\RangeValueConfiguration.cs" />
    151159    <Compile Include="Encoding\ValueConfigurations\ParameterizedValueConfiguration.cs" />
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs

    r5665 r5927  
    3838  [Creatable("Problems")]
    3939  [StorableClass]
    40   public sealed class MetaOptimizationProblem : SingleObjectiveProblem<IParameterConfigurationEvaluator, IParameterConfigurationCreator>, IStorableContent {
     40  public sealed class MetaOptimizationProblem : SingleObjectiveHeuristicOptimizationProblem<IParameterConfigurationEvaluator, IParameterConfigurationCreator>, IStorableContent {
    4141    public string Filename { get; set; }
    42 
     42   
    4343    public const string AlgorithmTypeParameterName = "AlgorithmType";
    4444    public const string ProblemTypeParameterName = "ProblemType";
     
    272272
    273273        // special for DataAnalysisProblem: Because of wiring between algorithm and problem, ParameterConfigurationTree needs to be recreated on Reset event
    274         var dap = e.Items.Single().Value as DataAnalysisProblem;
     274        var dap = e.Items.Single().Value as IDataAnalysisProblem;
    275275        if (dap != null) {
    276276          dap.Reset += new EventHandler(DataAnalysisProblem_Reset);
     
    283283        ParameterConfigurationTreeParameter.ActualValue = null;
    284284
    285         var dap = e.Items.Single().Value as DataAnalysisProblem;
     285        var dap = e.Items.Single().Value as IDataAnalysisProblem;
    286286        if (dap != null) {
    287287          dap.Reset -= new EventHandler(DataAnalysisProblem_Reset);
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationUtil.cs

    r5359 r5927  
    11using System;
     2using System.Collections.Generic;
    23using System.Linq;
    3 using System.Threading;
    4 using HeuristicLab.Common;
    54using HeuristicLab.Core;
    65using HeuristicLab.Data;
    7 using HeuristicLab.Operators;
    86using HeuristicLab.Optimization;
    9 using HeuristicLab.Parameters;
    10 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    11 using System.Collections.Generic;
    12 using HeuristicLab.Algorithms.GeneticAlgorithm;
    13 using System.Threading.Tasks;
    14 using System.Diagnostics;
    15 using System.Reflection;
    167
    178namespace HeuristicLab.Problems.MetaOptimization {
     
    5243      return parameterConfigurationTree.AverageQualityNormalized.Value;
    5344    }
     45
     46    /// <summary>
     47    /// Creates a new instance of algorithmType, sets the given problem and parameterizes it with the given configuration
     48    /// </summary>
     49    public static IAlgorithm CreateParameterizedAlgorithmInstance(ParameterConfigurationTree parameterConfigurationTree, Type algorithmType, IProblem problem, bool randomize = false, IRandom random = null) {
     50      var algorithm = (IAlgorithm)Activator.CreateInstance(algorithmType);
     51      algorithm.Problem = problem;
     52      ((EngineAlgorithm)algorithm).Engine = new SequentialEngine.SequentialEngine();
     53      if(randomize) parameterConfigurationTree.Randomize(random);
     54      parameterConfigurationTree.Parameterize(algorithm);
     55      return algorithm;
     56    }
    5457  }
    5558}
Note: See TracChangeset for help on using the changeset viewer.