PerformanceStatistics

Namespace: Itinero
We found 10 examples in language CSharp for this search. You will see 25 fragments of code.

		/// <summary>
		/// Retrieves the statistics for the last profiled managed application
		/// <seealso cref="PerformanceStatistics"/>
		/// </summary>
		/// <returns>Profile statistics</returns>
		public PerformanceStatistics GetCurrentStatistics()
		{
			m_rapi.CheckConnection();
			GetStats();

			return m_stats;
		}


		internal void Add(PerformanceStatistic stat)
		{
			items.Add(stat);
		}

		internal void Clear()
		{
			items.Clear();
		}

		#region IEnumerable Members
		/// <summary>
		///  Gets an enumerator for iterating the PerformanceStatistics collection
		///  <seealso cref="StatisticEnumerator"/>
		/// </summary>
		/// <returns>A StatisticEnumerator</returns>
		public StatisticEnumerator GetEnumerator()
		{
			return new StatisticEnumerator(this);
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}		

			/// <summary>
			/// Reset
			/// </summary>
			public void Reset() 
			{
				index = -1;
			}

			/// <summary>
			/// MoveNext
			/// </summary>
			/// <returns></returns>
			public bool MoveNext() 
			{
				index++;
				return(index < m_stats.items.Count);
			}

using System;
using System.Linq;

namespace PAI.CTIP.Optimization.Reporting.Model
{
    public class PerformanceStatistics
    {
        public int NumberOfJobs { get; set; }

        public int NumberOfBackhauls { get; set; }

        public int NumberOfLoadmatches { get; set; }

        public double DriverDutyHourUtilization { get; set; }

        public double DriverDrivingUtilization { get; set; }

        public double DrivingTimePercentage { get; set; }

        public double WaitingTimePercentage { get; set; }

        public static PerformanceStatistics operator + (PerformanceStatistics c1, PerformanceStatistics c2)
        {
            var result = new PerformanceStatistics()
                {
                    NumberOfJobs = c1.NumberOfJobs + c2.NumberOfJobs,
                    NumberOfBackhauls = c1.NumberOfBackhauls + c2.NumberOfBackhauls,
                    NumberOfLoadmatches = c1.NumberOfLoadmatches + c2.NumberOfLoadmatches,
                    DriverDutyHourUtilization = c1.DriverDutyHourUtilization + c2.DriverDutyHourUtilization,
                    DriverDrivingUtilization = c1.DriverDrivingUtilization + c2.DriverDrivingUtilization,
                    DrivingTimePercentage = c1.DrivingTimePercentage + c2.DrivingTimePercentage,
                    WaitingTimePercentage = c1.WaitingTimePercentage + c2.WaitingTimePercentage
                };

            return result;
        }

    }
}

using System;
using System.Linq;

namespace PAI.CTIP.Optimization.Reporting.Model
{
    public class PerformanceStatistics
    {
        public int NumberOfJobs { get; set; }

        public int NumberOfBackhauls { get; set; }

        public int NumberOfLoadmatches { get; set; }

        public double DriverDutyHourUtilization { get; set; }

        public double DriverDrivingUtilization { get; set; }

        public double DrivingTimePercentage { get; set; }

        public double WaitingTimePercentage { get; set; }

        public static PerformanceStatistics operator + (PerformanceStatistics c1, PerformanceStatistics c2)
        {
            var result = new PerformanceStatistics()
                {
                    NumberOfJobs = c1.NumberOfJobs + c2.NumberOfJobs,
                    NumberOfBackhauls = c1.NumberOfBackhauls + c2.NumberOfBackhauls,
                    NumberOfLoadmatches = c1.NumberOfLoadmatches + c2.NumberOfLoadmatches,
                    DriverDutyHourUtilization = c1.DriverDutyHourUtilization + c2.DriverDutyHourUtilization,
                    DriverDrivingUtilization = c1.DriverDrivingUtilization + c2.DriverDrivingUtilization,
                    DrivingTimePercentage = c1.DrivingTimePercentage + c2.DrivingTimePercentage,
                    WaitingTimePercentage = c1.WaitingTimePercentage + c2.WaitingTimePercentage
                };

            return result;
        }

    }
}

using System;
using System.Linq;

