Free cookie consent management tool by TermsFeed Policy Generator

source: branches/FitnessLandscapeAnalysis/VRPProblemAnalyzer/EnumerableExtensions.cs @ 9786

Last change on this file since 9786 was 7315, checked in by epitzer, 13 years ago

#1696: Add VRP depot excentricity metrics

File size: 491 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5
6namespace VRPProblemAnalyzer {
7  public static class EnumerableExtensions {
8    public static double StandardDeviation(this IEnumerable<double> data) {
9      var dataList = data.ToList();
10      double average = dataList.Average();
11      var individualDeviations = dataList.Select(num => Math.Pow(num - average, 2.0));
12      return Math.Sqrt(individualDeviations.Average());
13    }
14  }
15}
Note: See TracBrowser for help on using the repository browser.