- Timestamp:
- 03/24/14 16:59:22 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking
- Files:
-
- 11 added
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs
r10524 r10650 41 41 42 42 public ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> LayoutEngine { get; set; } 43 public SymbolicExpressionTreeTile(IChart chart) : base(chart) { } 43 private Dictionary<IPrimitive, ISymbolicExpressionTreeNode> primitiveMap; 44 45 public SymbolicExpressionTreeTile(IChart chart) 46 : base(chart) { 47 primitiveMap = new Dictionary<IPrimitive, ISymbolicExpressionTreeNode>(); 48 } 44 49 public SymbolicExpressionTreeTile(IChart chart, ISymbolicExpressionTree tree) 45 : base(chart) {50 : this(chart) { 46 51 SymbolicExpressionTree = tree; 47 52 PreferredNodeWidth = 80; … … 50 55 private void GeneratePrimitives(double preferredNodeWidth, double preferredNodeHeight) { 51 56 Clear(); 52 LayoutEngine.Initialize(SymbolicExpressionTree.Root, node => node.Subtrees); 53 LayoutEngine.CalculateLayout(); 57 ISymbolicExpressionTreeNode root = SymbolicExpressionTree.Root; 58 if (root.Symbol is ProgramRootSymbol && root.SubtreeCount == 1) { root = root.GetSubtree(0); } 59 var visualNodes = LayoutEngine.CalculateLayout(root); 54 60 55 var primitivesMap = new Dictionary<ISymbolicExpressionTreeNode, IPrimitive>(); // both Ellipse and Rectangle are derived from the RectangularPrimitiveBase56 61 var font = new Font(FontFamily.GenericSansSerif, 10, GraphicsUnit.Pixel); 57 62 58 var visualNodes = LayoutEngine.GetVisualNodes().ToList();59 63 var visualNodeMap = visualNodes.ToDictionary(x => x.Content, x => x); 60 64 … … 71 75 72 76 this.Add(rectangularPrimitive); 73 primitivesMap.Add(node, rectangularPrimitive);74 77 } 75 78 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Interfaces/ISymbolicExpressionTreeNodeComparer.cs
r10269 r10650 2 2 3 3 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { 4 public interface ISymbolicExpressionTreeNodeComparer : IComparer<ISymbolicExpressionTreeNode> { 5 6 } 4 public interface ISymbolicExpressionTreeNodeComparer : IComparer<ISymbolicExpressionTreeNode> { } 7 5 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs
r10302 r10650 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Drawing; … … 26 47 } 27 48 49 public IGenealogyGraphNode SelectedGraphNode { get; private set; } 50 28 51 private void Clear() { 29 52 if (nodeMap == null) … … 41 64 private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> arcMap; 42 65 66 #region chart modes 43 67 public bool SimpleLineages { get; set; } 44 68 public bool LockGenealogy { get; set; } 69 public bool TraceFragments { get; set; } 70 #endregion 71 45 72 private Visualization.Rectangle TargetRectangle { get; set; } 73 private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished 74 private VisualGenealogyGraphNode SelectedVisualNode { get; set; } 46 75 47 76 private VisualGenealogyGraphNode GetMappedNode(IGenealogyGraphNode node) { … … 62 91 return arc; 63 92 } 64 private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished 65 private VisualGenealogyGraphNode SelectedVisualNode { get; set; } 66 67 public event MouseEventHandler GenealogyGraphNodeClicked; 68 private void OnGenealogyGraphNodeClicked(object sender, MouseEventArgs e) { 69 var clicked = GenealogyGraphNodeClicked; 70 if (clicked != null) clicked(sender, e); 71 } 93 72 94 public GenealogyGraphChart() 73 95 : base() { 74 96 InitializeComponent(); 75 97 } 98 76 99 protected virtual void DrawGraph(double xIncrement, double yIncrement, double diameter) { 77 100 Chart.UpdateEnabled = false; … … 127 150 DrawInProgress = false; 128 151 } 152 153 public event MouseEventHandler GenealogyGraphNodeClicked; 154 private void OnGenealogyGraphNodeClicked(object sender, MouseEventArgs e) { 155 var clicked = GenealogyGraphNodeClicked; 156 if (clicked != null) clicked(sender, e); 157 } 158 159 #region event handlers 129 160 protected override void pictureBox_MouseMove(object sender, MouseEventArgs e) { 130 161 if (!DrawInProgress) { … … 160 191 SelectedVisualNode = visualNodes[0] as VisualGenealogyGraphNode; 161 192 if (SelectedVisualNode == null) return; 193 SelectedGraphNode = SelectedVisualNode.Data; 162 194 163 195 if (!LockGenealogy) { … … 188 220 base.pictureBox_MouseUp(sender, e); 189 221 } 222 #endregion 223 190 224 private void DrawLineage(VisualGenealogyGraphNode node, Func<VisualGenealogyGraphNode, IEnumerable<VisualGenealogyGraphArc>> arcSelector, Func<VisualGenealogyGraphArc, VisualGenealogyGraphNode> nodeSelector) { 191 225 if (node.Brush != null) return; … … 205 239 } 206 240 } 241 207 242 void MarkSelectedNode() { 208 243 var center = SelectedVisualNode.Center; … … 219 254 } 220 255 } 256 221 257 private static VisualGenealogyGraphArc AddArc(IChart chart, VisualGenealogyGraphNode source, VisualGenealogyGraphNode target, Pen pen, Brush brush = null) { 222 258 var arc = new VisualGenealogyGraphArc(chart, source, target, pen) { Brush = brush }; … … 227 263 return arc; 228 264 } 265 229 266 public virtual void ClearPrimitives() { 230 267 foreach (var primitive in Chart.Group.Primitives) { … … 236 273 } 237 274 } 275 238 276 public void HighlightNodes(IEnumerable<IGenealogyGraphNode> nodes) { 239 277 Chart.UpdateEnabled = false; 240 278 ClearPrimitives(); 241 279 foreach (var node in nodes) { 242 GetMappedNode(node).Brush = new SolidBrush(node.GetColor()); 280 var graphNode = GetMappedNode(node); 281 graphNode.Brush = new SolidBrush(node.GetColor()); 243 282 } 244 283 Chart.UpdateEnabled = true; 245 284 Chart.EnforceUpdate(); 246 285 } 286 247 287 public void HighlightAll() { 248 288 Chart.UpdateEnabled = false; … … 261 301 } 262 302 } 303 263 304 internal static class Util { 264 305 public static Color GetColor(this IGenealogyGraphNode node) { -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/VisualGenealogyGraphTextLabel.cs
r10271 r10650 5 5 namespace HeuristicLab.EvolutionTracking.Views { 6 6 public class VisualGenealogyGraphTextLabel : Rectangle { 7 private string text;8 public string Text { get { return text; } set { text = value; } }9 10 private Font font;11 public Font Font { get { return font; } set { font = value; } }7 // private string text; 8 // public string Text { get { return text; } set { text = value; } } 9 // 10 // private Font font; 11 // public Font Font { get { return font; } set { font = value; } } 12 12 13 13 private Brush fontBrush; … … 32 32 33 33 float fontSize = s.Height; 34 font = new Font(font.Name, fontSize, Font.Style, GraphicsUnit.Pixel);35 graphics.DrawString( text, font, fontBrush, p.X, p.Y);34 var font = new Font(Font.Name, fontSize, Font.Style, GraphicsUnit.Pixel); 35 graphics.DrawString(Text, font, fontBrush, p.X, p.Y); 36 36 } 37 37 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Analyzers/GenealogyAnalyzer.cs
r10462 r10650 93 93 get { return GenerationsParameter.ActualValue; } 94 94 } 95 public IGenealogyGraph GenealogyGraph {95 public IGenealogyGraph<T> GenealogyGraph { 96 96 get { 97 97 IResult result; 98 98 if (!Results.ContainsKey(PopulationGraphParameterName)) { 99 result = new Result(PopulationGraphParameterName, new GenealogyGraph ());99 result = new Result(PopulationGraphParameterName, new GenealogyGraph<T>()); 100 100 Results.Add(result); 101 101 } else { 102 102 result = Results[PopulationGraphParameterName]; 103 103 } 104 var graph = (IGenealogyGraph )result.Value;104 var graph = (IGenealogyGraph<T>)result.Value; 105 105 return graph; 106 106 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IVertex.cs
r10300 r10650 45 45 46 46 public interface IVertex<T> : IVertex 47 where T : class ,IItem{47 where T : class { 48 48 new T Content { get; set; } 49 49 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Fragment.cs
r10501 r10650 8 8 public class Fragment : Item, IFragment { 9 9 [Storable] 10 public int NewPos{ get; set; }10 public int Index { get; set; } 11 11 12 12 [Storable] 13 public int Old Pos{ get; set; }13 public int OldIndex { get; set; } 14 14 15 15 [Storable] … … 23 23 : base(original, cloner) { 24 24 Root = original.Root; 25 NewPos = original.NewPos;26 Old Pos = original.OldPos;25 Index = original.Index; 26 OldIndex = original.OldIndex; 27 27 } 28 28 public override IDeepCloneable Clone(Cloner cloner) { -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs
r10347 r10650 80 80 public class GenealogyGraph<T> : DirectedGraph, IGenealogyGraph<T> where T : class, IItem { 81 81 [Storable] 82 private Dictionary<double, LinkedList<IGenealogyGraphNode <T>>> ranks;83 public Dictionary<double, LinkedList<IGenealogyGraphNode <T>>> Ranks {82 private Dictionary<double, LinkedList<IGenealogyGraphNode>> ranks; 83 public Dictionary<double, LinkedList<IGenealogyGraphNode>> Ranks { 84 84 get { return ranks; } 85 85 set { ranks = value; } … … 94 94 protected GenealogyGraph(bool deserializing) : base(deserializing) { } 95 95 public GenealogyGraph() { 96 Ranks = new Dictionary<double, LinkedList<IGenealogyGraphNode <T>>>();96 Ranks = new Dictionary<double, LinkedList<IGenealogyGraphNode>>(); 97 97 } 98 98 public override void AddVertex(IVertex vertex) { 99 99 var node = (IGenealogyGraphNode<T>)vertex; 100 100 if (!Ranks.ContainsKey(node.Rank)) 101 Ranks[node.Rank] = new LinkedList<IGenealogyGraphNode <T>>();101 Ranks[node.Rank] = new LinkedList<IGenealogyGraphNode>(); 102 102 Ranks[node.Rank].AddLast(node); 103 103 base.AddVertex(vertex); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraph.cs
r10300 r10650 25 25 namespace HeuristicLab.EvolutionTracking { 26 26 public interface IGenealogyGraph : IDirectedGraph { 27 Dictionary<double, LinkedList<IGenealogyGraphNode>> Ranks { get; set;}27 Dictionary<double, LinkedList<IGenealogyGraphNode>> Ranks { get; } 28 28 } 29 29 30 public interface IGenealogyGraph<T> : IDirectedGraph 31 where T : class,IItem { 32 Dictionary<double, LinkedList<IGenealogyGraphNode<T>>> Ranks { get; set; } 33 } 30 public interface IGenealogyGraph<T> : IGenealogyGraph where T : class,IItem { } 34 31 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraphNode.cs
r10300 r10650 36 36 } 37 37 38 public interface IGenealogyGraphNode<T> : IGenealogyGraphNode, IVertex<T> where T : class ,IItem{ }38 public interface IGenealogyGraphNode<T> : IGenealogyGraphNode, IVertex<T> where T : class { } 39 39 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Interfaces/IFragment.cs
r10347 r10650 25 25 public interface IFragment : IItem { 26 26 object Root { get; set; } 27 int NewPos{ get; set; }28 int Old Pos{ get; set; }27 int Index { get; set; } 28 int OldIndex { get; set; } 29 29 } 30 30 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterCrossoverOperator.cs
r10462 r10650 28 28 [StorableClass] 29 29 [Item("AfterCrossoverOperator", "A generic operator that can record genealogical relationships between crossover parents and children.")] 30 public class AfterCrossoverOperator<T> : EvolutionTrackingOperator , ICrossoverOperator<T> where T : class,IItem {30 public class AfterCrossoverOperator<T> : EvolutionTrackingOperator<T>, ICrossoverOperator<T> where T : class,IItem { 31 31 private const string DefaultParentsParameterName = "Parents"; 32 32 private const string DefaultChildParameterName = "Child"; -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterManipulatorOperator.cs
r10347 r10650 28 28 [StorableClass] 29 29 [Item("AfterCrossoverOperator", "Performs an action after the crossover operator is applied.")] 30 public class AfterManipulatorOperator<T> : EvolutionTrackingOperator , IManipulatorOperator<T> where T : class,IItem {30 public class AfterManipulatorOperator<T> : EvolutionTrackingOperator<T>, IManipulatorOperator<T> where T : class,IItem { 31 31 32 32 private const string ChildParameterName = "Child"; -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterSolutionCreatorOperator.cs
r10347 r10650 27 27 [StorableClass] 28 28 [Item("AfterSolutionCreatorOperator", "An operator that runs after the solution creator and performs additional actions.")] 29 public class AfterSolutionCreatorOperator<T> : EvolutionTrackingOperator 29 public class AfterSolutionCreatorOperator<T> : EvolutionTrackingOperator<T> 30 30 where T : class,IItem { 31 31 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeCrossoverOperator.cs
r10347 r10650 31 31 [StorableClass] 32 32 [Item("AfterCrossoverOperator", "A generic operator that can record genealogical relationships between crossover parents and children.")] 33 public class BeforeCrossoverOperator<T> : EvolutionTrackingOperator , ICrossoverOperator<T> where T : class,IItem {33 public class BeforeCrossoverOperator<T> : EvolutionTrackingOperator<T>, ICrossoverOperator<T> where T : class,IItem { 34 34 private const string defaultParentsParameterName = "Parents"; 35 35 private const string defaultChildParameterName = "Child"; -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeManipulatorOperator.cs
r10347 r10650 29 29 [StorableClass] 30 30 [Item("AfterCrossoverOperator", "Performs an action after the crossover operator is applied.")] 31 public class BeforeManipulatorOperator<T> : EvolutionTrackingOperator , IManipulatorOperator<T> where T : class,IItem {31 public class BeforeManipulatorOperator<T> : EvolutionTrackingOperator<T>, IManipulatorOperator<T> where T : class,IItem { 32 32 33 33 private const string ChildParameterName = "Child"; -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/EvolutionTrackingOperator.cs
r10300 r10650 28 28 29 29 namespace HeuristicLab.EvolutionTracking { 30 public class EvolutionTrackingOperator : SingleSuccessorOperator{30 public class EvolutionTrackingOperator<T> : SingleSuccessorOperator where T : class,IItem { 31 31 // evolution tracking-related parameters 32 32 private const string resultsParameterName = "Results"; … … 46 46 get { return GenerationsParameter.ActualValue; } 47 47 } 48 public IGenealogyGraph GenealogyGraph {48 public IGenealogyGraph<T> GenealogyGraph { 49 49 get { 50 50 IResult result; 51 51 if (!Results.ContainsKey(populationGraphParameterName)) { 52 result = new Result(populationGraphParameterName, new GenealogyGraph ());52 result = new Result(populationGraphParameterName, new GenealogyGraph<T>()); 53 53 Results.Add(result); 54 54 } else { 55 55 result = Results[populationGraphParameterName]; 56 56 } 57 var graph = (GenealogyGraph )result.Value;57 var graph = (GenealogyGraph<T>)result.Value; 58 58 return graph; 59 59 } … … 63 63 Parameters.Add(new LookupParameter<ResultCollection>(resultsParameterName)); 64 64 } 65 protected EvolutionTrackingOperator(EvolutionTrackingOperator original, Cloner cloner)65 protected EvolutionTrackingOperator(EvolutionTrackingOperator<T> original, Cloner cloner) 66 66 : base(original, cloner) { 67 67 } 68 68 public override IDeepCloneable Clone(Cloner cloner) { 69 return new EvolutionTrackingOperator (this, cloner);69 return new EvolutionTrackingOperator<T>(this, cloner); 70 70 } 71 71 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic merged: 10562-10563
- Property svn:mergeinfo changed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views merged: 10545,10561,10564
- Property svn:mergeinfo changed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
r10514 r10650 219 219 <DependentUpon>SlidingWindowDataView.cs</DependentUpon> 220 220 </Compile> 221 <Compile Include="SymboldDataAnalysisGenealogyView.cs"> 222 <SubType>UserControl</SubType> 223 </Compile> 224 <Compile Include="SymboldDataAnalysisGenealogyView.Designer.cs"> 225 <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon> 226 </Compile> 227 <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.cs"> 228 <SubType>UserControl</SubType> 229 </Compile> 230 <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs"> 231 <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon> 232 </Compile> 221 233 <Compile Include="SymbolicDataAnalysisExpressionLineageExplorerChart.cs"> 222 234 <SubType>UserControl</SubType> -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs
r9462 r10650 19 19 */ 20 20 #endregion 21 21 22 22 23 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { … … 137 138 // 138 139 // btnOptimizeConstants 139 // 140 this.btnOptimizeConstants.A nchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));140 // 141 this.btnOptimizeConstants.AutoSize = true; 141 142 this.btnOptimizeConstants.Enabled = false; 142 this.btnOptimizeConstants.Location = new System.Drawing.Point(104, 3); 143 // this.btnOptimizeConstants.Image = HeuristicLab.Common.Resources.VSImageLibrary.Performance; 144 this.btnOptimizeConstants.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; 145 this.btnOptimizeConstants.Location = new System.Drawing.Point(105, 3); 143 146 this.btnOptimizeConstants.Name = "btnOptimizeConstants"; 144 this.btnOptimizeConstants.Size = new System.Drawing.Size( 97, 23);147 this.btnOptimizeConstants.Size = new System.Drawing.Size(80, 24); 145 148 this.btnOptimizeConstants.TabIndex = 2; 146 149 this.btnOptimizeConstants.Text = "Optimize"; 150 this.btnOptimizeConstants.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 151 this.btnOptimizeConstants.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 147 152 this.btnOptimizeConstants.UseVisualStyleBackColor = true; 148 153 this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click); … … 150 155 // btnSimplify 151 156 // 157 this.btnSimplify.AutoSize = true; 158 this.btnSimplify.Enabled = true; 159 // this.btnSimplify.Image = HeuristicLab.Common.Resources.VSImageLibrary.FormulaEvaluator; 160 this.btnSimplify.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; 152 161 this.btnSimplify.Location = new System.Drawing.Point(3, 3); 153 162 this.btnSimplify.Name = "btnSimplify"; 154 this.btnSimplify.Size = new System.Drawing.Size( 95, 23);163 this.btnSimplify.Size = new System.Drawing.Size(80, 24); 155 164 this.btnSimplify.TabIndex = 1; 156 165 this.btnSimplify.Text = "Simplify"; 166 this.btnSimplify.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 167 this.btnSimplify.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 157 168 this.btnSimplify.UseVisualStyleBackColor = true; 158 169 this.btnSimplify.Click += new System.EventHandler(this.btnSimplify_Click); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r10524 r10650 52 52 Content.ModelChanged += Content_Changed; 53 53 Content.ProblemDataChanged += Content_Changed; 54 treeChart.Repainted += treeChart_Repainted; 54 55 } 55 56 protected override void DeregisterContentEvents() { … … 57 58 Content.ModelChanged -= Content_Changed; 58 59 Content.ProblemDataChanged -= Content_Changed; 60 treeChart.Repainted -= treeChart_Repainted; 59 61 } 60 62 … … 68 70 UpdateView(); 69 71 viewHost.Content = this.Content; 72 } 73 74 private void treeChart_Repainted(object sender, EventArgs e) { 75 if (nodeImpacts != null && nodeImpacts.Count > 0) 76 PaintNodeImpacts(); 70 77 } 71 78 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs
r10524 r10650 32 32 33 33 internal sealed partial class InteractiveSymbolicExpressionTreeChart : SymbolicExpressionTreeChart { 34 private ISymbolicExpressionTreeNode tempNode; // 35 private VisualTreeNode<ISymbolicExpressionTreeNode> currSelected; // 34 private ISymbolicExpressionTreeNode tempNode; //node in clipboard (to be cut/copy/pasted etc) 35 private VisualTreeNode<ISymbolicExpressionTreeNode> currSelected; //currently selected node 36 36 private enum EditOp { NoOp, CopySubtree, CutSubtree } 37 37 private EditOp lastOp = EditOp.NoOp; … … 218 218 if (tempNode.IterateNodesBreadth().Contains(node)) 219 219 throw new ArgumentException();// cannot cut/paste a node into itself 220 ModifyTree(Tree, tempNode.Parent, tempNode, null); //remove node from its original parent 220 ModifyTree(Tree, tempNode.Parent, tempNode, null); //remove node from its original parent 221 221 ModifyTree(Tree, node, null, tempNode); //insert it as a child to the new parent 222 222 break; -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame
r10037 r10650 32 32 [PluginDependency("HeuristicLab.Collections", "3.3")] 33 33 [PluginDependency("HeuristicLab.Common", "3.3")] 34 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] 34 35 [PluginDependency("HeuristicLab.Core", "3.3")] 35 36 [PluginDependency("HeuristicLab.Core.Views", "3.3")] -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionLineageExplorerChart.cs
r10517 r10650 1 1 using System.Collections.Generic; 2 2 using System.Drawing; 3 using System.Windows.Forms; 3 4 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views; 4 5 using HeuristicLab.Visualization; … … 59 60 } 60 61 } 62 63 protected override void pictureBox_MouseUp(object sender, MouseEventArgs e) { 64 base.pictureBox_MouseUp(sender, e); 65 // get the selected primitive and update it's graphics 66 var point = new Point(e.X, e.Y); 67 68 var selectedPrimitives = Chart.GetAllPrimitives(point); 69 // first primitive in the list should be the tile, the second one should be the actual primitive representing a tree node 70 var tile = (SymbolicExpressionTreeTile)selectedPrimitives[0]; 71 var selectedPrimitive = (RectangularPrimitiveBase)selectedPrimitives[1]; 72 var tree = tile.SymbolicExpressionTree; // use the tree to get the genealogy graph node and the fragments used for tracing building blocks 73 74 var pen = new Pen(Color.Blue); 75 using (var g = Graphics.FromImage(pictureBox.Image)) { 76 g.DrawRectangle(pen, (float)selectedPrimitive.LowerLeft.X, (float)selectedPrimitive.LowerLeft.Y, (float)selectedPrimitive.Size.Width, (float)selectedPrimitive.Size.Height); 77 } 78 } 61 79 } 62 80 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionLineageExplorerView.cs
r10524 r10650 30 30 public SymbolicDataAnalysisExpressionLineageExplorerView() { 31 31 InitializeComponent(); 32 symbolicExpressionTreeNodeLayoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> {32 symbolicExpressionTreeNodeLayoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode>(node => node.Subtrees) { 33 33 HorizontalSpacing = MinHorizontalSpacing, 34 34 VerticalSpacing = MinVerticalSpacing, … … 36 36 NodeHeight = PreferredNodeHeight 37 37 }; 38 38 39 treeMap = new Dictionary<TreeNode, ISymbolicExpressionTree>(); 39 40 double width = lineageExplorerChart.PreferredSize.Width; … … 43 44 } 44 45 } 45 46 46 47 47 #region events -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r10464 r10650 189 189 <SubType>Code</SubType> 190 190 </Compile> 191 <Compile Include="Matching\SymbolicExpressionTreeCanonicalSorter.cs" /> 192 <Compile Include="Matching\SymbolicExpressionTreeEqualityComparer.cs" /> 193 <Compile Include="Matching\SymbolicExpressionTreeMatching.cs" /> 194 <Compile Include="Matching\SymbolicExpressionTreeMaxCommonSequenceCalculator.cs" /> 195 <Compile Include="Matching\SymbolicExpressionTreeNodeComparer.cs" /> 196 <Compile Include="Matching\SymbolicExpressionTreeNodeSimilarityComparer.cs" /> 191 197 <Compile Include="SlidingWindow\GenerationalSlidingWindowAnalyzer.cs" /> 192 198 <Compile Include="SlidingWindow\OffspringSelectionSlidingWindowAnalyzer.cs" /> … … 198 204 <Compile Include="SymbolGraph\SymbolGraph.cs" /> 199 205 <Compile Include="SymbolicDataAnalysisExpressionPruningOperator.cs" /> 200 <Compile Include="SymbolicDataAnalysisExpressionTreeMatching.cs" />201 206 <Compile Include="SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs" /> 202 207 <Compile Include="SymbolicDataAnalysisSolutionPruningOptimizer.cs" /> -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs
r10464 r10650 84 84 Parameters.Add(new ValueParameter<ISymbolicExpressionTree>(CurrentSymbolicExpressionTreeParameterName, "")); 85 85 Parameters.Add(new LookupParameter<BoolValue>(MatchVariablesParameterName, "Specify if the symbolic expression tree comparer should match variable names.")); 86 Parameters.Add(new LookupParameter<BoolValue>(MatchVariableWeightsParameterName, "Specify if the symbolic expression tree comparer should match variable we ights."));86 Parameters.Add(new LookupParameter<BoolValue>(MatchVariableWeightsParameterName, "Specify if the symbolic expression tree comparer should match variable weghts.")); 87 87 Parameters.Add(new LookupParameter<BoolValue>(MatchConstantValuesParameterName, "Specify if the symbolic expression tree comparer should match constant values.")); 88 88 Parameters.Add(new LookupParameter<DoubleValue>(SimilarityValuesParmeterName, "")); … … 113 113 } 114 114 115 public static double CalculateSimilarity(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b, 116 SymbolicExpressionTreeNodeSimilarityComparer comp) { 117 return 2.0 * SymbolicExpressionTreeMatching.Match(a, b, comp) / (a.GetLength() + b.GetLength()); 115 public static double CalculateSimilarity(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b, SymbolicExpressionTreeNodeSimilarityComparer comparer) { 116 return 2.0 * SymbolicExpressionTreeMatching.Match(a, b, comparer) / (a.GetLength() + b.GetLength()); 118 117 } 119 118 120 public static double MaxCommonSubtreeSimilarity(ISymbolicExpressionTree a, ISymbolicExpressionTree b, 121 SymbolicExpressionTreeNodeSimilarityComparer comparer) { 122 double max = 0; 119 /// <summary> 120 /// Try to match each pair of nodes from trees a and b and return a similarity value based on the maximum number of matched node pairs. 121 /// </summary> 122 /// <param name="a"></param> 123 /// <param name="b"></param> 124 /// <param name="comparer"></param> 125 /// <returns>A similarity value computed as 2.0 * MaxNumberOfMatchedPairs / (Sum of both tree sizes)</returns> 126 public static double MaxCommonSubtreeSimilarity(ISymbolicExpressionTree a, ISymbolicExpressionTree b, SymbolicExpressionTreeNodeSimilarityComparer comparer) { 127 int max = 0; 123 128 var rootA = a.Root.GetSubtree(0).GetSubtree(0); 124 129 var rootB = b.Root.GetSubtree(0).GetSubtree(0); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs
r10459 r10650 21 21 fragment = new Fragment<ISymbolicExpressionTreeNode> { 22 22 Root = childNodes[i], 23 NewPos= i23 Index = i 24 24 }; 25 25 } … … 28 28 for (int i = 0; i < nodes1.Count; ++i) { 29 29 if (nodes1[i] != fragment.Root) continue; 30 fragment.Old Pos= i;30 fragment.OldIndex = i; 31 31 } 32 32 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterManipulatorOperator.cs
r10347 r10650 28 28 fragment = new Fragment<ISymbolicExpressionTreeNode> { 29 29 Root = nodesAfter[i], 30 NewPos= i30 Index = i 31 31 }; 32 32 }
Note: See TracChangeset
for help on using the changeset viewer.