Changeset 10456


Ignore:
Timestamp:
02/15/14 13:50:37 (6 years ago)
Author:
bburlacu
Message:

#1772: Merged trunk changes.

Location:
branches/HeuristicLab.EvolutionTracking
Files:
2 added
1 deleted
16 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs

    r10347 r10456  
    5151      this.lineColor = Color.Black;
    5252      this.backgroundColor = Color.White;
    53       this.textFont = new Font("Times New Roman", 14);
     53      this.textFont = new Font(FontFamily.GenericSerif, 14, GraphicsUnit.Pixel);
    5454      layoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode>();
    5555      layoutAdapter = new SymbolicExpressionTreeLayoutAdapter();
     
    278278
    279279    #region methods for painting the symbolic expression tree
    280 
    281280    private void DrawFunctionTree(ISymbolicExpressionTree symbolicExpressionTree, Graphics graphics, int preferredWidth, int preferredHeight, int minHDistance, int minVDistance) {
    282281      var layoutNodes = layoutAdapter.Convert(symbolicExpressionTree).ToList();
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/MultiSymbolicExpressionTreeArchitectureManipulator.cs

    r9456 r10456  
    106106      Operators = checkedItemList.AsReadOnly();
    107107      Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeManipulator>>(Operators.CheckedItems));
     108
     109      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    108110    }
    109111
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Formatters/SymbolicExpressionTreeLatexFormatter.cs

    r10302 r10456  
    1 using System.Collections.Generic;
     1using System;
     2using System.Collections.Generic;
     3using System.Globalization;
    24using System.Linq;
    35using System.Text;
     
    810  [Item("LaTeX/PDF Formatter", "Formatter for symbolic expression trees for use with latex.")]
    911  public class SymbolicExpressionTreeLatexFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
    10     private readonly static Dictionary<string, string> symbolNameMap = new Dictionary<string, string>
     12    private readonly static Dictionary<string, string> SymbolNamesMap = new Dictionary<string, string>
    1113    {
    1214      {"ProgramRootSymbol", "Prog"},
    13       {"StartSymbol","RPB"}
     15      {"StartSymbol","RPB"},
     16      {"Addition", "$+$"},
     17      {"Subtraction", "$-$"},
     18      {"Multiplication", "$\\times$"},
     19      {"Division", "$\\div$"}
    1420    };
    1521    private readonly ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> layoutEngine;
    1622    private readonly SymbolicExpressionTreeLayoutAdapter layoutAdapter;
    1723
    18 
    1924    public SymbolicExpressionTreeLatexFormatter() {
    2025      layoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode>();
     26      layoutAdapter = new SymbolicExpressionTreeLayoutAdapter();
    2127    }
    2228
     
    3743      foreach (var ln in layoutNodes)
    3844        layoutEngine.AddNode(ln.Content, ln);
     45      layoutEngine.CalculateLayout();
    3946      var nodeCoordinates = layoutEngine.GetNodeCoordinates();
    4047      var sb = new StringBuilder();
    41       sb.AppendLine("\\begin{figure}");
    42       sb.AppendLine("\\begin{tikzpicture}");
     48      var nl = Environment.NewLine;
     49      sb.Append("\\documentclass[class=minimal,border=0pt]{standalone}" + nl +
     50                "\\usepackage{tikz}" + nl +
     51                "\\begin{document}" + nl +
     52                "\\begin{tikzpicture}" + nl +
     53                "\\def\\ws{1}" + nl +
     54                "\\def\\hs{0.7}" + nl);
    4355
    44       foreach (var node in symbolicExpressionTree.IterateNodesBreadth()) {
     56      const double ws = 1.0, hs = 0.7; // some scaling factors useful for fine-tuning document appearance before latex compilation
     57      var nodes = symbolicExpressionTree.IterateNodesBreadth().ToList();
     58      var nodeIndices = new Dictionary<ISymbolicExpressionTreeNode, int>();
     59      for (int i = 0; i < nodes.Count; ++i) {
     60        var node = nodes[i];
     61        nodeIndices.Add(node, i);
    4562        var symbolName = node.Symbol.Name;
    46         var nodeName = symbolNameMap.ContainsKey(symbolName) ? symbolNameMap[symbolName] : symbolName;
     63        var nodeName = SymbolNamesMap.ContainsKey(symbolName) ? SymbolNamesMap[symbolName] : symbolName;
    4764        var coord = nodeCoordinates[node];
    4865
    49         sb.AppendLine(string.Format("\\draw node ({0},{1}) {{{2}}};", coord.X, coord.Y, nodeName));
     66        sb.AppendLine(string.Format(CultureInfo.InvariantCulture, "\\node ({0}) at (\\ws*{1},\\hs*{2}) {{{3}}};", i, ws * coord.X, -hs * coord.Y, EscapeLatexString(nodeName)));
    5067      }
    5168
    52       sb.AppendLine("\\end{figure}");
    53       sb.AppendLine("\\end{tikzpicture}");
     69      for (int i = 0; i < nodes.Count; ++i) {
     70        foreach (var s in nodes[i].Subtrees) {
     71          sb.AppendLine(string.Format(CultureInfo.InvariantCulture, "\\draw ({0}) -- ({1});", i, nodeIndices[s]));
     72        }
     73      }
     74
     75      sb.AppendLine("\\end{tikzpicture}" + nl + "\\end{document}" + nl);
    5476
    5577      return sb.ToString();
    5678    }
     79
     80    private static string EscapeLatexString(string s) {
     81      return s.Replace("\\", "\\\\").Replace("{", "\\{").Replace("}", "\\}").Replace("_", "\\_");
     82    }
    5783  }
    5884}
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/SymbolicExpressionTreeLayoutAdapter.cs

    r10269 r10456  
    2828  public class SymbolicExpressionTreeLayoutAdapter : ILayoutAdapter<ISymbolicExpressionTreeNode> {
    2929    // default conversion function between ISymbolicExpressionTreeNode and ILayoutNode<ISymbolicExpressionTree>
    30     ILayoutNode<ISymbolicExpressionTreeNode> defaultConvert(ISymbolicExpressionTreeNode node) {
     30    static ILayoutNode<ISymbolicExpressionTreeNode> DefaultConvert(ISymbolicExpressionTreeNode node) {
    3131      var layoutNode = new LayoutNode<ISymbolicExpressionTreeNode> { Content = node };
    3232      layoutNode.Ancestor = layoutNode;
     
    4040    // return an enumerable containing all the layout nodes
    4141    public IEnumerable<ILayoutNode<ISymbolicExpressionTreeNode>> Convert(ISymbolicExpressionTreeNode root, Func<ISymbolicExpressionTreeNode, ILayoutNode<ISymbolicExpressionTreeNode>> convertFunc = null) {
    42       var rootLayoutNode = convertFunc == null ? defaultConvert(root) : convertFunc(root);
     42      var rootLayoutNode = convertFunc == null ? DefaultConvert(root) : convertFunc(root);
    4343      rootLayoutNode.Ancestor = rootLayoutNode;
    4444
     
    6363      for (int i = 0; i < layoutNode.Content.SubtreeCount; ++i) {
    6464        var subtree = layoutNode.Content.GetSubtree(i);
    65         var childLayoutNode = convertFunc == null ? defaultConvert(subtree) : convertFunc(subtree);
     65        var childLayoutNode = convertFunc == null ? DefaultConvert(subtree) : convertFunc(subtree);
    6666        childLayoutNode.Parent = layoutNode;
    6767        childLayoutNode.Number = i;
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/MultiSymbolicExpressionTreeManipulator.cs

    r9456 r10456  
    8383      Operators = checkedItemList.AsReadOnly();
    8484      Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeManipulator>>(Operators.CheckedItems));
     85
     86      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    8587    }
    8688
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/HeuristicLab.EvolutionTracking.Views-3.4.csproj

    r10347 r10456  
    116116      <DependentUpon>FrequentFragmentsDialog.cs</DependentUpon>
    117117    </Compile>
    118     <Compile Include="GenealogyGraphChart.cs">
    119       <SubType>UserControl</SubType>
    120     </Compile>
     118    <Compile Include="GenealogyGraphChart.cs" />
    121119    <Compile Include="GenealogyGraphChart.Designer.cs">
    122120      <DependentUpon>GenealogyGraphChart.cs</DependentUpon>
     
    132130      <DependentUpon>Resources.resx</DependentUpon>
    133131    </Compile>
    134     <Compile Include="GenealogyGraphView.cs">
    135       <SubType>UserControl</SubType>
    136     </Compile>
     132    <Compile Include="GenealogyGraphView.cs" />
    137133    <Compile Include="GenealogyGraphView.Designer.cs">
    138134      <DependentUpon>GenealogyGraphView.cs</DependentUpon>
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r10347 r10456  
    300300  </ItemGroup>
    301301  <ItemGroup>
    302     <ProjectReference Include="..\..\..\HeuristicLab.EvolutionaryTracking\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.csproj">
     302    <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.csproj">
    303303      <Project>{423bd94f-963a-438e-ba45-3bb3d61cd03b}</Project>
    304304      <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4</Name>
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r10347 r10456  
    173173  </ItemGroup>
    174174  <ItemGroup>
     175    <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs"
    175176    <Compile Include="Analyzers\SymbolicDataAnalysisGenealogyAnalyzer.cs" />
    176177    <Compile Include="Analyzers\SymbolicDataAnalysisPopulationDiversityAnalyzer.cs" />
     
    188189      <SubType>Code</SubType>
    189190    </Compile>
     191    <Compile Include="SymbolicDataAnalysisExpressionPruningOperator.cs" />
    190192    <Compile Include="SlidingWindow\GenerationalSlidingWindowAnalyzer.cs" />
    191193    <Compile Include="SlidingWindow\OffspringSelectionSlidingWindowAnalyzer.cs" />
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs

    r10302 r10456  
    4040
    4141    public IScopeTreeLookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
    42       get {
    43         return (IScopeTreeLookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName];
    44       }
     42      get { return (IScopeTreeLookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
    4543    }
    4644
     
    9088    public SymbolicDataAnalysisExpressionTreeSimilarityCalculator()
    9189      : base() {
    92       Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName,
    93         "The symbolic expression trees to analyze."));
     90      Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression trees to analyze."));
    9491      Parameters.Add(new ValueParameter<ISymbolicExpressionTree>(CurrentSymbolicExpressionTreeParameterName, ""));
    95       Parameters.Add(new LookupParameter<BoolValue>(MatchVariablesParameterName,
    96         "Specify if the symbolic expression tree comparer should match variable names."));
    97       Parameters.Add(new LookupParameter<BoolValue>(MatchVariableWeightsParameterName,
    98         "Specify if the symbolic expression tree comparer should match variable weights."));
    99       Parameters.Add(new LookupParameter<BoolValue>(MatchConstantValuesParameterName,
    100         "Specify if the symbolic expression tree comparer should match constant values."));
     92      Parameters.Add(new LookupParameter<BoolValue>(MatchVariablesParameterName, "Specify if the symbolic expression tree comparer should match variable names."));
     93      Parameters.Add(new LookupParameter<BoolValue>(MatchVariableWeightsParameterName, "Specify if the symbolic expression tree comparer should match variable weights."));
     94      Parameters.Add(new LookupParameter<BoolValue>(MatchConstantValuesParameterName, "Specify if the symbolic expression tree comparer should match constant values."));
    10195      Parameters.Add(new LookupParameter<DoubleValue>(SimilarityValuesParmeterName, ""));
    10296    }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.TravelingSalesman

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.TravelingSalesman.Views

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/HeuristicLab.EvolutionTracking/PreBuildEvent.cmd

    r10265 r10456  
    1 SubWCRev "%ProjectDir%\" "%ProjectDir%\Properties\AssemblyInfo.frame" "%ProjectDir%\Properties\AssemblyInfo.cs"
    2 SubWCRev "%ProjectDir%\" "%ProjectDir%\Plugin.cs.frame" "%ProjectDir%\Plugin.cs"
     1IF EXIST "%ProjectDir%\Properties\AssemblyInfo.cs.frame" SubWCRev "%ProjectDir%\" "%ProjectDir%\Properties\AssemblyInfo.cs.frame" "%ProjectDir%\Properties\AssemblyInfo.cs"
     2IF %ERRORLEVEL% NEQ 0 GOTO Error_Handling
     3IF EXIST "%ProjectDir%\Plugin.cs.frame" SubWCRev "%ProjectDir%\" "%ProjectDir%\Plugin.cs.frame" "%ProjectDir%\Plugin.cs"
     4IF %ERRORLEVEL% NEQ 0 GOTO Error_Handling
     5GOTO Done
     6
     7:Error_Handling
     8ECHO There was an error while running subwcrev. Please verify that the *.cs.frame files have been correctly converted to *.cs files, otherwise HeuristicLab won't build.
     9exit 0
     10
     11:Done
     12
Note: See TracChangeset for help on using the changeset viewer.