Free cookie consent management tool by TermsFeed Policy Generator

source: branches/1073_FitnessLandscapeAnalysis-VRP/VRPProblemAnalyzer/EnumerableExtensions.cs @ 16405

Last change on this file since 16405 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.