Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/17/11 11:03:48 (14 years ago)
Author:
cneumuel
Message:

#1215

  • fixed import of existing algorithm
  • moved operators in subfolders
  • extended tests for SymbolicExpressionGrammar
Location:
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3
Files:
17 added
12 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/Crossovers/ParameterConfigurationCrossover.cs

    r5653 r6017  
    1 using HeuristicLab.Common;
     1using System;
     2using HeuristicLab.Common;
    23using HeuristicLab.Core;
    34using HeuristicLab.Data;
    45using HeuristicLab.Encodings.IntegerVectorEncoding;
    5 using HeuristicLab.Encodings.RealVectorEncoding;
    66using HeuristicLab.Operators;
    7 using HeuristicLab.Optimization;
    87using HeuristicLab.Parameters;
    98using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    10 using System;
    119
    1210namespace HeuristicLab.Problems.MetaOptimization {
     
    9694    }
    9795
    98     private static void Cross(IRandom random, IOptimizable configuartion, IOptimizable other, IIntValueCrossover intValueCrossover, IDoubleValueCrossover doubleValueCrossover) {
    99       var vc = configuartion as RangeValueConfiguration;
    100       var pc = configuartion as IParameterConfiguration;
     96    public static void Cross(IRandom random, IOptimizable configuration, IOptimizable other, IIntValueCrossover intValueCrossover, IDoubleValueCrossover doubleValueCrossover) {
     97      var vc = configuration as RangeValueConfiguration;
     98      var pc = configuration as IParameterConfiguration;
    10199      if (vc != null) {
    102100        var value = vc.ActualValue.Value;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/Manipulators/ParameterConfigurationManipulator.cs

    r5653 r6017  
    5151    }
    5252
    53     protected static void Mutate(IRandom random, IOptimizable configuration, IIntValueManipulator intValueManipulator, IDoubleValueManipulator doubleValueManipulator) {
     53    public static void Mutate(IRandom random, IOptimizable configuration, IIntValueManipulator intValueManipulator, IDoubleValueManipulator doubleValueManipulator) {
    5454      var vc = configuration as RangeValueConfiguration;
    5555      var pc = configuration as IParameterConfiguration;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs

    r5927 r6017  
    138138    protected IItemSet<IItem> validValues;
    139139
     140    [Storable]
     141    private bool autoPopulateValueConfigurations = true;
     142    public bool AutoPopulateValueConfigurations {
     143      get { return autoPopulateValueConfigurations; }
     144      set { autoPopulateValueConfigurations = value; }
     145    }
     146   
     147
    140148    #region Constructors and Cloning
    141149    public ParameterConfiguration(string parameterName, IValueParameter valueParameter, bool discoverValidValues) {
     150      this.AutoPopulateValueConfigurations = true;
    142151      this.ParameterName = parameterName;
    143152      this.parameterDataType = valueParameter.GetType();
     
    162171    }
    163172    public ParameterConfiguration(string parameterName, Type type, IItem actualValue, IEnumerable<IValueConfiguration> valueConfigurations) {
     173      this.AutoPopulateValueConfigurations = false;
    164174      this.ParameterName = parameterName;
    165175      this.parameterDataType = type;
     
    174184    }
    175185    public ParameterConfiguration(string parameterName, Type type, IItem actualValue) {
     186      this.AutoPopulateValueConfigurations = true;
    176187      this.ParameterName = parameterName;
    177188      this.parameterDataType = type;
     
    206217      this.discoverValidValues = original.discoverValidValues;
    207218      if (this.valueConfigurations != null) RegisterValueConfigurationEvents();
     219      this.AutoPopulateValueConfigurations = original.AutoPopulateValueConfigurations;
    208220    }
    209221
     
    238250
    239251    protected virtual void PopulateValueConfigurations() {
     252      if (!this.AutoPopulateValueConfigurations)
     253        return;
     254
    240255      foreach (Type t in this.validTypes) {
    241256        if (t == typeof(NullValue)) {
     
    266281
    267282    protected virtual void ClearValueConfigurations() {
     283      if (!this.AutoPopulateValueConfigurations)
     284        return;
     285
    268286      this.ValueConfigurations.Clear();
    269287    }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/AlgorithmEvaluator.cs

    r5655 r6017  
    11using System;
    22using System.Diagnostics;
     3using System.Linq;
    34using HeuristicLab.Common;
    45using HeuristicLab.Core;
    56using HeuristicLab.Data;
     7using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    68using HeuristicLab.Operators;
    79using HeuristicLab.Optimization;
    810using HeuristicLab.Parameters;
    911using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     12using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
    1013
    1114namespace HeuristicLab.Problems.MetaOptimization {
     
    5457      IAlgorithm algorithm = AlgorithmParameter.ActualValue;
    5558
     59      #region Debug Code for SymbolicRegressionGrammar
     60      var srp = (SymbolicRegressionSingleObjectiveProblem)algorithm.Problem;
     61      //Console.WriteLine("Evaluating Grammar: " + PrintGrammar(srp.SymbolicExpressionTreeGrammar));
     62      #endregion
     63
    5664      var sw = new Stopwatch();
    5765      sw.Start();
    5866      algorithm.StartSync();
    5967      sw.Stop();
    60       Console.WriteLine("{0},{1}: {2}", ProblemIndexParameter.ActualValue.Value, RepetitionIndexParameter.ActualValue.Value, sw.Elapsed);
     68      Console.WriteLine("{0},{1}: {2} (Grammar: {3})", ProblemIndexParameter.ActualValue.Value, RepetitionIndexParameter.ActualValue.Value, sw.Elapsed, PrintGrammar(srp.SymbolicExpressionTreeGrammar));
    6169
    6270      RunsParameter.Value = new ItemList<IRun>(algorithm.Runs);
     
    7280      parameterConfiguration.Randomize(random);
    7381    }
     82
     83    // for debug purposes, remove later
     84    private static string PrintGrammar(ISymbolicExpressionGrammar grammar) {
     85      return string.Join(string.Empty, grammar.Symbols.Select(x => x.InitialFrequency).ToArray());
     86      //foreach (var symbol in grammar.Symbols) {
     87      //  Console.WriteLine("{0} ({1})", symbol.ToString(), symbol.InitialFrequency);
     88      //}
     89    }
    7490  }
    7591}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj

    r5927 r6017  
    126126      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath>
    127127    </Reference>
     128    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4">
     129      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll</HintPath>
     130    </Reference>
    128131    <Reference Include="HeuristicLab.Problems.TestFunctions-3.3">
    129132      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.TestFunctions-3.3.dll</HintPath>
     
    154157    <Compile Include="Encoding\AlgorithmProblemItem.cs" />
    155158    <Compile Include="Encoding\ParameterConfigurations\SingleValuedParameterConfiguration.cs" />
    156     <Compile Include="Encoding\SymbolicRegression\SymbolValueConfiguration.cs" />
    157     <Compile Include="Encoding\SymbolicRegression\SymbolicExpressionGrammarValueConfiguration.cs" />
     159    <Compile Include="Encoding\SymbolicExpressionGrammar\SymbolValueConfiguration.cs" />
     160    <Compile Include="Encoding\SymbolicExpressionGrammar\SymbolicExpressionGrammarValueConfiguration.cs" />
    158161    <Compile Include="Encoding\ValueConfigurations\RangeValueConfiguration.cs" />
    159162    <Compile Include="Encoding\ValueConfigurations\ParameterizedValueConfiguration.cs" />
     
    163166    <Compile Include="Evaluators\PMOEvaluator.cs" />
    164167    <Compile Include="MetaOptimizationUtil.cs" />
    165     <Compile Include="Operators\Crossovers\MultiIntValueCrossover.cs" />
     168    <Compile Include="Operators\Crossovers\IntValue\MultiIntValueCrossover.cs" />
    166169    <Compile Include="TypeValue.cs" />
    167170    <None Include="Properties\AssemblyInfo.cs.frame" />
     
    189192    <Compile Include="Interfaces\IParameterConfigurationCrossover.cs" />
    190193    <Compile Include="Interfaces\ICheckedValueConfigurationCollection.cs" />
    191     <Compile Include="Operators\Crossovers\AverageDoubleValueCrossover.cs" />
    192     <Compile Include="Operators\Crossovers\AverageIntValueCrossover.cs" />
    193     <Compile Include="Operators\Crossovers\NormalIntValueCrossover.cs" />
    194     <Compile Include="Operators\Crossovers\NormalDoubleValueCrossover.cs" />
    195     <Compile Include="Operators\Crossovers\DiscreteDoubleValueCrossover.cs" />
    196     <Compile Include="Operators\Crossovers\DiscreteIntValueCrossover.cs" />
     194    <Compile Include="Operators\Crossovers\DoubleValue\AverageDoubleValueCrossover.cs" />
     195    <Compile Include="Operators\Crossovers\IntValue\AverageIntValueCrossover.cs" />
     196    <Compile Include="Operators\Crossovers\IntValue\NormalIntValueCrossover.cs" />
     197    <Compile Include="Operators\Crossovers\DoubleValue\NormalDoubleValueCrossover.cs" />
     198    <Compile Include="Operators\Crossovers\DoubleValue\DiscreteDoubleValueCrossover.cs" />
     199    <Compile Include="Operators\Crossovers\IntValue\DiscreteIntValueCrossover.cs" />
    197200    <Compile Include="Operators\Interfaces\IDoubleValueCrossover.cs" />
    198201    <Compile Include="Operators\Interfaces\IDoubleValueManipulator.cs" />
     
    213216    <Compile Include="Operators\Interfaces\IIntValueCrossover.cs" />
    214217    <Compile Include="Operators\Interfaces\IValueManipulator.cs" />
    215     <Compile Include="Operators\Manipulators\NormalIntValueManipulator.cs" />
    216     <Compile Include="Operators\Manipulators\UniformIntValueManipulator.cs" />
    217     <Compile Include="Operators\Manipulators\UniformDoubleValueManipulator.cs" />
    218     <Compile Include="Operators\Manipulators\NormalDoubleValueManipulator.cs" />
     218    <Compile Include="Operators\Manipulators\IntValue\NormalIntValueManipulator.cs" />
     219    <Compile Include="Operators\Manipulators\IntValue\UniformIntValueManipulator.cs" />
     220    <Compile Include="Operators\Manipulators\DoubleValue\UniformDoubleValueManipulator.cs" />
     221    <Compile Include="Operators\Manipulators\DoubleValue\NormalDoubleValueManipulator.cs" />
    219222    <Compile Include="Properties\AssemblyInfo.cs" />
    220223    <Compile Include="MetaOptimizationProblem.cs" />
     
    225228    <None Include="UpdateLocalInstallation.cmd" />
    226229  </ItemGroup>
    227   <ItemGroup />
     230  <ItemGroup>
     231    <Folder Include="Operators\Crossovers\SymbolicExpressionGrammar\" />
     232  </ItemGroup>
    228233  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    229234  <PropertyGroup>
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs

    r5927 r6017  
    309309      }
    310310      ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(algorithm, Problems.First());
    311      
    312311    }
    313312  }
Note: See TracChangeset for help on using the changeset viewer.