Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8954 for branches


Ignore:
Timestamp:
11/27/12 20:09:33 (12 years ago)
Author:
ascheibe
Message:

#1986 merged trunk into SlaveShutdown branch

Location:
branches/SlaveShutdown
Files:
1 deleted
26 edited
7 copied

Legend:

Unmodified
Added
Removed
  • branches/SlaveShutdown

  • branches/SlaveShutdown/HeuristicLab.ExtLibs/HeuristicLab.AutoDiff/1.0/AutoDiff-1.0/CompiledDifferentiator.cs

    r8703 r8954  
    5454            ReverseSweep();
    5555
    56             var gradient = tape.Take(Dimension).Select(elem => elem.Adjoint).ToArray();
    57             var value = tape.Last().Value;
     56            var gradient = new double[Dimension];
     57            for (int i = 0; i < Dimension; i++)
     58               gradient[i] = tape[i].Adjoint;
     59            var value = tape.Last().Value;           
    5860
    5961            return Tuple.Create(gradient, value);
  • branches/SlaveShutdown/HeuristicLab.ExtLibs/HeuristicLab.AutoDiff/1.0/AutoDiff-1.0/ParametricCompiledTerm.cs

    r8703 r8954  
    2020        public double Evaluate(double[] arg, double[] parameters)
    2121        {
    22             var combinedArg = arg.Concat(parameters).ToArray();
     22            var combinedArg = new double[arg.Length + parameters.Length];
     23            arg.CopyTo(combinedArg, 0);
     24            parameters.CopyTo(combinedArg, arg.Length);
    2325            return compiledTerm.Evaluate(combinedArg);
    2426        }
     
    2628        public Tuple<double[], double> Differentiate(double[] arg, double[] parameters)
    2729        {
    28             var combinedArg = arg.Concat(parameters).ToArray();
     30            var combinedArg = new double[arg.Length + parameters.Length];
     31            arg.CopyTo(combinedArg, 0);
     32            parameters.CopyTo(combinedArg, arg.Length);
    2933            var diffResult = compiledTerm.Differentiate(combinedArg);
    3034
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification

  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views

    • Property svn:mergeinfo set to (toggle deleted branches)
      /branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Viewsmergedeligible
      /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Viewsmergedeligible
      /branches/Algorithms.GradientDescent/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views5516-5520
      /branches/Benchmarking/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views6917-7005
      /branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views4656-4721
      /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views5471-5808
      /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views5815-6180
      /branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views4458-4459,​4462,​4464
      /branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views6284-6795
      /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views5060
      /branches/NET40/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views5138-5162
      /branches/ParallelEngine/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views5175-5192
      /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views7568-7810
      /branches/QAPAlgorithms/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views6350-6627
      /branches/Restructure trunk solution/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views6828
      /branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views7787-8333
      /branches/SuccessProgressAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views5370-5682
      /branches/Trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views6829-6865
      /branches/VNS/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views5594-5752
      /branches/histogram/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views5959-6341
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicClassificationSolutionSimplifierView.cs

    r8636 r8954  
    3030    }
    3131
    32     public InteractiveSymbolicClassificationSolutionSimplifierView() : base() { }
     32    public InteractiveSymbolicClassificationSolutionSimplifierView()
     33      : base() {
     34      InitializeComponent();
     35      this.Caption = "Interactive Classification Solution Simplifier";
     36    }
    3337
    3438    protected override void UpdateModel(ISymbolicExpressionTree tree) {
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicClassificationSolutionSimplifierViewBase.cs

    r8727 r8954  
    2929namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views {
    3030  public abstract partial class InteractiveSymbolicClassificationSolutionSimplifierViewBase : InteractiveSymbolicDataAnalysisSolutionSimplifierView {
    31     private readonly ConstantTreeNode constantNode;
    32     private readonly SymbolicExpressionTree tempTree;
     31    private readonly SymbolicClassificationSolutionImpactValuesCalculator calculator;
    3332
    3433    public new ISymbolicClassificationSolution Content {
     
    4241      this.Caption = "Interactive Classification Solution Simplifier";
    4342
    44       constantNode = ((ConstantTreeNode)new Constant().CreateTreeNode());
    45       ISymbolicExpressionTreeNode root = new ProgramRootSymbol().CreateTreeNode();
    46       ISymbolicExpressionTreeNode start = new StartSymbol().CreateTreeNode();
    47       root.AddSubtree(start);
    48       tempTree = new SymbolicExpressionTree(root);
     43      calculator = new SymbolicClassificationSolutionImpactValuesCalculator();
    4944    }
    5045
     
    6661
    6762    protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) {
    68       Dictionary<ISymbolicExpressionTreeNode, double> replacementValues = new Dictionary<ISymbolicExpressionTreeNode, double>();
    69       foreach (ISymbolicExpressionTreeNode node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) {
    70         replacementValues[node] = CalculateReplacementValue(node, tree);
    71       }
    72       return replacementValues;
     63      return tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToDictionary(
     64        n => n,
     65        n => calculator.CalculateReplacementValue(Content.Model, n, Content.ProblemData, Content.ProblemData.TrainingIndices)
     66        );
    7367    }
    7468
    7569    protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree) {
    76       var model = Content.Model;
    77       var dataset = Content.ProblemData.Dataset;
    78       var rows = Content.ProblemData.TrainingIndices;
    79       string targetVariable = Content.ProblemData.TargetVariable;
    80       Dictionary<ISymbolicExpressionTreeNode, double> impactValues = new Dictionary<ISymbolicExpressionTreeNode, double>();
    81       List<ISymbolicExpressionTreeNode> nodes = tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPostfix().ToList();
    82 
    83       var targetClassValues = dataset.GetDoubleValues(targetVariable, rows);
    84       var originalClassValues = model.GetEstimatedClassValues(dataset, rows);
    85       OnlineCalculatorError errorState;
    86       double originalAccuracy = OnlineAccuracyCalculator.Calculate(targetClassValues, originalClassValues, out errorState);
    87       if (errorState != OnlineCalculatorError.None) originalAccuracy = 0.0;
    88 
    89       foreach (ISymbolicExpressionTreeNode node in nodes) {
    90         var parent = node.Parent;
    91         constantNode.Value = CalculateReplacementValue(node, tree);
    92         ISymbolicExpressionTreeNode replacementNode = constantNode;
    93         SwitchNode(parent, node, replacementNode);
    94         var newModel = CreateModel(tree);
    95         var newClassValues = newModel.GetEstimatedClassValues(dataset, rows);
    96         double newAccuracy = OnlineAccuracyCalculator.Calculate(targetClassValues, newClassValues, out errorState);
    97         if (errorState != OnlineCalculatorError.None) newAccuracy = 0.0;
    98 
    99         // impact = 0 if no change
    100         // impact < 0 if new solution is better
    101         // impact > 0 if new solution is worse
    102         impactValues[node] = originalAccuracy - newAccuracy;
    103         SwitchNode(parent, replacementNode, node);
    104       }
    105       return impactValues;
    106     }
    107 
    108     private double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree) {
    109       // remove old ADFs
    110       while (tempTree.Root.SubtreeCount > 1) tempTree.Root.RemoveSubtree(1);
    111       // clone ADFs of source tree
    112       for (int i = 1; i < sourceTree.Root.SubtreeCount; i++) {
    113         tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone());
    114       }
    115       var start = tempTree.Root.GetSubtree(0);
    116       while (start.SubtreeCount > 0) start.RemoveSubtree(0);
    117       start.AddSubtree((ISymbolicExpressionTreeNode)node.Clone());
    118       var interpreter = Content.Model.Interpreter;
    119       var rows = Content.ProblemData.TrainingIndices;
    120       return interpreter.GetSymbolicExpressionTreeValues(tempTree, Content.ProblemData.Dataset, rows)
    121              .LimitToRange(Content.Model.LowerEstimationLimit, Content.Model.UpperEstimationLimit).Median();
    122     }
    123 
    124 
    125     private void SwitchNode(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode oldBranch, ISymbolicExpressionTreeNode newBranch) {
    126       for (int i = 0; i < root.SubtreeCount; i++) {
    127         if (root.GetSubtree(i) == oldBranch) {
    128           root.RemoveSubtree(i);
    129           root.InsertSubtree(i, newBranch);
    130           return;
    131         }
    132       }
     70      return tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToDictionary(
     71        n => n,
     72        n => calculator.CalculateImpactValue(Content.Model, n, Content.ProblemData, Content.ProblemData.TrainingIndices, Content.TrainingAccuracy)
     73        );
    13374    }
    13475
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView.cs

    r8636 r8954  
    2424namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views {
    2525  public partial class InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView : InteractiveSymbolicClassificationSolutionSimplifierViewBase {
    26 
    2726    public new SymbolicDiscriminantFunctionClassificationSolution Content {
    2827      get { return (SymbolicDiscriminantFunctionClassificationSolution)base.Content; }
     
    3029    }
    3130
    32     public InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView() : base() { }
     31    public InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView()
     32      : base() {
     33      InitializeComponent();
     34      this.Caption = "Interactive Classification Solution Simplifier";
     35    }
    3336
    3437    protected override void UpdateModel(ISymbolicExpressionTree tree) {
    3538      var model = CreateModel(tree);
    36       model.RecalculateModelParameters(Content.ProblemData, Content.ProblemData.TrainingIndices);
    3739      Content.Model = (ISymbolicDiscriminantFunctionClassificationModel)model;
    3840    }
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj

    r8606 r8954  
    120120    <Compile Include="ModelCreators\NormalDistributedThresholdsModelCreator.cs" />
    121121    <Compile Include="MultiObjective\SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs" />
     122    <Compile Include="SymbolicClassificationSolutionImpactValuesCalculator.cs" />
    122123    <Compile Include="SymbolicNearestNeighbourClassificationModel.cs" />
    123124    <Compile Include="Plugin.cs" />
     
    258259  -->
    259260  <PropertyGroup>
    260    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     261    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    261262set ProjectDir=$(ProjectDir)
    262263set SolutionDir=$(SolutionDir)
     
    265266call PreBuildEvent.cmd
    266267</PreBuildEvent>
    267 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     268    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
    268269export ProjectDir=$(ProjectDir)
    269270export SolutionDir=$(SolutionDir)
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Properties

    • Property svn:ignore
      --- 
      +++ 
      
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression

  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views

    • Property svn:mergeinfo set to (toggle deleted branches)
      /branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Viewsmergedeligible
      /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Viewsmergedeligible
      /branches/Algorithms.GradientDescent/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views5516-5520
      /branches/Benchmarking/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views6917-7005
      /branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views4656-4721
      /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views5700-5808
      /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views5471-5808
      /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views5815-6180
      /branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views4458-4459,​4462,​4464
      /branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views6284-6795
      /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views5060
      /branches/NET40/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views5138-5162
      /branches/ParallelEngine/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views5175-5192
      /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views7568-7810
      /branches/QAPAlgorithms/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views6350-6627
      /branches/Restructure trunk solution/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views6828
      /branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views7787-8333
      /branches/SuccessProgressAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views5370-5682
      /branches/Trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views6829-6865
      /branches/VNS/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views5594-5752
      /branches/histogram/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views5959-6341
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs

    r8736 r8954  
    2323using System.Collections.Generic;
    2424using System.Linq;
    25 using HeuristicLab.Common;
    2625using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2726using HeuristicLab.Problems.DataAnalysis.Symbolic.Views;
     
    2928namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views {
    3029  public partial class InteractiveSymbolicRegressionSolutionSimplifierView : InteractiveSymbolicDataAnalysisSolutionSimplifierView {
    31     private readonly ConstantTreeNode constantNode;
    32     private readonly SymbolicExpressionTree tempTree;
     30    private readonly SymbolicRegressionSolutionImpactValuesCalculator calculator;
    3331
    3432    public new SymbolicRegressionSolution Content {
     
    4139      InitializeComponent();
    4240      this.Caption = "Interactive Regression Solution Simplifier";
    43 
    44       constantNode = ((ConstantTreeNode)new Constant().CreateTreeNode());
    45       ISymbolicExpressionTreeNode root = new ProgramRootSymbol().CreateTreeNode();
    46       ISymbolicExpressionTreeNode start = new StartSymbol().CreateTreeNode();
    47       root.AddSubtree(start);
    48       tempTree = new SymbolicExpressionTree(root);
     41      calculator = new SymbolicRegressionSolutionImpactValuesCalculator();
    4942    }
    5043
     
    5649
    5750    protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) {
    58       Dictionary<ISymbolicExpressionTreeNode, double> replacementValues = new Dictionary<ISymbolicExpressionTreeNode, double>();
    59       foreach (ISymbolicExpressionTreeNode node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) {
    60         replacementValues[node] = CalculateReplacementValue(node, tree);
    61       }
    62       return replacementValues;
     51      return tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToDictionary(
     52        n => n,
     53        n => calculator.CalculateReplacementValue(Content.Model, n, Content.ProblemData, Content.ProblemData.TrainingIndices)
     54        );
    6355    }
    6456
    6557    protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree) {
    66       var interpreter = Content.Model.Interpreter;
    67       var dataset = Content.ProblemData.Dataset;
    68       var rows = Content.ProblemData.TrainingIndices;
    69       string targetVariable = Content.ProblemData.TargetVariable;
    70       Dictionary<ISymbolicExpressionTreeNode, double> impactValues = new Dictionary<ISymbolicExpressionTreeNode, double>();
    71       List<ISymbolicExpressionTreeNode> nodes = tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPostfix().ToList();
    72       var originalOutput = interpreter.GetSymbolicExpressionTreeValues(tree, dataset, rows).LimitToRange(Content.Model.LowerEstimationLimit, Content.Model.UpperEstimationLimit).ToArray();
    73       var targetValues = dataset.GetDoubleValues(targetVariable, rows);
    74       OnlineCalculatorError errorState;
    75       double originalR2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, originalOutput, out errorState);
    76       if (errorState != OnlineCalculatorError.None) originalR2 = 0.0;
    77 
    78       foreach (ISymbolicExpressionTreeNode node in nodes) {
    79         var parent = node.Parent;
    80         constantNode.Value = CalculateReplacementValue(node, tree);
    81         ISymbolicExpressionTreeNode replacementNode = constantNode;
    82         SwitchNode(parent, node, replacementNode);
    83         var newOutput = interpreter.GetSymbolicExpressionTreeValues(tree, dataset, rows).LimitToRange(Content.Model.LowerEstimationLimit, Content.Model.UpperEstimationLimit);
    84         double newR2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, newOutput, out errorState);
    85         if (errorState != OnlineCalculatorError.None) newR2 = 0.0;
    86 
    87         // impact = 0 if no change
    88         // impact < 0 if new solution is better
    89         // impact > 0 if new solution is worse
    90         impactValues[node] = originalR2 - newR2;
    91         SwitchNode(parent, replacementNode, node);
    92       }
    93       return impactValues;
     58      return tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToDictionary(
     59        n => n,
     60        n => calculator.CalculateImpactValue(Content.Model, n, Content.ProblemData, Content.ProblemData.TrainingIndices, Content.TrainingRSquared)
     61        );
    9462    }
    95 
    96     private double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree) {
    97       // remove old ADFs
    98       while (tempTree.Root.SubtreeCount > 1) tempTree.Root.RemoveSubtree(1);
    99       // clone ADFs of source tree
    100       for (int i = 1; i < sourceTree.Root.SubtreeCount; i++) {
    101         tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone());
    102       }
    103       var start = tempTree.Root.GetSubtree(0);
    104       while (start.SubtreeCount > 0) start.RemoveSubtree(0);
    105       start.AddSubtree((ISymbolicExpressionTreeNode)node.Clone());
    106       var interpreter = Content.Model.Interpreter;
    107       var rows = Content.ProblemData.TrainingIndices;
    108       return interpreter.GetSymbolicExpressionTreeValues(tempTree, Content.ProblemData.Dataset, rows)
    109                          .LimitToRange(Content.Model.LowerEstimationLimit, Content.Model.UpperEstimationLimit)
    110                          .Median();
    111     }
    112 
    113 
    114     private void SwitchNode(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode oldBranch, ISymbolicExpressionTreeNode newBranch) {
    115       for (int i = 0; i < root.SubtreeCount; i++) {
    116         if (root.GetSubtree(i) == oldBranch) {
    117           root.RemoveSubtree(i);
    118           root.InsertSubtree(i, newBranch);
    119           return;
    120         }
    121       }
    122     }
    123 
    124     protected override void OnModelChanged() {
    125       base.OnModelChanged();
    126       if (Content != null)
    127         btnOptimizeConstants.Enabled =
    128           SymbolicRegressionConstantOptimizationEvaluator.CanOptimizeConstants(Content.Model.SymbolicExpressionTree);
    129       else
    130         btnOptimizeConstants.Enabled = false;
    131     }
    132     protected override void OnContentChanged() {
    133       base.OnContentChanged();
    134       base.OnModelChanged();
    135       if (Content != null)
    136         btnOptimizeConstants.Enabled =
    137           SymbolicRegressionConstantOptimizationEvaluator.CanOptimizeConstants(Content.Model.SymbolicExpressionTree);
    138       else
    139         btnOptimizeConstants.Enabled = false;
    140     }
    141 
    14263
    14364    protected override void btnOptimizeConstants_Click(object sender, EventArgs e) {
    14465      var model = Content.Model;
    145       SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(Content.Model.Interpreter, Content.Model.SymbolicExpressionTree, Content.ProblemData, Content.ProblemData.TrainingIndices,
     66      SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(model.Interpreter, model.SymbolicExpressionTree, Content.ProblemData, Content.ProblemData.TrainingIndices,
    14667        applyLinearScaling: true, maxIterations: 50, upperEstimationLimit: model.UpperEstimationLimit, lowerEstimationLimit: model.LowerEstimationLimit);
    14768      UpdateModel(Content.Model.SymbolicExpressionTree);
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4

    • Property svn:ignore
      •  

        old new  
         1*.user
         2Plugin.cs
        13bin
        2 *.user
        3 HeuristicLabProblemsDataAnalysisSymbolicRegressionPlugin.cs
        44obj
        5 *.vs10x
        6 Plugin.cs
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj

    r8895 r8954  
    143143    <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs" />
    144144    <Compile Include="SymbolicRegressionSolution.cs" />
     145    <Compile Include="SymbolicRegressionSolutionImpactValuesCalculator.cs" />
    145146    <None Include="HeuristicLab.snk" />
    146147    <None Include="Plugin.cs.frame" />
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Properties

    • Property svn:ignore
      --- 
      +++ 
      
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

    • Property svn:mergeinfo set to (toggle deleted branches)
      /branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic.Viewsmergedeligible
      /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Viewsmergedeligible
      /branches/Algorithms.GradientDescent/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5516-5520
      /branches/Benchmarking/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views6917-7005
      /branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views4656-4721
      /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5471-5808
      /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5815-6180
      /branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Views4458-4459,​4462,​4464
      /branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Symbolic.Views6284-6795
      /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5060
      /branches/NET40/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5138-5162
      /branches/ParallelEngine/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5175-5192
      /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Views7568-7810
      /branches/QAPAlgorithms/HeuristicLab.Problems.DataAnalysis.Symbolic.Views6350-6627
      /branches/Restructure trunk solution/HeuristicLab.Problems.DataAnalysis.Symbolic.Views6828
      /branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.DataAnalysis.Symbolic.Views7787-8333
      /branches/SuccessProgressAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5370-5682
      /branches/Trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views6829-6865
      /branches/VNS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5594-5752
      /branches/histogram/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5959-6341
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4

    • Property svn:ignore
      •  

        old new  
         1*.user
         2Plugin.cs
        13bin
        24obj
        3 *.user
        4 HeuristicLabProblemsDataAnalysisSymbolicViewsPlugin.cs
        5 *.vs10x
        6 Plugin.cs
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r8600 r8954  
    114114  </ItemGroup>
    115115  <ItemGroup>
     116    <Compile Include="InteractiveSymbolicExpressionTreeChart.cs">
     117      <SubType>UserControl</SubType>
     118    </Compile>
     119    <Compile Include="InteractiveSymbolicExpressionTreeChart.Designer.cs">
     120      <DependentUpon>InteractiveSymbolicExpressionTreeChart.cs</DependentUpon>
     121    </Compile>
    116122    <Compile Include="MathSymbolicDataAnalysisModelView.cs">
    117123      <SubType>UserControl</SubType>
     
    168174    <Compile Include="Symbols\VariableView.Designer.cs">
    169175      <DependentUpon>VariableView.cs</DependentUpon>
     176    </Compile>
     177    <Compile Include="TreeEditDialogs\SymbolicExpressionTreeNodeChangeValueDialog.cs">
     178      <SubType>Form</SubType>
     179    </Compile>
     180    <Compile Include="TreeEditDialogs\SymbolicExpressionTreeNodeChangeValueDialog.Designer.cs">
     181      <DependentUpon>SymbolicExpressionTreeNodeChangeValueDialog.cs</DependentUpon>
     182    </Compile>
     183    <Compile Include="TreeEditDialogs\SymbolicExpressionTreeNodeInsertDialog.cs">
     184      <SubType>Form</SubType>
     185    </Compile>
     186    <Compile Include="TreeEditDialogs\SymbolicExpressionTreeNodeInsertDialog.Designer.cs">
     187      <DependentUpon>SymbolicExpressionTreeNodeInsertDialog.cs</DependentUpon>
    170188    </Compile>
    171189    <None Include="HeuristicLab.snk" />
     
    313331  -->
    314332  <PropertyGroup>
    315    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     333    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    316334set ProjectDir=$(ProjectDir)
    317335set SolutionDir=$(SolutionDir)
     
    320338call PreBuildEvent.cmd
    321339</PreBuildEvent>
    322 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     340    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
    323341export ProjectDir=$(ProjectDir)
    324342export SolutionDir=$(SolutionDir)
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs

    r8053 r8954  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.treeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
     47      this.components = new System.ComponentModel.Container();
    4848      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    4949      this.splitContainer = new System.Windows.Forms.SplitContainer();
     
    5252      this.btnSimplify = new System.Windows.Forms.Button();
    5353      this.btnOptimizeConstants = new System.Windows.Forms.Button();
     54      this.treeChart = new HeuristicLab.Problems.DataAnalysis.Symbolic.Views.InteractiveSymbolicExpressionTreeChart();
    5455      this.grpViewHost = new System.Windows.Forms.GroupBox();
    5556      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
     
    6162      this.grpViewHost.SuspendLayout();
    6263      this.SuspendLayout();
    63       //
    64       // treeChart
    65       //
    66       this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    67             | System.Windows.Forms.AnchorStyles.Left)
    68             | System.Windows.Forms.AnchorStyles.Right)));
    69       this.treeChart.BackgroundColor = System.Drawing.Color.White;
    70       this.treeChart.LineColor = System.Drawing.Color.Black;
    71       this.treeChart.Location = new System.Drawing.Point(6, 16);
    72       this.treeChart.Name = "treeChart";
    73       this.treeChart.Size = new System.Drawing.Size(201, 291);
    74       this.treeChart.Spacing = 5;
    75       this.treeChart.TabIndex = 0;
    76       this.treeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);
    77       this.treeChart.Tree = null;
    78       this.treeChart.SymbolicExpressionTreeNodeDoubleClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeDoubleClicked);
    7964      //
    8065      // viewHost
     
    11398      // grpSimplify
    11499      //
     100      this.grpSimplify.AutoSize = true;
    115101      this.grpSimplify.Controls.Add(this.flowLayoutPanel);
    116102      this.grpSimplify.Controls.Add(this.treeChart);
     
    157143      this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click);
    158144      //
     145      // treeChart
     146      //
     147      this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     148            | System.Windows.Forms.AnchorStyles.Left)
     149            | System.Windows.Forms.AnchorStyles.Right)));
     150      this.treeChart.BackgroundColor = System.Drawing.Color.White;
     151      this.treeChart.LineColor = System.Drawing.Color.Black;
     152      this.treeChart.Location = new System.Drawing.Point(6, 16);
     153      this.treeChart.Name = "treeChart";
     154      this.treeChart.Size = new System.Drawing.Size(201, 291);
     155      this.treeChart.Spacing = 5;
     156      this.treeChart.SuspendRepaint = false;
     157      this.treeChart.TabIndex = 0;
     158      this.treeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);
     159      this.treeChart.Tree = null;
     160      this.treeChart.SymbolicExpressionTreeChanged += new System.EventHandler(this.treeChart_SymbolicExpressionTreeChanged);
     161      this.treeChart.SymbolicExpressionTreeNodeChanged += new System.EventHandler(this.treeChart_SymbolicExpressionTreeNodeChanged);
     162      this.treeChart.SymbolicExpressionTreeNodeDoubleClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeDoubleClicked);
     163      //
    159164      // grpViewHost
    160165      //
     
    171176      //
    172177      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    173       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     178      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    174179      this.Controls.Add(this.splitContainer);
     180      this.DoubleBuffered = true;
    175181      this.Name = "InteractiveSymbolicDataAnalysisSolutionSimplifierView";
    176182      this.Size = new System.Drawing.Size(564, 348);
    177183      this.splitContainer.Panel1.ResumeLayout(false);
     184      this.splitContainer.Panel1.PerformLayout();
    178185      this.splitContainer.Panel2.ResumeLayout(false);
    179186      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
     
    188195    #endregion
    189196
    190     private HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart treeChart;
     197    private InteractiveSymbolicExpressionTreeChart treeChart;
    191198    private System.Windows.Forms.SplitContainer splitContainer;
    192199    private HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r7259 r8954  
    3434    private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> replacementNodes;
    3535    private Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts;
    36     private bool updateInProgress = false;
     36    private Dictionary<ISymbolicExpressionTreeNode, double> originalValues;
     37    private Dictionary<ISymbolicExpressionTreeNode, string> originalVariableNames;
    3738
    3839    public InteractiveSymbolicDataAnalysisSolutionSimplifierView() {
    3940      InitializeComponent();
    40       this.replacementNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
    41       this.nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>();
     41      replacementNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
     42      nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>();
     43      originalValues = new Dictionary<ISymbolicExpressionTreeNode, double>();
     44      originalVariableNames = new Dictionary<ISymbolicExpressionTreeNode, string>();
     45
    4246      this.Caption = "Interactive Solution Simplifier";
    4347    }
     
    5054    protected override void RegisterContentEvents() {
    5155      base.RegisterContentEvents();
    52       Content.ModelChanged += new EventHandler(Content_ModelChanged);
    53       Content.ProblemDataChanged += new EventHandler(Content_ProblemDataChanged);
     56      Content.ModelChanged += Content_Changed;
     57      Content.ProblemDataChanged += Content_Changed;
    5458    }
    5559    protected override void DeregisterContentEvents() {
    5660      base.DeregisterContentEvents();
    57       Content.ModelChanged -= new EventHandler(Content_ModelChanged);
    58       Content.ProblemDataChanged -= new EventHandler(Content_ProblemDataChanged);
    59     }
    60 
    61     private void Content_ModelChanged(object sender, EventArgs e) {
    62       OnModelChanged();
    63     }
    64     private void Content_ProblemDataChanged(object sender, EventArgs e) {
    65       OnProblemDataChanged();
    66     }
    67 
    68     protected virtual void OnModelChanged() {
    69       this.CalculateReplacementNodesAndNodeImpacts();
    70     }
    71 
    72     protected virtual void OnProblemDataChanged() {
    73       this.CalculateReplacementNodesAndNodeImpacts();
     61      Content.ModelChanged -= Content_Changed;
     62      Content.ProblemDataChanged -= Content_Changed;
     63    }
     64
     65    private void Content_Changed(object sender, EventArgs e) {
     66      UpdateView();
    7467    }
    7568
    7669    protected override void OnContentChanged() {
    7770      base.OnContentChanged();
    78       this.CalculateReplacementNodesAndNodeImpacts();
    79       this.viewHost.Content = this.Content;
    80     }
    81 
    82     private void CalculateReplacementNodesAndNodeImpacts() {
    83       if (Content != null && Content.Model != null && Content.ProblemData != null) {
    84         var tree = Content.Model.SymbolicExpressionTree;
    85         var replacementValues = CalculateReplacementValues(tree);
    86         foreach (var pair in replacementValues) {
    87           if (!(pair.Key is ConstantTreeNode)) {
    88             replacementNodes[pair.Key] = MakeConstantTreeNode(pair.Value);
    89           }
    90         }
    91         nodeImpacts = CalculateImpactValues(Content.Model.SymbolicExpressionTree);
    92 
    93         if (!updateInProgress) {
    94           // automatically fold all branches with impact = 1
    95           List<ISymbolicExpressionTreeNode> nodeList = Content.Model.SymbolicExpressionTree.Root.GetSubtree(0).IterateNodesPrefix().ToList();
    96           foreach (var parent in nodeList) {
    97             for (int subTreeIndex = 0; subTreeIndex < parent.SubtreeCount; subTreeIndex++) {
    98               var child = parent.GetSubtree(subTreeIndex);
    99               if (!(child.Symbol is Constant) && nodeImpacts[child].IsAlmost(0.0)) {
    100                 SwitchNodeWithReplacementNode(parent, subTreeIndex);
    101               }
    102             }
    103           }
    104         }
    105 
    106         // show only interesting part of solution
    107         if (tree.Root.SubtreeCount > 1)
    108           this.treeChart.Tree = new SymbolicExpressionTree(tree.Root); // RPB + ADFs
    109         else
    110           this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); // 1st child of RPB
    111         this.PaintNodeImpacts();
    112       }
     71      UpdateView();
     72      viewHost.Content = this.Content;
     73    }
     74
     75    private void UpdateView() {
     76      if (Content == null || Content.Model == null || Content.ProblemData == null) return;
     77      var tree = Content.Model.SymbolicExpressionTree;
     78
     79      var replacementValues = CalculateReplacementValues(tree);
     80      foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) {
     81        replacementNodes[pair.Key] = MakeConstantTreeNode(pair.Value);
     82      }
     83
     84      nodeImpacts = CalculateImpactValues(tree);
     85
     86      var model = Content.Model.SymbolicExpressionTree;
     87      treeChart.Tree = model.Root.SubtreeCount > 1 ? new SymbolicExpressionTree(model.Root) : new SymbolicExpressionTree(model.Root.GetSubtree(0).GetSubtree(0));
     88      PaintNodeImpacts();
    11389    }
    11490
     
    11793    protected abstract void UpdateModel(ISymbolicExpressionTree tree);
    11894
    119     private ConstantTreeNode MakeConstantTreeNode(double value) {
    120       Constant constant = new Constant();
    121       constant.MinValue = value - 1;
    122       constant.MaxValue = value + 1;
    123       ConstantTreeNode constantTreeNode = (ConstantTreeNode)constant.CreateTreeNode();
     95    private static ConstantTreeNode MakeConstantTreeNode(double value) {
     96      var constant = new Constant { MinValue = value - 1, MaxValue = value + 1 };
     97      var constantTreeNode = (ConstantTreeNode)constant.CreateTreeNode();
    12498      constantTreeNode.Value = value;
    12599      return constantTreeNode;
     
    127101
    128102    private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {
    129       VisualSymbolicExpressionTreeNode visualTreeNode = (VisualSymbolicExpressionTreeNode)sender;
     103      if (!treeChart.TreeValid) return;
     104      var visualNode = (VisualSymbolicExpressionTreeNode)sender;
     105      var symbExprTreeNode = (SymbolicExpressionTreeNode)visualNode.SymbolicExpressionTreeNode;
     106      if (symbExprTreeNode == null) return;
    130107      var tree = Content.Model.SymbolicExpressionTree;
    131       foreach (SymbolicExpressionTreeNode treeNode in tree.IterateNodesPostfix()) {
    132         for (int i = 0; i < treeNode.SubtreeCount; i++) {
    133           ISymbolicExpressionTreeNode subTree = treeNode.GetSubtree(i);
    134           // only allow to replace nodes for which a replacement value is known (replacement value for ADF nodes are not available)
    135           if (subTree == visualTreeNode.SymbolicExpressionTreeNode && replacementNodes.ContainsKey(subTree)) {
    136             SwitchNodeWithReplacementNode(treeNode, i);
    137 
    138             // show only interesting part of solution
    139             if (tree.Root.SubtreeCount > 1)
    140               this.treeChart.Tree = new SymbolicExpressionTree(tree.Root); // RPB + ADFs
    141             else
    142               this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); // 1st child of RPB
    143 
    144             updateInProgress = true;
    145             UpdateModel(tree);
    146             updateInProgress = false;
    147             return; // break all loops
     108
     109      bool update = false;
     110      // check if the node value/weight has been altered
     111      // if so, the first double click will return the node to its original value/weight/variable name
     112      // the next double click will replace the ConstantNode with the original SymbolicExpressionTreeNode
     113      if (originalVariableNames.ContainsKey(symbExprTreeNode)) {
     114        var variable = (VariableTreeNode)symbExprTreeNode;
     115        variable.VariableName = originalVariableNames[symbExprTreeNode];
     116        originalVariableNames.Remove(variable);
     117        update = true;
     118      } else if (originalValues.ContainsKey(symbExprTreeNode)) {
     119        double value = originalValues[symbExprTreeNode];
     120        if (symbExprTreeNode.Symbol is Constant) {
     121          var constantTreeNode = (ConstantTreeNode)symbExprTreeNode;
     122          constantTreeNode.Value = value;
     123        } else if (symbExprTreeNode.Symbol is Variable) {
     124          var variable = (VariableTreeNode)symbExprTreeNode;
     125          variable.Weight = value;
     126        }
     127        originalValues.Remove(symbExprTreeNode);
     128        update = true;
     129      } else if (replacementNodes.ContainsKey(symbExprTreeNode)) {
     130        foreach (var treeNode in tree.IterateNodesPostfix()) {
     131          for (int i = 0; i < treeNode.SubtreeCount; i++) {
     132            var subtree = treeNode.GetSubtree(i);
     133            if (subtree == symbExprTreeNode) {
     134              SwitchNodeWithReplacementNode(treeNode, i);
     135              // show only interesting part of solution
     136              treeChart.Tree = tree.Root.SubtreeCount > 1
     137                                 ? new SymbolicExpressionTree(tree.Root)
     138                                 : new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0));
     139              update = true;
     140            }
    148141          }
    149         }
     142          if (update) break;
     143        }
     144      }
     145      if (update) UpdateModel(tree);
     146    }
     147
     148    private void treeChart_SymbolicExpressionTreeChanged(object sender, EventArgs e) {
     149      UpdateModel(Content.Model.SymbolicExpressionTree);
     150      UpdateView();
     151    }
     152
     153    private void treeChart_SymbolicExpressionTreeNodeChanged(object sender, EventArgs e) {
     154      var dialog = (ValueChangeDialog)sender;
     155      bool flag1 = false, flag2 = false;
     156      var node = dialog.Content;
     157
     158      if (node is VariableTreeNode) {
     159        var variable = (VariableTreeNode)node;
     160        var weight = double.Parse(dialog.newValueTextBox.Text);
     161        var name = (string)dialog.variableNamesCombo.SelectedItem;
     162        if (!variable.Weight.Equals(weight)) {
     163          flag1 = true;
     164          originalValues[variable] = variable.Weight;
     165          variable.Weight = weight;
     166        }
     167        if (!variable.VariableName.Equals(name)) {
     168          flag2 = true;
     169          originalVariableNames[variable] = variable.VariableName;
     170          variable.VariableName = name;
     171        }
     172      } else if (node is ConstantTreeNode) {
     173        var constant = (ConstantTreeNode)node;
     174        var value = double.Parse(dialog.newValueTextBox.Text);
     175        if (!constant.Value.Equals(value)) {
     176          flag1 = true;
     177          originalValues[constant] = constant.Value;
     178          constant.Value = value;
     179        }
     180      }
     181      if (flag1 || flag2) {
     182        UpdateView();
    150183      }
    151184    }
     
    168201      double min = impacts.Min();
    169202      foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
     203        VisualSymbolicExpressionTreeNode visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
     204        bool flag1 = replacementNodes.ContainsKey(treeNode);
     205        bool flag2 = originalValues.ContainsKey(treeNode);
     206        bool flag3 = treeNode is ConstantTreeNode;
     207
     208        if (flag2) // constant or variable node was changed
     209          visualTree.ToolTip += Environment.NewLine + "Original value: " + originalValues[treeNode];
     210        else if (flag1 && flag3) // symbol node was folded to a constant
     211          visualTree.ToolTip += Environment.NewLine + "Original node: " + replacementNodes[treeNode];
     212
    170213        if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) {
    171214          double impact = nodeImpacts[treeNode];
    172           VisualSymbolicExpressionTreeNode visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
    173215
    174216          // impact = 0 if no change
     
    197239    private void PaintCollapsedNodes() {
    198240      foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
    199         if (treeNode is ConstantTreeNode && replacementNodes.ContainsKey(treeNode))
    200           this.treeChart.GetVisualSymbolicExpressionTreeNode(treeNode).LineColor = Color.DarkOrange;
    201         else {
    202           VisualSymbolicExpressionTreeNode visNode = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
    203           if (visNode != null)
    204             visNode.LineColor = Color.Black;
     241        bool flag1 = replacementNodes.ContainsKey(treeNode);
     242        bool flag2 = originalValues.ContainsKey(treeNode);
     243        if (flag1 && treeNode is ConstantTreeNode) {
     244          this.treeChart.GetVisualSymbolicExpressionTreeNode(treeNode).LineColor = flag2 ? Color.DarkViolet : Color.DarkOrange;
     245        } else if (flag2) {
     246          this.treeChart.GetVisualSymbolicExpressionTreeNode(treeNode).LineColor = Color.DodgerBlue;
    205247        }
    206248      }
     
    208250
    209251    private void btnSimplify_Click(object sender, EventArgs e) {
    210       SymbolicDataAnalysisExpressionTreeSimplifier simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier();
     252      var simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier();
    211253      var simplifiedExpressionTree = simplifier.Simplify(Content.Model.SymbolicExpressionTree);
    212254      UpdateModel(simplifiedExpressionTree);
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Properties

    • Property svn:ignore
      --- 
      +++ 
      
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4

    • Property svn:ignore
      •  

        old new  
         1*.user
         2Plugin.cs
        13bin
        2 *.user
        3 HeuristicLabProblemsDataAnalysisSymbolicPlugin.cs
        44obj
        5 *.vs10x
        6 Plugin.cs
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r8895 r8954  
    140140    <Compile Include="Crossovers\SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs" />
    141141    <Compile Include="Interfaces\ISymbolicDataAnalysisExpressionCrossover.cs" />
     142    <Compile Include="Interfaces\ISymbolicDataAnalysisImpactValuesCalculator.cs" />
    142143    <Compile Include="Interpreter\InterpreterState.cs" />
    143144    <Compile Include="Interpreter\OpCodes.cs" />
     
    164165    <Compile Include="SymbolicDataAnalysisExpressionTreeSimplifier.cs" />
    165166    <Compile Include="SymbolicDataAnalysisProblem.cs" />
     167    <Compile Include="SymbolicDataAnalysisSolutionImpactValuesCalculator.cs" />
    166168    <Compile Include="Symbols\Addition.cs" />
    167169    <Compile Include="Symbols\And.cs" />
  • branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Properties

    • Property svn:ignore
      --- 
      +++ 
      
Note: See TracChangeset for help on using the changeset viewer.