Changeset 10293
- Timestamp:
- 01/07/14 12:31:18 (11 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding merged: 10291
- Property svn:mergeinfo changed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Vertex.cs
r10285 r10293 78 78 // enforce the correct and desired behavior. 79 79 public void AddForwardArc(IVertex target, double w = 0.0, object data = null) { 80 var e= new Arc { Source = this, Target = target, Data = data, Weight = w };81 if (OutArcs == null) OutArcs = new List<IArc> { e};82 else OutArcs.Add( e);80 var arc = new Arc { Source = this, Target = target, Data = data, Weight = w }; 81 if (OutArcs == null) OutArcs = new List<IArc> { arc }; 82 else OutArcs.Add(arc); 83 83 } 84 84 public void AddForwardArc(IArc arc) { … … 93 93 } 94 94 public void AddReverseArc(IVertex source, double w = 0.0, object data = null) { 95 var e= new Arc { Source = source, Target = this, Data = data, Weight = w };96 if (InArcs == null) InArcs = new List<IArc> { e};97 else InArcs.Add( e);95 var arc = new Arc { Source = source, Target = this, Data = data, Weight = w }; 96 if (InArcs == null) InArcs = new List<IArc> { arc }; 97 else InArcs.Add(arc); 98 98 } 99 99 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphArc.cs
r10285 r10293 39 39 return new GenealogyGraphArc(this, cloner); 40 40 } 41 public new IGenealogyGraphNode Source { get; set; }42 public new IGenealogyGraphNode Target { get; set; }43 41 42 public new IGenealogyGraphNode Source { 43 get { return (IGenealogyGraphNode)base.Source; } 44 set { base.Source = value; } 45 } 44 46 47 public new IGenealogyGraphNode Target { 48 get { return (IGenealogyGraphNode)base.Target; } 49 set { base.Target = value; } 50 } 45 51 } 46 52 … … 60 66 } 61 67 public new T Data { 62 get { 63 return (T)base.Data; 64 } 65 set { 66 base.Data = value; 67 } 68 get { return (T)base.Data; } 69 set { base.Data = value; } 68 70 } 69 71 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs
r10285 r10293 111 111 112 112 public new void AddForwardArc(IVertex target, double w = 0, object data = null) { 113 var e= new GenealogyGraphArc { Source = this, Target = (IGenealogyGraphNode)target, Data = data, Weight = w };114 base.AddForwardArc( e);113 var arc = new GenealogyGraphArc { Source = this, Target = (IGenealogyGraphNode)target, Data = data, Weight = w }; 114 base.AddForwardArc(arc); 115 115 } 116 116 public new void AddReverseArc(IVertex source, double w = 0.0, object data = null) { 117 var e= new GenealogyGraphArc { Source = (IGenealogyGraphNode)source, Target = this, Data = data, Weight = w };118 base.AddReverseArc( e);117 var arc = new GenealogyGraphArc { Source = (IGenealogyGraphNode)source, Target = this, Data = data, Weight = w }; 118 base.AddReverseArc(arc); 119 119 } 120 120 } … … 124 124 public class GenealogyGraphNode<T> : GenealogyGraphNode, IGenealogyGraphNode<T> where T : class,IItem { 125 125 public T Content { get; set; } 126 126 public GenealogyGraphNode() { } 127 127 } 128 128 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterSolutionCreatorOperator.cs
r10278 r10293 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Parameters;24 23 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 24 … … 32 31 where TContent : class,IItem { 33 32 34 private string newIndividualParameterName;35 public string NewIndividualParameterName {36 get { return newIndividualParameterName; }37 set {38 if (newIndividualParameterName != null && Parameters.ContainsKey(newIndividualParameterName))39 Parameters.Remove(newIndividualParameterName);40 newIndividualParameterName = value;41 if (!Parameters.ContainsKey(newIndividualParameterName)) {42 Parameters.Add(new LookupParameter<TContent>(newIndividualParameterName));43 }44 }45 }46 47 public ILookupParameter<TContent> NewIndividualParameter {48 get { return (ILookupParameter<TContent>)Parameters[NewIndividualParameterName]; }49 }50 public TContent NewIndividual { get { return NewIndividualParameter.ActualValue; } }51 52 33 public override IOperation Apply() { 53 var vertex = new TVertex {54 Content = NewIndividual55 };56 GenealogyGraph.AddVertex(vertex);57 34 return base.Apply(); 58 35 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeManipulatorOperator.cs
r10285 r10293 20 20 #endregion 21 21 22 using System.Collections.Generic;23 22 using System.Linq; 24 23 using HeuristicLab.Common; … … 52 51 public override IOperation Apply() { 53 52 if (GenealogyGraph.Contains(ChildParameter.ActualValue)) { 54 // if the individual has been affected by crossover before mutation, we keep it in the graph and feed a clone of it to the mutation operator55 53 var child = ChildParameter.ActualValue; 56 54 var clone = (TContent)child.Clone(); 57 var vertex = GenealogyGraph[child].Last(); 58 vertex.Content = clone; 59 GenealogyGraph.Ranks[vertex.Rank].Remove(vertex); 60 var newVertex = new TVertex { 61 Content = child, 62 Rank = vertex.Rank 63 }; 64 vertex.Rank -= 0.5; 65 if (!GenealogyGraph.Ranks.ContainsKey(vertex.Rank)) { 66 GenealogyGraph.Ranks[vertex.Rank] = new LinkedList<TVertex>(); 55 var vChild = GenealogyGraph[child].Last(); 56 var vClone = new TVertex { Content = clone, Rank = vChild.Rank - 0.5 }; 57 GenealogyGraph.AddVertex(vClone); 58 // adjust parent-child(clone) relationship in the graph 59 var parents = vChild.InArcs.Select(a => a.Source); 60 vChild.InArcs.Clear(); 61 foreach (var p in parents) { 62 foreach (var a in p.OutArcs) { 63 if (a.Target == vChild) 64 a.Target = vClone; 65 } 66 vClone.AddReverseArc(p); 67 67 } 68 GenealogyGraph.Ranks[vertex.Rank].AddLast(vertex); 69 70 newVertex.AddForwardArc(vertex); 71 vertex.AddReverseArc(vertex); 72 } else { 73 // mutation should never happen without crossover 68 vChild.AddReverseArc(vClone); 69 vClone.AddForwardArc(vChild); 70 } else { // this needs to be checked 71 var vChild = new TVertex { Content = ChildParameter.ActualValue, Rank = Generations.Value }; 72 GenealogyGraph.AddVertex(vChild); 74 73 } 75 74 return base.Apply(); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic merged: 10291
- Property svn:mergeinfo changed
-
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
r10285 r10293 344 344 </Content> 345 345 </ItemGroup> 346 <ItemGroup>347 <EmbeddedResource Include="SymbolicDataAnalysisGenealogyView.resx">348 <DependentUpon>SymbolicDataAnalysisGenealogyView.cs</DependentUpon>349 </EmbeddedResource>350 </ItemGroup>351 346 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 352 347 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs
r9456 r10293 35 35 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 36 36 [StorableClass] 37 public abstract class SymbolicDataAnalysisEvaluator<T> : SingleSuccessorOperator,37 public abstract class SymbolicDataAnalysisEvaluator<T> : InstrumentedOperator, 38 38 ISymbolicDataAnalysisEvaluator<T>, ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator, IStochasticOperator 39 39 where T : class, IDataAnalysisProblemData { -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r10278 r10293 173 173 </ItemGroup> 174 174 <ItemGroup> 175 <Compile Include="Analyzers\SymbolicDataAnalysisGenealogyAnalyzer.cs" /> 175 176 <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer.cs" /> 176 177 <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs" /> -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r10285 r10293 28 28 using HeuristicLab.Data; 29 29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 30 using HeuristicLab.EvolutionTracking;31 30 using HeuristicLab.Optimization; 32 31 using HeuristicLab.Parameters; 33 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 34 33 using HeuristicLab.PluginInfrastructure; 34 using HeuristicLab.Problems.DataAnalysis.Symbolic.Analyzers; 35 35 using HeuristicLab.Problems.Instances; 36 36 37 using TGraph = HeuristicLab.EvolutionTracking.IGenealogyGraph<HeuristicLab.EvolutionTracking.GenealogyGraphNode<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree>,38 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree>;39 using TVertex = HeuristicLab.EvolutionTracking.GenealogyGraphNode<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree>;40 37 41 38 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 236 233 Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer()); 237 234 Operators.Add(new SymbolicExpressionTreeLengthAnalyzer()); 238 Operators.Add(new GenealogyAnalyzer<TGraph, TVertex, ISymbolicExpressionTree>());235 Operators.Add(new SymbolicDataAnalysisGenealogyAnalyzer()); 239 236 ParameterizeOperators(); 240 237 } … … 357 354 } 358 355 // add tracking analyzer 359 foreach (var op in operators.OfType< GenealogyAnalyzer<TGraph, TVertex, ISymbolicExpressionTree>>()) {356 foreach (var op in operators.OfType<SymbolicDataAnalysisGenealogyAnalyzer>()) { 360 357 // get crossover parameter names 361 358 var crossover = operators.OfType<ISymbolicExpressionTreeCrossover>().First();
Note: See TracChangeset
for help on using the changeset viewer.