Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/14/12 02:09:50 (12 years ago)
Author:
bburlacu
Message:

#1772: Fixed display of genetic fragments (received via crossover) in the GenealogyGraphView. Added parent, offspring and fragment lengths histogram.

Location:
branches/HeuristicLab.EvolutionaryTracking
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj.user

    r7788 r7800  
    77  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
    88    <StartAction>Program</StartAction>
    9     <StartProgram>C:\Users\bburlacu\Desktop\HL-Core\trunk\sources\bin\HeuristicLab 3.3.exe</StartProgram>
     9    <StartProgram>C:\Users\Bogdan\Desktop\Trunk\sources\bin\HeuristicLab 3.3.exe</StartProgram>
    1010  </PropertyGroup>
    1111  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Plugin.cs

    r7799 r7800  
    2626
    2727namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
    28   [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.2.7792")]
     28  [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.2.7799")]
    2929  [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Analysis", "3.3")]
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.cs

    r7799 r7800  
    111111        if (arc != null) {
    112112          var fragment = arc.Data as ISymbolicExpressionTreeNode;
     113          //var fragmentNodes = fragment.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>;
     114          //var treeNodes = tree.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>;
     115          //var idx = SymbolicExpressionTreeMatching.FindMatch(treeNodes, fragmentNodes, (int)SymbolicExpressionTreeMatching.SimilarityLevel.Exact);
    113116          foreach (var node in fragment.IterateNodesBreadth()) {
    114117            var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node);
    115118            visualNode.FillColor = Color.LightGreen;
    116119          }
     120          symbolicExpressionTreeChart.Repaint();
    117121        }
    118122      }
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeFragmentsAnalyzer.cs

    r7799 r7800  
    5252    private const string GenerationsParameterName = "Generations";
    5353    private const string FragmentStatisticsParameterName = "FragmentStatistics";
     54    private const string FragmentLengthsDistributionParametersName = "FragmentLengths";
    5455
    5556    #region Parameter properties
     
    7879      get { return (LookupParameter<DataTable>)Parameters[FragmentStatisticsParameterName]; }
    7980    }
     81    public LookupParameter<DataTable> FragmentLengthsParameter {
     82      get { return (LookupParameter<DataTable>)Parameters[FragmentLengthsDistributionParametersName]; }
     83    }
    8084    #endregion
    8185
     
    107111    public DataTable FragmentStatistics {
    108112      get { return FragmentStatisticsParameter.ActualValue; }
     113    }
     114    public DataTable FragmentLengths {
     115      get { return FragmentLengthsParameter.ActualValue; }
    109116    }
    110117    #endregion
     
    130137      Parameters.Add(new LookupParameter<IntValue>(GenerationsParameterName, "The number of generations so far."));
    131138      Parameters.Add(new LookupParameter<DataTable>(FragmentStatisticsParameterName, "The data table to store the fragment statistics."));
     139      Parameters.Add(new LookupParameter<DataTable>(FragmentLengthsDistributionParametersName, "The data table to store the distribution of fragment lengths."));
    132140      UpdateCounterParameter.Hidden = true;
    133141      UpdateIntervalParameter.Hidden = true;
     
    140148        Parameters.Add(new ValueParameter<IntValue>(UpdateIntervalParameterName, "The interval in which the tree length analysis should be applied.", new IntValue(1)));
    141149      }
    142       if (Parameters.ContainsKey(UpdateCounterParameterName)) return;
    143       Parameters.Add(new ValueParameter<IntValue>(UpdateCounterParameterName, "The value which counts how many times the operator was called since the last update", new IntValue(0)));
    144       UpdateCounterParameter.Hidden = true;
     150      if (!Parameters.ContainsKey(UpdateCounterParameterName)) {
     151        Parameters.Add(new ValueParameter<IntValue>(UpdateCounterParameterName, "The value which counts how many times the operator was called since the last update", new IntValue(0)));
     152        UpdateCounterParameter.Hidden = true;
     153      }
     154      if (!Parameters.ContainsKey(FragmentLengthsDistributionParametersName)) {
     155        Parameters.Add(new LookupParameter<DataTable>(FragmentLengthsDistributionParametersName, "The data table to store the distribution of fragment lengths."));
     156      }
    145157    }
    146158    #endregion
     
    167179          results.Add(new Result("Fragment Statistics", FragmentStatistics));
    168180        }
     181        if (FragmentLengths == null) {
     182          FragmentLengthsParameter.ActualValue = new DataTable("Fragment and Tree Lengths", "Distribution of the lengths of the trees sampled by crossover");
     183          FragmentLengths.VisualProperties.XAxisTitle = "Tree/fragment length";
     184          results.Add(new Result("Fragment Lengths", FragmentLengths));
     185        }
    169186
    170187        UpdateCounter.Value = 0; // reset counter
     
    173190
    174191        #region Fragment Statistics
     192        #region Table data
     193        if (!FragmentLengths.Rows.ContainsKey("Parent lengths distribution")) {
     194          var parentLenghtsRow = new DataRow("Parent lengths distribution");
     195          parentLenghtsRow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
     196          parentLenghtsRow.VisualProperties.StartIndexZero = true;
     197          parentLenghtsRow.VisualProperties.ScaleFactor = 1.0;
     198          FragmentLengths.Rows.Add(parentLenghtsRow);
     199        }
     200        if (!FragmentLengths.Rows.ContainsKey("Child lengths distribution")) {
     201          var treeLengthsRow = new DataRow("Child lengths distribution");
     202          treeLengthsRow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
     203          treeLengthsRow.VisualProperties.StartIndexZero = true;
     204          treeLengthsRow.VisualProperties.ScaleFactor = 1.0;
     205          FragmentLengths.Rows.Add(treeLengthsRow);
     206        }
     207        if (!FragmentLengths.Rows.ContainsKey("Fragment lengths distribution")) {
     208          var fragmentLengthsRow = new DataRow("Fragment lengths distribution");
     209          fragmentLengthsRow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
     210          fragmentLengthsRow.VisualProperties.StartIndexZero = true;
     211          fragmentLengthsRow.VisualProperties.ScaleFactor = 1.0;
     212          FragmentLengths.Rows.Add(fragmentLengthsRow);
     213        }
     214        // fragments
     215        if (!FragmentStatistics.Rows.ContainsKey("Average fragment length")) {
     216          var row = new DataRow("Average fragment length") { VisualProperties = { StartIndexZero = true } };
     217          FragmentStatistics.Rows.Add(row);
     218        }
     219        // child trees
     220        if (!FragmentStatistics.Rows.ContainsKey("Average child length")) {
     221          var row = new DataRow("Average child length") { VisualProperties = { StartIndexZero = true } };
     222          FragmentStatistics.Rows.Add(row);
     223        }
     224
     225        // parents
     226        if (!FragmentStatistics.Rows.ContainsKey("Average parent length")) {
     227          var row = new DataRow("Average parent length") { VisualProperties = { StartIndexZero = true } };
     228          FragmentStatistics.Rows.Add(row);
     229        }
     230        // exact similarity
     231        if (!FragmentStatistics.Rows.ContainsKey("Similarity (exact)")) {
     232          var row = new DataRow("Similarity (exact)") { VisualProperties = { StartIndexZero = true } };
     233          FragmentStatistics.Rows.Add(row);
     234        }
     235        #endregion
     236
    175237        var fragments = new List<ISymbolicExpressionTreeNode>();
    176238        var parents = new List<ISymbolicExpressionTree>();
    177239        var trees = (from s in gScope.SubScopes select s.Variables.First().Value as ISymbolicExpressionTree).ToList();
     240
    178241        foreach (var tree in trees.Where(x => GlobalTraceMap.ContainsKey(x))) {
    179242          if (GlobalTraceMap[tree].Count == 2) { // crossover
     243            var parent0 = (ISymbolicExpressionTree)GlobalTraceMap[tree][0];
    180244            var nodes = tree.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>;
    181245            var index = ((IntValue)GlobalFragmentMap[tree]).Value;
    182246            var fragment = nodes[index];
    183247            if (fragment == null) throw new ArgumentException("Fragment not found");
    184             parents.AddRange(GlobalTraceMap[tree].Cast<ISymbolicExpressionTree>());
     248            parents.Add(parent0);
    185249            fragments.Add(fragment);
    186250          } else { // crossover followed by mutation
     
    193257            fragments.Add(fragment);
    194258            if (!GlobalTraceMap.ContainsKey(parent0)) throw new ArgumentException("Parent information not found");
    195             parents.AddRange(GlobalTraceMap[parent0].Cast<ISymbolicExpressionTree>());
     259            parents.Add(parent0);
    196260          }
    197261        }
     262        //var zeros = new List<int>(Enumerable.Repeat<int>(0, 201));
     263        //var lengths = (from t in fragments
     264        //               let len = t.GetLength()
     265        //               orderby len
     266        //               group len by len into g
     267        //               select new Tuple<int,int>(g.First(), g.Count()));
     268        //foreach (var len in lengths)
     269        //  zeros[len.Item1] = len.Item2;
     270        FragmentLengths.Rows["Parent lengths distribution"].Values.Replace(parents.Select(x => (double)x.Length));
     271        FragmentLengths.Rows["Child lengths distribution"].Values.Replace(trees.Select(x => (double)x.Length));
     272        FragmentLengths.Rows["Fragment lengths distribution"].Values.Replace(fragments.Select(x => (double)x.GetLength()));
    198273
    199274        // write values to file
     
    203278        double s1 = CalculateSimilarity(fragments, (int)SymbolicExpressionTreeMatching.SimilarityLevel.Exact);
    204279
    205         #region Table data
    206         // fragments
    207         if (!FragmentStatistics.Rows.ContainsKey("Average fragment length")) {
    208           var row = new DataRow("Average fragment length", "") { VisualProperties = { StartIndexZero = true } };
    209           FragmentStatistics.Rows.Add(row);
    210         }
     280
    211281        FragmentStatistics.Rows["Average fragment length"].Values.Add(a1);
    212         // child trees
    213         if (!FragmentStatistics.Rows.ContainsKey("Average child length")) {
    214           var row = new DataRow("Average child length", "") { VisualProperties = { StartIndexZero = true } };
    215           FragmentStatistics.Rows.Add(row);
    216         }
    217282        FragmentStatistics.Rows["Average child length"].Values.Add(a2);
    218         // parents
    219         if (!FragmentStatistics.Rows.ContainsKey("Average parent length")) {
    220           var row = new DataRow("Average parent length", "") { VisualProperties = { StartIndexZero = true } };
    221           FragmentStatistics.Rows.Add(row);
    222         }
    223283        FragmentStatistics.Rows["Average parent length"].Values.Add(a3);
    224         // exact similarity
    225         if (!FragmentStatistics.Rows.ContainsKey("Similarity (exact)")) {
    226           var row = new DataRow("Similarity (exact)", "") { VisualProperties = { StartIndexZero = true } };
    227           FragmentStatistics.Rows.Add(row);
    228         }
    229284        FragmentStatistics.Rows["Similarity (exact)"].Values.Add(s1);
    230         #endregion
    231285
    232286        #endregion
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeGenealogyAnalyzer.cs

    r7799 r7800  
    263263
    264264          foreach (var parent in parents) {
    265             object data;
     265            object data = ((List<ISymbolicExpressionTreeNode>)child.IterateNodesBreadth())[((IntValue)GlobalFragmentMap[child]).Value];
     266            graph.AddArc(parent, child, null, data);
    266267            if (GlobalTraceMap.ContainsKey(parent)) {
    267268              double quality = Evaluate(parent);
     
    271272              foreach (var p in pp) {
    272273                data = ((List<ISymbolicExpressionTreeNode>)parent.IterateNodesBreadth())[((IntValue)GlobalFragmentMap[parent]).Value];
    273                 graph.AddArc(p, parent, data);
     274                graph.AddArc(p, parent, null, data);
    274275              }
    275276            }
    276             data = ((List<ISymbolicExpressionTreeNode>)child.IterateNodesBreadth())[((IntValue)GlobalFragmentMap[child]).Value];
    277             graph.AddArc(parent, child, data);
    278277          }
    279278        }
     
    334333    }
    335334
    336 
    337 
    338335    private double Evaluate(ISymbolicExpressionTree tree) {
    339336      // we perform evaluation by adding a temporary subscope with the tree in it, and calling evaluator.Apply()
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/GenealogyGraph.cs

    r7799 r7800  
    136136      }
    137137      // add forward and reverse arcs
    138       src.AddForwardArc(dest);
    139       dest.AddReverseArc(src);
     138      src.AddForwardArc(dest, data1);
     139      dest.AddReverseArc(src, data2);
    140140    }
    141141
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Plugin.cs

    r7799 r7800  
    2626  /// Plugin class for HeuristicLab.Selection plugin.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Selection", "3.3.6.7792")]
     28  [Plugin("HeuristicLab.Selection", "3.3.6.7799")]
    2929  [PluginFile("HeuristicLab.Selection-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Collections", "3.3")]
Note: See TracChangeset for help on using the changeset viewer.