- Timestamp:
- 07/26/15 21:32:52 (9 years ago)
- Location:
- branches/PerformanceComparison/HeuristicLab.Analysis/3.3/QualityAnalysis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityPerClockAnalyzer.cs
r12803 r12804 75 75 76 76 public override IOperation Apply() { 77 var lastUpdateTime = LastUpdateTimeParameter.ActualValue;78 if (lastUpdateTime == null) {79 lastUpdateTime = new DateTimeValue(DateTime.UtcNow.AddMilliseconds(-1));80 LastUpdateTimeParameter.ActualValue = lastUpdateTime;81 }82 var now = DateTime.UtcNow;83 84 77 var bestQuality = BestQualityParameter.ActualValue.Value; 85 86 78 var dataTable = QualityPerClockParameter.ResultValue; 87 79 var values = dataTable.Rows["First-hit Graph"].Values; 88 if (values.Count == 0 || values.Last().Item2 != bestQuality)89 dataTable.Rows["First-hit Graph"].Values.Add(Tuple.Create((now - lastUpdateTime.Value).TotalSeconds, bestQuality));90 80 91 lastUpdateTime.Value = now; 81 if (values.Count == 0 || values.Last().Item2 != bestQuality) { 82 var lastUpdateTime = LastUpdateTimeParameter.ActualValue; 83 if (lastUpdateTime == null) { 84 lastUpdateTime = new DateTimeValue(DateTime.UtcNow.AddMilliseconds(-1)); 85 LastUpdateTimeParameter.ActualValue = lastUpdateTime; 86 } 87 88 var now = DateTime.UtcNow; 89 var runtimeSoFar = (now - lastUpdateTime.Value).TotalSeconds + (values.Count > 0 ? values.Last().Item1 : 0); 90 dataTable.Rows["First-hit Graph"].Values.Add(Tuple.Create(runtimeSoFar, bestQuality)); 91 lastUpdateTime.Value = now; 92 } 92 93 return base.Apply(); 93 94 } -
branches/PerformanceComparison/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityPerEvaluationsAnalyzer.cs
r12774 r12804 44 44 get { return (ILookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 45 45 } 46 public ILookupParameter<IntValue> EvaluatedMovesParameter { 47 get { return (ILookupParameter<IntValue>)Parameters["EvaluatedMoves"]; } 48 } 49 public IValueLookupParameter<DoubleValue> MoveCostPerSolutionParameter { 50 get { return (IValueLookupParameter<DoubleValue>)Parameters["MoveCostPerSolution"]; } 51 } 46 52 public IResultParameter<IndexedDataTable<double>> QualityPerEvaluationsParameter { 47 53 get { return (IResultParameter<IndexedDataTable<double>>)Parameters["QualityPerEvaluations"]; } … … 54 60 : base() { 55 61 Parameters.Add(new LookupParameter<DoubleValue>("BestQuality", "The quality value that should be compared.")); 56 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The quality value that should be compared.")); 62 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions.")); 63 Parameters.Add(new LookupParameter<IntValue>("EvaluatedMoves", "The number of evaluated moves.")); 64 Parameters.Add(new ValueLookupParameter<DoubleValue>("MoveCostPerSolution", "The cost to evaluate a move as a ratio to the cost of evaluating a solution.", new DoubleValue(1))); 57 65 Parameters.Add(new ResultParameter<IndexedDataTable<double>>("QualityPerEvaluations", "Data table containing the first hitting graph with evaluations as the x-axis.")); 58 66 QualityPerEvaluationsParameter.DefaultValue = new IndexedDataTable<double>("Quality per Evaluations") { … … 74 82 public override IOperation Apply() { 75 83 var bestQuality = BestQualityParameter.ActualValue.Value; 76 var evaluations = Math.Max(EvaluatedSolutionsParameter.ActualValue.Value, 1); 84 var evalSols = EvaluatedSolutionsParameter.ActualValue; 85 var evalMoves = EvaluatedMovesParameter.ActualValue; 86 var evaluations = 0.0; 87 if (evalSols != null) evaluations += evalSols.Value; 88 if (evalMoves != null) evaluations += evalMoves.Value * MoveCostPerSolutionParameter.ActualValue.Value; 77 89 78 90 var dataTable = QualityPerEvaluationsParameter.ResultValue; 79 91 var values = dataTable.Rows["First-hit Graph"].Values; 92 if (evaluations == 0 || values.Count > 0 && evaluations < values.Last().Item1) evaluations = 1; 80 93 if (values.Count == 0 || values.Last().Item2 != bestQuality) 81 94 values.Add(Tuple.Create((double)evaluations, bestQuality));
Note: See TracChangeset
for help on using the changeset viewer.