public double ComputeAverageSpeed(MetricPath path) { double averageSpeed = 0; double roadLength = path.GetLength(); double roadLengthCoveredInEachSegment = roadLength / numberOfLines; double totalTravellingTime = 0; for (int ii = 0; ii < numberOfLines; ii++) { double entrySpeed = this.SegmentLinearSpeedProfileList[0].LinearBezierSplineList[ii].P0.CoordinateList[0]; double exitSpeed = this.SegmentLinearSpeedProfileList[0].LinearBezierSplineList[ii].P1.CoordinateList[0]; double speedDifference = exitSpeed - entrySpeed; if (Math.Abs(speedDifference) < double.Epsilon) { totalTravellingTime += roadLengthCoveredInEachSegment / entrySpeed; } else { totalTravellingTime += Math.Log(exitSpeed / entrySpeed) * roadLengthCoveredInEachSegment / speedDifference; } } averageSpeed = roadLength / totalTravellingTime; return(averageSpeed); }
public void GenerateConstant(MetricPath path, double speed) { segmentLinearSpeedProfileList = new List <SegmentLinearSpeedProfile>(); foreach (MapSegment mapSegment in path.MapSegmentList) { SegmentLinearSpeedProfile segmentLinearSpeedProfile = new SegmentLinearSpeedProfile(); segmentLinearSpeedProfile.GenerateConstant(mapSegment, speed, numberOfLines); segmentLinearSpeedProfileList.Add(segmentLinearSpeedProfile); } }
public void Generate(MetricPath path, List <double> speedList) { segmentLinearSpeedProfileList = new List <SegmentLinearSpeedProfile>(); foreach (MapSegment mapSegment in path.MapSegmentList) { SegmentLinearSpeedProfile segmentLinearSpeedProfile = new SegmentLinearSpeedProfile(); segmentLinearSpeedProfile.Generate(speedList, numberOfLines); segmentLinearSpeedProfileList.Add(segmentLinearSpeedProfile); } }
public bool IsFiltered(List <CounterFilter> filters) { foreach (CounterFilter filter in filters) { if (MetricPath.Contains(filter.Expression)) { return(true); } } return(false); }
public void RunSynchronous(PiecewiseLinearSpeedProfileOptimizationSettings optimizationSettings, Random randomNumberGenerator, double optimizationTime, MetricMap metricMap, MetricPath metricPath) { this.optimizationTime = optimizationTime; this.optimizationSettings = optimizationSettings; this.metricMap = metricMap; this.metricPath = metricPath; this.randomNumberGenerator = randomNumberGenerator; stopWatch = new Stopwatch(); OptimizationLoop(); }
private void GenerateMetricPath() { // Generate path: TopologicalPathGenerator topologicalPathGenerator = new Dijkstra(); int topologicalStartPointID = 0; int topologicalEndPointID = metricMap.RoadPointList.Count - 1; TopologicalPath topologicalPath = topologicalPathGenerator.GenerateShortestPath(metricMap, topologicalStartPointID, topologicalEndPointID); metricPath = new MetricPath(); metricPath.Generate(topologicalPath, metricMap); metricPath.GenerateMetricPathPointList(0.001, 0.5, 0.01, 0.1); // Ugly MW ToDo: Parameterize metricPath.ComputeSegmentLengths(0.1); }
public void Run(PiecewiseLinearSpeedProfileOptimizationSettings optimizationSettings, Random randomNumberGenerator, double optimizationTime, MetricMap metricMap, MetricPath metricPath) { this.optimizationTime = optimizationTime; this.optimizationSettings = optimizationSettings; this.metricMap = metricMap; this.metricPath = metricPath; this.randomNumberGenerator = randomNumberGenerator; stopWatch = new Stopwatch(); optimizationThread = new Thread(new ThreadStart(OptimizationLoop)); optimizationThread.Start(); }
public PiecewiseLinearSpeedProfile(MetricPath path, int numberOfLines) { this.numberOfLines = numberOfLines; connectionPointsList = new List <List <double> >(); int numberOfPathPoints = path.DistanceList.Count; double roadLength = path.GetLength(); double distanceCoveredInEachSection = roadLength / numberOfLines; double distanceCoveredSoFar = 0; for (int ii = 0; ii < numberOfLines; ii++) { distanceCoveredSoFar += distanceCoveredInEachSection; List <double> linearSectionInfoList = new List <double>(); linearSectionInfoList.Add(ii); linearSectionInfoList.Add(distanceCoveredSoFar); connectionPointsList.Add(linearSectionInfoList); } }
public void Increment(MetricPath path = default(MetricPath)) => AppendWrite(current => current + 1, path);
public void IncrementBy(int count, MetricPath path = default(MetricPath)) => AppendWrite(current => current + count, path);
public void AssignMetricPath(MetricPath metricPath) { this.metricPath = metricPath; }