namespace PAI.CTIP.Optimization.Reporting.Model
{
    public class PerformanceStatistics
    {
        public int NumberOfJobs { get; set; }

        public int NumberOfBackhauls { get; set; }

        public int NumberOfLoadmatches { get; set; }

        public double DriverDutyHourUtilization { get; set; }

        public double DriverDrivingUtilization { get; set; }

        public double DrivingTimePercentage { get; set; }

        public double WaitingTimePercentage { get; set; }

        public static PerformanceStatistics operator + (PerformanceStatistics c1, PerformanceStatistics c2)
        {
            var result = new PerformanceStatistics()
                {
                    NumberOfJobs = c1.NumberOfJobs + c2.NumberOfJobs,
                    NumberOfBackhauls = c1.NumberOfBackhauls + c2.NumberOfBackhauls,
                    NumberOfLoadmatches = c1.NumberOfLoadmatches + c2.NumberOfLoadmatches,
                    DriverDutyHourUtilization = c1.DriverDutyHourUtilization + c2.DriverDutyHourUtilization,
                    DriverDrivingUtilization = c1.DriverDrivingUtilization + c2.DriverDrivingUtilization,
                    DrivingTimePercentage = c1.DrivingTimePercentage + c2.DrivingTimePercentage,
                    WaitingTimePercentage = c1.WaitingTimePercentage + c2.WaitingTimePercentage
                };

            return result;
        }

    }
}

using System;
using System.Linq;

namespace PAI.CTIP.Optimization.Reporting.Model
{
    public class PerformanceStatistics
    {
        public int NumberOfJobs { get; set; }

        public int NumberOfBackhauls { get; set; }

        public int NumberOfLoadmatches { get; set; }

        public double DriverDutyHourUtilization { get; set; }

        public double DriverDrivingUtilization { get; set; }

        public double DrivingTimePercentage { get; set; }

        public double WaitingTimePercentage { get; set; }

        public static PerformanceStatistics operator + (PerformanceStatistics c1, PerformanceStatistics c2)
        {
            var result = new PerformanceStatistics()
                {
                    NumberOfJobs = c1.NumberOfJobs + c2.NumberOfJobs,
                    NumberOfBackhauls = c1.NumberOfBackhauls + c2.NumberOfBackhauls,
                    NumberOfLoadmatches = c1.NumberOfLoadmatches + c2.NumberOfLoadmatches,
                    DriverDutyHourUtilization = c1.DriverDutyHourUtilization + c2.DriverDutyHourUtilization,
                    DriverDrivingUtilization = c1.DriverDrivingUtilization + c2.DriverDrivingUtilization,
                    DrivingTimePercentage = c1.DrivingTimePercentage + c2.DrivingTimePercentage,
                    WaitingTimePercentage = c1.WaitingTimePercentage + c2.WaitingTimePercentage
                };

            return result;
        }

    }
}

using System;
using System.Linq;

namespace PAI.CTIP.Optimization.Reporting.Model
{
    public class PerformanceStatistics
    {
        public int NumberOfJobs { get; set; }

        public int NumberOfBackhauls { get; set; }

        public int NumberOfLoadmatches { get; set; }

        public double DriverDutyHourUtilization { get; set; }

        public double DriverDrivingUtilization { get; set; }

        public double DrivingTimePercentage { get; set; }

        public double WaitingTimePercentage { get; set; }

        public static PerformanceStatistics operator + (PerformanceStatistics c1, PerformanceStatistics c2)
        {
            var result = new PerformanceStatistics()
                {
                    NumberOfJobs = c1.NumberOfJobs + c2.NumberOfJobs,
                    NumberOfBackhauls = c1.NumberOfBackhauls + c2.NumberOfBackhauls,
                    NumberOfLoadmatches = c1.NumberOfLoadmatches + c2.NumberOfLoadmatches,
                    DriverDutyHourUtilization = c1.DriverDutyHourUtilization + c2.DriverDutyHourUtilization,
                    DriverDrivingUtilization = c1.DriverDrivingUtilization + c2.DriverDrivingUtilization,
                    DrivingTimePercentage = c1.DrivingTimePercentage + c2.DrivingTimePercentage,
                    WaitingTimePercentage = c1.WaitingTimePercentage + c2.WaitingTimePercentage
                };

            return result;
        }

    }
}

