Changeset 3651


Ignore:
Timestamp:
05/05/10 19:50:46 (12 years ago)
Author:
gkronber
Message:

Implemented analyzers for symbolic expression tree encoding, artificial ant problem and symbolic regression problem. #999 (Refactor algorithm analysis and tracing)

Location:
trunk/sources
Files:
13 added
3 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj

    r3539 r3651  
    8383  </ItemGroup>
    8484  <ItemGroup>
     85    <Compile Include="Analyzers\PopulationMinAvgMaxTreeSizeAnalyzer.cs" />
     86    <Compile Include="Analyzers\SymbolicExpressionTreeSizeAnalyzer.cs" />
     87    <Compile Include="Analyzers\SymbolicExpressionTreeSizeCalculator.cs" />
    8588    <Compile Include="ArchitectureManipulators\ArgumentCreater.cs" />
    8689    <Compile Include="ArchitectureManipulators\ArgumentDeleter.cs" />
     
    9699    <Compile Include="Creators\SymbolicExpressionTreeCreator.cs" />
    97100    <Compile Include="Crossovers\SymbolicExpressionTreeCrossover.cs" />
     101    <Compile Include="Interfaces\ISymbolicExpressionTreeAnalyzer.cs" />
    98102    <Compile Include="Interfaces\ISymbolicExpressionTreeArchitectureManipulator.cs" />
    99103    <Compile Include="Interfaces\ISymbolicExpressionTreeCreator.cs" />
    100104    <Compile Include="Interfaces\ISymbolicExpressionTreeCrossover.cs" />
     105    <Compile Include="Interfaces\ISymbolicExpressionTreeMultiPopulationAnalyzer.cs" />
     106    <Compile Include="Interfaces\ISymbolicExpressionTreePopulationAnalyzer.cs" />
    101107    <Compile Include="Manipulators\ChangeNodeTypeManipulation.cs" />
    102108    <Compile Include="Interfaces\ISymbolicExpressionTreeManipulator.cs" />
     
    139145  </ItemGroup>
    140146  <ItemGroup>
     147    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
     148      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
     149      <Name>HeuristicLab.Analysis-3.3</Name>
     150    </ProjectReference>
    141151    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    142152      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs.frame

    r3384 r3651  
    2828  [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.3.0.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.Analysis", "3.3.0.0")]
    3031  [PluginDependency("HeuristicLab.Collections", "3.3.0.0")]
    3132  [PluginDependency("HeuristicLab.Common", "3.3.0.0")]
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblem.cs

    r3631 r3651  
    3838using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
    3939using HeuristicLab.Problems.ArtificialAnt.Analyzers;
     40using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers;
    4041
    4142namespace HeuristicLab.Problems.ArtificialAnt {
     
    299300      operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>().OfType<IOperator>());
    300301      operators.Add(new PopulationBestAntTrailAnalyzer());
     302      operators.Add(new PopulationMinAvgMaxTreeSizeAnalyzer());
    301303      ParameterizeAnalyzers();
    302304      ParameterizeOperators();
     
    320322        analyzer.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name;
    321323      }
     324      foreach (ISymbolicExpressionTreePopulationAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreePopulationAnalyzer>()) {
     325        analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     326      }
    322327    }
    323328
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/HeuristicLab.Problems.DataAnalysis.Regression-3.3.csproj

    r3532 r3651  
    8686    <Compile Include="HeuristicLabProblemsDataAnalysisRegressionPlugin.cs" />
    8787    <Compile Include="Properties\AssemblyInfo.cs" />
    88     <Compile Include="Symbolic\BestValidationSymbolicRegressionSolutionVisualizer.cs" />
     88    <Compile Include="Symbolic\Analyzers\PopulationSymbolicRegressionVariableFrequencyAnalyzer.cs" />
     89    <Compile Include="Symbolic\Analyzers\PopulationValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs" />
     90    <Compile Include="Symbolic\Analyzers\SymbolicRegressionSolutionLinearScaler.cs" />
     91    <Compile Include="Symbolic\Analyzers\ISymbolicRegressionSolutionPopulationAnalyzer.cs" />
     92    <Compile Include="Symbolic\Analyzers\PopulationBestSymbolicRegressionSolutionAnalyzer.cs" />
    8993    <Compile Include="Symbolic\SymbolicRegressionScaledMeanSquaredErrorEvaluator.cs" />
    9094    <Compile Include="Symbolic\SymbolicRegressionSolution.cs" />
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/HeuristicLabProblemsDataAnalysisRegressionPlugin.cs.frame

    r3384 r3651  
    2828  [Plugin("HeuristicLab.Problems.DataAnalysis.Regression","3.3.0.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Problems.DataAnalysis.Regression-3.3.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.Analysis", "3.3.0.0")]
    3031  [PluginDependency("HeuristicLab.Collections", "3.3.0.0")]
    3132  [PluginDependency("HeuristicLab.Common", "3.3")]
     
    3839  [PluginDependency("HeuristicLab.Parameters", "3.3.0.0")]
    3940  [PluginDependency("HeuristicLab.Persistence", "3.3.0.0")]
     41  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.3.0.0")]
     42  [PluginDependency("HeuristicLab.Random", "3.3.0.0")] 
    4043  public class HeuristicLabProblemsDataAnalysisRegressionPlugin : PluginBase {
    4144  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs

    r3616 r3651  
    3939using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
    4040using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
     41using HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers;
     42using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers;
    4143
    4244namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
     
    150152      get { return BestKnownQualityParameter.Value; }
    151153    }
    152     private List<ISymbolicExpressionTreeOperator> operators;
     154    private List<IOperator> operators;
    153155    public IEnumerable<IOperator> Operators {
    154       get { return operators.Cast<IOperator>(); }
     156      get { return operators; }
     157    }
     158    public IEnumerable<ISymbolicRegressionSolutionPopulationAnalyzer> Analyzers {
     159      get { return operators.OfType<ISymbolicRegressionSolutionPopulationAnalyzer>(); }
    155160    }
    156161    public DoubleValue PunishmentFactor {
     
    180185      var grammar = new ArithmeticExpressionGrammar();
    181186      var globalGrammar = new GlobalSymbolicExpressionGrammar(grammar);
    182       var visualizer = new BestValidationSymbolicRegressionSolutionVisualizer();
    183187      var interpreter = new SimpleArithmeticExpressionInterpreter();
    184188      Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the error of the regression model should be minimized.", (BoolValue)new BoolValue(false).AsReadOnly()));
     
    200204      ParameterizeSolutionCreator();
    201205      ParameterizeEvaluator();
    202       ParameterizeVisualizer();
    203206
    204207      UpdateGrammar();
     
    240243      // paritions could be changed
    241244      ParameterizeEvaluator();
    242       ParameterizeVisualizer();
     245      ParameterizeAnalyzers();
    243246      // input variables could have been changed
    244247      UpdateGrammar();
     
    260263    protected virtual void OnSolutionParameterNameChanged(EventArgs e) {
    261264      ParameterizeEvaluator();
    262       ParameterizeVisualizer();
     265      ParameterizeAnalyzers();
    263266      ParameterizeOperators();
    264267    }
     
    267270      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    268271      ParameterizeEvaluator();
    269       ParameterizeVisualizer();
     272      ParameterizeAnalyzers();
    270273      RaiseEvaluatorChanged(e);
    271274    }
    272275    protected virtual void OnQualityParameterNameChanged(EventArgs e) {
    273       ParameterizeVisualizer();
     276      ParameterizeAnalyzers();
    274277    }
    275278    #endregion
     
    345348
    346349    private void InitializeOperators() {
    347       operators = new List<ISymbolicExpressionTreeOperator>();
    348       operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>());
     350      operators = new List<IOperator>();
     351      operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>().OfType<IOperator>());
     352      operators.Add(new PopulationValidationBestScaledSymbolicRegressionSolutionAnalyzer());
     353      operators.Add(new PopulationMinAvgMaxTreeSizeAnalyzer());
     354      operators.Add(new PopulationSymbolicRegressionVariableFrequencyAnalyzer());
    349355      ParameterizeOperators();
     356      ParameterizeAnalyzers();
    350357    }
    351358
     
    365372    }
    366373
    367     private void ParameterizeVisualizer() {
    368       //var solutionVisualizer = Visualizer as BestValidationSymbolicRegressionSolutionVisualizer;
    369       //if (solutionVisualizer != null) {
    370       //  solutionVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    371       //  solutionVisualizer.DataAnalysisProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name;
    372       //  solutionVisualizer.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name;
    373       //  solutionVisualizer.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name;
    374       //  solutionVisualizer.QualityParameter.ActualName = Evaluator.QualityParameter.Name;
    375       //  solutionVisualizer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
    376       //  solutionVisualizer.ValidationSamplesStartParameter.Value = ValidationSamplesStart;
    377       //  solutionVisualizer.ValidationSamplesEndParameter.Value = ValidationSamplesEnd;
    378       //}
     374    private void ParameterizeAnalyzers() {
     375      foreach (var analyzer in Analyzers) {
     376        analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     377        var bestValidationSolutionAnalyzer = analyzer as PopulationValidationBestScaledSymbolicRegressionSolutionAnalyzer;
     378        if (bestValidationSolutionAnalyzer != null) {
     379          bestValidationSolutionAnalyzer.ProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name;
     380          bestValidationSolutionAnalyzer.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name;
     381          bestValidationSolutionAnalyzer.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name;
     382          bestValidationSolutionAnalyzer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
     383          bestValidationSolutionAnalyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     384          bestValidationSolutionAnalyzer.SamplesStartParameter.Value = ValidationSamplesStart;
     385          bestValidationSolutionAnalyzer.SamplesEndParameter.Value = ValidationSamplesEnd;
     386        }
     387        var varFreqAnalyzer = analyzer as PopulationSymbolicRegressionVariableFrequencyAnalyzer;
     388        if (varFreqAnalyzer != null) {
     389          varFreqAnalyzer.ProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name;
     390        }
     391      }
     392      foreach (ISymbolicExpressionTreePopulationAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreePopulationAnalyzer>()) {
     393        analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     394      }
    379395    }
    380396
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/HeuristicLabProblemsDataAnalysisViewsPlugin.cs.frame

    r3373 r3651  
    2828  [Plugin("HeuristicLab.Problems.DataAnalysis.Views","3.3.0.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Problems.DataAnalysis.Views-3.3.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.Collections", "3.3.0.0")]
     31  [PluginDependency("HeuristicLab.Common", "3.3.0.0")]
     32  [PluginDependency("HeuristicLab.Core", "3.3.0.0")]
     33  [PluginDependency("HeuristicLab.Core.Views", "3.3.0.0")]
     34  [PluginDependency("HeuristicLab.Data", "3.3.0.0")]
     35  [PluginDependency("HeuristicLab.Data.Views", "3.3.0.0")]
     36  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.3.0.0")]
     37  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views", "3.3.0.0")]
     38  [PluginDependency("HeuristicLab.MainForm", "3.3.0.0")]
     39  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3.0.0")]
     40  [PluginDependency("HeuristicLab.Operators", "3.3.0.0")]
     41  [PluginDependency("HeuristicLab.Parameters", "3.3.0.0")]
     42  [PluginDependency("HeuristicLab.Persistence", "3.3.0.0")]
     43  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.3.0.0")]
     44  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Regression", "3.3.0.0")]
    3045  public class HeuristicLabProblemsDataAnalysisViewsPlugin : PluginBase {
    3146  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblemData.cs

    r3628 r3651  
    203203        RegisterStringValueEventHandlers(TargetVariable);
    204204        OnProblemDataChanged(EventArgs.Empty);
    205       } 
     205      }
    206206    }
    207207    void TrainingSamplesStartParameter_ValueChanged(object sender, EventArgs e) {
     
    249249
    250250    private void RegisterInputVariablesEventHandlers() {
    251       InputVariables.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<HeuristicLab.Collections.IndexedItem<StringValue>>(InputVariables_CollectionReset); 
     251      InputVariables.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<HeuristicLab.Collections.IndexedItem<StringValue>>(InputVariables_CollectionReset);
    252252      InputVariables.ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<HeuristicLab.Collections.IndexedItem<StringValue>>(InputVariables_ItemsAdded);
    253253      InputVariables.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<HeuristicLab.Collections.IndexedItem<StringValue>>(InputVariables_ItemsRemoved);
     
    266266      }
    267267    }
    268  
     268
    269269    private void InputVariables_CheckedItemsChanged(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<HeuristicLab.Collections.IndexedItem<StringValue>> e) {
    270270      OnProblemDataChanged(e);
     
    330330      TargetVariable = variableNames.First();
    331331      InputVariables = new CheckedItemList<StringValue>(variableNames).AsReadOnly();
    332       foreach (var variableName in variableNames.Skip(1))
    333         InputVariables.SetItemCheckedState(variableName, true);
     332      InputVariables.SetItemCheckedState(variableNames.First(), false);
    334333      int middle = (int)(csvFileParser.Rows * 0.5);
    335334      TrainingSamplesStart = new IntValue(0);
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLabProblemsDataAnalysisPlugin.cs.frame

    r3248 r3651  
    2828  [Plugin("HeuristicLab.Problems.DataAnalysis","3.3.0.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Problems.DataAnalysis-3.3.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.Collections", "3.3.0.0")]
     31  [PluginDependency("HeuristicLab.Common", "3.3.0.0")]
     32  [PluginDependency("HeuristicLab.Common.Resources", "3.2.0.0")]
     33  [PluginDependency("HeuristicLab.Core", "3.3.0.0")]
     34  [PluginDependency("HeuristicLab.Data", "3.3.0.0")]
     35  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.3.0.0")]
     36  [PluginDependency("HeuristicLab.Operators", "3.3.0.0")]
     37  [PluginDependency("HeuristicLab.Parameters", "3.3.0.0")]
    3038  [PluginDependency("HeuristicLab.Persistence", "3.3.0.0")]
     39  [PluginDependency("HeuristicLab.Random", "3.3.0.0")]
    3140  public class HeuristicLabProblemsDataAnalysisPlugin : PluginBase {
    3241  }
Note: See TracChangeset for help on using the changeset viewer.