- Timestamp:
- 11/19/15 11:42:02 (9 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 12921,12936-12938,12940,12947,13055-13058,13163,13267,13269
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding merged: 12921
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeProblem.cs
r13278 r13280 26 26 using HeuristicLab.Common; 27 27 using HeuristicLab.Core; 28 using HeuristicLab.Data; 28 29 using HeuristicLab.Optimization; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 56 57 } 57 58 58 public virtual void Analyze(ISymbolicExpressionTree[] trees, double[] qualities, ResultCollection results, IRandom random) { 59 var bestQuality = Maximization ? qualities.Max() : qualities.Min(); 60 var bestIdx = Array.IndexOf(qualities, bestQuality); 61 var best = trees[bestIdx]; 59 public virtual void Analyze(ISymbolicExpressionTree[] trees, double[] qualities, ResultCollection results, 60 IRandom random) { 61 if (!results.ContainsKey("Best Solution Quality")) { 62 results.Add(new Result("Best Solution Quality", typeof(DoubleValue))); 63 } 62 64 if (!results.ContainsKey("Best Solution")) { 63 65 results.Add(new Result("Best Solution", typeof(ISymbolicExpressionTree))); 64 66 } 65 results["Best Solution"].Value = (IItem)best.Clone(); 67 68 var bestQuality = Maximization ? qualities.Max() : qualities.Min(); 69 70 if (results["Best Solution Quality"].Value == null || 71 IsBetter(bestQuality, ((DoubleValue)results["Best Solution Quality"].Value).Value)) { 72 var bestIdx = Array.IndexOf(qualities, bestQuality); 73 var bestClone = (IItem)trees[bestIdx].Clone(); 74 results["Best Solution"].Value = bestClone; 75 results["Best Solution Quality"].Value = new DoubleValue(bestQuality); 76 } 66 77 } 78 67 79 public sealed override void Analyze(Individual[] individuals, double[] qualities, ResultCollection results, IRandom random) { 68 80 Analyze(individuals.Select(ind => ind.SymbolicExpressionTree()).ToArray(), qualities, results, random);
Note: See TracChangeset
for help on using the changeset viewer.