using System;
using System.Linq;

namespace PAI.CTIP.Optimization.Reporting.Model
{
    public class PerformanceStatistics
    {
        public int NumberOfJobs { get; set; }

        public int NumberOfBackhauls { get; set; }

        public int NumberOfLoadmatches { get; set; }

        public double DriverDutyHourUtilization { get; set; }

        public double DriverDrivingUtilization { get; set; }

        public double DrivingTimePercentage { get; set; }

        public double WaitingTimePercentage { get; set; }

        public static PerformanceStatistics operator + (PerformanceStatistics c1, PerformanceStatistics c2)
        {
            var result = new PerformanceStatistics()
                {
                    NumberOfJobs = c1.NumberOfJobs + c2.NumberOfJobs,
                    NumberOfBackhauls = c1.NumberOfBackhauls + c2.NumberOfBackhauls,
                    NumberOfLoadmatches = c1.NumberOfLoadmatches + c2.NumberOfLoadmatches,
                    DriverDutyHourUtilization = c1.DriverDutyHourUtilization + c2.DriverDutyHourUtilization,
                    DriverDrivingUtilization = c1.DriverDrivingUtilization + c2.DriverDrivingUtilization,
                    DrivingTimePercentage = c1.DrivingTimePercentage + c2.DrivingTimePercentage,
                    WaitingTimePercentage = c1.WaitingTimePercentage + c2.WaitingTimePercentage
                };

            return result;
        }

    }
}

        /// <summary>
        /// Gets the Solution Performance Statistics
        /// </summary>
        SolutionPerformanceStatistics GetSolutionPerformanceStatistics(Solution solution);

        /// <summary>
        /// Gets the Solution Performance Statistics Report
        /// </summary>
        string GetSolutionPerformanceStatisticsReport(Solution solution);

        /// <summary>
        /// Gets a list of Performance Statistics per leg of each generated route
        /// </summary>
        IList<RouteSegmentStatistics> GetRouteSegmentStats(NodeRouteSolution routeSolution);
        
        /// <summary>
        /// Computes the Solution Performance Statistics
        /// </summary>
        /// <param name="solution">The solution from which the report is generated</param>
        /// <returns>The generated Performance Statistics from the Solution</returns>
        public SolutionPerformanceStatistics GetSolutionPerformanceStatistics(Solution solution)
        {
            var truckStatisticBySolution = new Dictionary<NodeRouteSolution, TruckPerformanceStatistics>();
            var totalRouteStatisticsByTruckState = new Dictionary<TruckState, RouteStatistics>();
            var totalPerformanceStatistics = new PerformanceStatistics();
            var totalRouteStatistics = new RouteStatistics();

            foreach (var routeSolution in solution.RouteSolutions)
            {
                // calculate truck performance statistics
                var truckStatistics = CalculateTruckPerformanceStatistics(routeSolution);
                truckStatisticBySolution[routeSolution] = truckStatistics;

                // calculate total route statistics by truck state
                foreach (var truckState in truckStatistics.RouteStatisticsByTruckState.Keys)
                {
                    if (!totalRouteStatisticsByTruckState.ContainsKey(truckState))
                    {
                        totalRouteStatisticsByTruckState[truckState] = new RouteStatistics();
                    }

                    totalRouteStatisticsByTruckState[truckState] += truckStatistics.RouteStatisticsByTruckState[truckState];
                }

                // sum up performance & route stats
                totalPerformanceStatistics += truckStatistics.PerformanceStatistics;
                totalRouteStatistics += truckStatistics.RouteStatistics;
            }

            double solutionCount = solution.RouteSolutions.Count;

            var result = new SolutionPerformanceStatistics
                {
                    TruckStatistics = truckStatisticBySolution,
                    TotalRouteStatisticsByTruckState = totalRouteStatisticsByTruckState,
                    TotalRouteStatistics = totalRouteStatistics,
                    NumberOfBackhauls = totalPerformanceStatistics.NumberOfBackhauls,
                    AverageNumberOfBackhauls = totalPerformanceStatistics.NumberOfBackhauls/solutionCount,
                    NumberOfLoadmatches = totalPerformanceStatistics.NumberOfLoadmatches,
                    AverageNumberOfLoadmatches = totalPerformanceStatistics.NumberOfLoadmatches/solutionCount,
                    NumberOfJobs = totalPerformanceStatistics.NumberOfJobs,
                    AverageNumberOfJobs = totalPerformanceStatistics.NumberOfJobs/solutionCount,
                    AverageDriverDutyHourUtilization = totalPerformanceStatistics.DriverDutyHourUtilization/solutionCount,
                    AverageDriverDrivingUtilization = totalPerformanceStatistics.DriverDrivingUtilization/solutionCount,
                    DrivingTimePercentage = totalRouteStatistics.TotalTravelTime.TotalHours/totalRouteStatistics.TotalTime.TotalHours,
                    WaitingTimePercentage = totalRouteStatistics.TotalIdleTime.TotalHours/totalRouteStatistics.TotalTime.TotalHours
                };
            
            return result;
        }



        /// <summary>
        /// Computes the TruckPerformanceStatistics for a given route solution
        /// </summary>
        /// <param name="routeSolution">The route from which statistics are generated</param>
        /// <returns>The performance statistics for the truck</returns>
        public TruckPerformanceStatistics CalculateTruckPerformanceStatistics(NodeRouteSolution routeSolution)
        {
            var segmentStats = GetRouteSegmentStats(routeSolution);

            // calculate the statistics by truck state
            var statsByTructState = (from segment in segmentStats
                                     group segment by segment.TruckState into g
                                     select new
                                     {
                                         TruckState = g.Key,
                                         Statistics = g.Aggregate(new RouteStatistics(), (seed, segment) => seed + segment.Statistics)
                                     })
                    .ToDictionary(key => key.TruckState, value => value.Statistics);

            // compute the sum of all the route statistics
            var totalRouteStatistics = segmentStats.Aggregate(new RouteStatistics(), (seed, segment) => seed + segment.Statistics);

            var performanceStatistics = CalculatePerformanceStatistics(routeSolution);

            var truckStatistics = new TruckPerformanceStatistics
            {
                RouteStatisticsByTruckState = statsByTructState,
                RouteStatistics = totalRouteStatistics,
                PerformanceStatistics = performanceStatistics,
                RouteSegmentStatistics = segmentStats
            };

            return truckStatistics;
        }

        /// <summary>
        /// Gets the route segment stats.
        /// </summary>
        /// <param name="routeSolution">The route solution.</param>
        /// <returns>a list of statistics for each leg of the route</returns>
        public IList<RouteSegmentStatistics> GetRouteSegmentStats(NodeRouteSolution routeSolution)
        {
            var startTime = routeSolution.StartTime;
            var routeStops = _routeService.GetRouteStopsForRouteSolution(routeSolution);
            var segmentStats = _routeStopService.CalculateRouteSegmentStatistics(startTime, routeStops);
            return segmentStats;
        }

        /// <summary>
        /// Gets the Solution Performance Statistics
        /// </summary>
        SolutionPerformanceStatistics GetSolutionPerformanceStatistics(Solution solution);

        /// <summary>
        /// Gets the Solution Performance Statistics Report
        /// </summary>
        string GetSolutionPerformanceStatisticsReport(Solution solution);

        IList<RouteSegmentStatistics> GetRouteSegmentStats(NodeRouteSolution routeSolution);
        
        /// <summary>
        /// Computes the Solution Performance Statistics
        /// </summary>
        /// <param name="solution"></param>
        /// <returns></returns>
        public SolutionPerformanceStatistics GetSolutionPerformanceStatistics(Solution solution)
        {
            var truckStatisticBySolution = new Dictionary<NodeRouteSolution, TruckPerformanceStatistics>();
            var totalRouteStatisticsByTruckState = new Dictionary<TruckState, RouteStatistics>();
            var totalPerformanceStatistics = new PerformanceStatistics();
            var totalRouteStatistics = new RouteStatistics();

            foreach (var routeSolution in solution.RouteSolutions)
            {
                // calculate truck performance statistics
                var truckStatistics = CalculateTruckPerformanceStatistics(routeSolution);
                truckStatisticBySolution[routeSolution] = truckStatistics;

                // calculate total route statistics by truck state
                foreach (var truckState in truckStatistics.RouteStatisticsByTruckState.Keys)
                {
                    if (!totalRouteStatisticsByTruckState.ContainsKey(truckState))
                    {
                        totalRouteStatisticsByTruckState[truckState] = new RouteStatistics();
                    }

                    totalRouteStatisticsByTruckState[truckState] += truckStatistics.RouteStatisticsByTruckState[truckState];
                }

                // sum up performance & route stats
                totalPerformanceStatistics += truckStatistics.PerformanceStatistics;
                totalRouteStatistics += truckStatistics.RouteStatistics;
            }

            double solutionCount = solution.RouteSolutions.Count;

            var result = new SolutionPerformanceStatistics
                {
                    TruckStatistics = truckStatisticBySolution,
                    TotalRouteStatisticsByTruckState = totalRouteStatisticsByTruckState,
                    TotalRouteStatistics = totalRouteStatistics,
                    NumberOfBackhauls = totalPerformanceStatistics.NumberOfBackhauls,
                    AverageNumberOfBackhauls = totalPerformanceStatistics.NumberOfBackhauls/solutionCount,
                    NumberOfLoadmatches = totalPerformanceStatistics.NumberOfLoadmatches,
                    AverageNumberOfLoadmatches = totalPerformanceStatistics.NumberOfLoadmatches/solutionCount,
                    NumberOfJobs = totalPerformanceStatistics.NumberOfJobs,
                    AverageNumberOfJobs = totalPerformanceStatistics.NumberOfJobs/solutionCount,
                    AverageDriverDutyHourUtilization = totalPerformanceStatistics.DriverDutyHourUtilization/solutionCount,
                    AverageDriverDrivingUtilization = totalPerformanceStatistics.DriverDrivingUtilization/solutionCount,
                    DrivingTimePercentage = totalRouteStatistics.TotalTravelTime.TotalHours/totalRouteStatistics.TotalTime.TotalHours,
                    //WaitingTimePercentage = totalRouteStatistics.TotalIdleTime.TotalHours/totalRouteStatistics.TotalTime.TotalHours
                };
            
            return result;
        }



        /// <summary>
        /// Computes the TruckPerformanceStatistics for a given route solution
        /// </summary>
        /// <param name="routeSolution"></param>
        /// <returns></returns>
        public TruckPerformanceStatistics CalculateTruckPerformanceStatistics(NodeRouteSolution routeSolution)
        {
            var segmentStats = GetRouteSegmentStats(routeSolution);

            // calculate the statistics by truck state
            var statsByTructState = (from segment in segmentStats
                                     group segment by segment.TruckState into g
                                     select new
                                     {
                                         TruckState = g.Key,
                                         Statistics = g.Aggregate(new RouteStatistics(), (seed, segment) => seed + segment.Statistics)
                                     })
                    .ToDictionary(key => key.TruckState, value => value.Statistics);

            // compute the sum of all the route statistics
            var totalRouteStatistics = segmentStats.Aggregate(new RouteStatistics(), (seed, segment) => seed + segment.Statistics);

            var performanceStatistics = CalculatePerformanceStatistics(routeSolution);

            var truckStatistics = new TruckPerformanceStatistics
            {
                RouteStatisticsByTruckState = statsByTructState,
                RouteStatistics = totalRouteStatistics,
                PerformanceStatistics = performanceStatistics,
                RouteSegmentStatistics = segmentStats
            };

            return truckStatistics;
        }

        public IList<RouteSegmentStatistics> GetRouteSegmentStats(NodeRouteSolution routeSolution)
        {
            var startTime = routeSolution.StartTime;
            var routeStops = _routeService.GetRouteStopsForRouteSolution(routeSolution);
            // var segmentStats = _routeStopService.CalculateRouteSegmentStatistics(startTime, routeStops);
            var segmentStats = _routeStopService.CalculateRouteSegmentStatistics(routeStops, startTime);
            return segmentStats;
        }

Itinero.Profiles.Lua.Diagnostics.PerformanceStatistics : Object

Constructors :

public PerformanceStatistics()

Methods :

public Boolean get_Enabled()
public Void set_Enabled(Boolean value = )
public PerformanceResult GetPerformanceCounterResult(PerformanceCounter pc = )
public String GetPerformanceLog()
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()

Other methods