Changeset 9384


Ignore:
Timestamp:
04/19/13 13:47:47 (7 years ago)
Author:
ascheibe
Message:

#1886 added calculation of selection intensity

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/SelectionPressureAnalyzer.cs

    r9341 r9384  
    2222
    2323using System;
     24using System.Collections.Generic;
    2425using System.Linq;
    2526using HeuristicLab.Common;
     
    6566    }
    6667    [Storable]
    67     private ScatterPlotHelper selPressurePlot;
     68    private ScatterPlotHelper selPressurePlot, selIntensityPlot;
    6869    [Storable]
    6970    private int cnt = 0;
     
    7980      lastGeneration = original.lastGeneration;
    8081      selPressurePlot = (ScatterPlotHelper)original.selPressurePlot.Clone(cloner);
     82      selIntensityPlot = (ScatterPlotHelper)original.selIntensityPlot.Clone(cloner);
    8183      SolutionQualityName = original.SolutionQualityName;
    8284    }
     
    9395
    9496      selPressurePlot = new ScatterPlotHelper(false, true, true, true);
     97      selIntensityPlot = new ScatterPlotHelper(false, true, true, true);
    9598    }
    9699
     
    101104    protected override void InitializeAction() {
    102105      selPressurePlot.InitializePlot(Results, "Selection Pressure", "Solution Index", "Quality Difference");
     106      selIntensityPlot.InitializePlot(Results, "Selection Intensity", "Solution Index", "Scaled Quality Difference");
    103107      ParentsQualityParameter.ActualName = SolutionQualityName;
    104108
     
    121125
    122126        double oldPopQuality = 0.0;
     127        List<double> qValues = new List<double>();
    123128        int popSize = 0;
    124129        foreach (IScope oldSolScope in oldPop.SubScopes) {
    125130          double curQuality = ((DoubleValue)oldSolScope.Variables[SolutionQualityName].Value).Value;
    126131          oldPopQuality += curQuality;
     132          qValues.Add(curQuality);
    127133          popSize++;
    128134        }
     
    138144              selPressurePlot.Max = bkQuality - wkQuality;
    139145              selPressurePlot.Min = 0;
     146              selIntensityPlot.Max = bkQuality - wkQuality;
     147              selIntensityPlot.Min = 0;
    140148            }
    141149          } else {
     
    143151              selPressurePlot.Max = wkQuality - bkQuality;
    144152              selPressurePlot.Min = 0;
     153              selIntensityPlot.Max = wkQuality - bkQuality;
     154              selIntensityPlot.Min = 0;
    145155            }
    146156          }
    147157        }
    148158
    149         Point2D<double> popQualityPoint;
     159        Point2D<double> popQualityPoint, selectionIntensityPoint;
    150160        if (MaximizationParameter.ActualValue.Value) {
    151161          popQualityPoint = new Point2D<double>(cnt, quality - (oldPopQuality / popSize));
     162          selectionIntensityPoint = new Point2D<double>(cnt, (quality - (oldPopQuality / popSize) / qValues.StandardDeviation()));
    152163        } else {
    153164          popQualityPoint = new Point2D<double>(cnt, (oldPopQuality / popSize) - quality);
     165          selectionIntensityPoint = new Point2D<double>(cnt, ((oldPopQuality / popSize) - quality) / qValues.StandardDeviation());
    154166        }
    155167
    156168        selPressurePlot.AddPoint(curGenStr, popQualityPoint);
     169        selIntensityPlot.AddPoint(curGenStr, selectionIntensityPoint);
    157170      }
    158171
     
    167180    public override void ClearState() {
    168181      selPressurePlot.CleanUp();
     182      selIntensityPlot.CleanUp();
    169183    }
    170184
Note: See TracChangeset for help on using the changeset viewer.