Esempio n. 1
0
        static void Main(string[] args)
        {
            DBController dbc = new DBController();

            List<Trip> trips = dbc.GetAllTrips();

               for(int i = 0; i > trips.Count; i++) {
                GPSFactUpdater.UpdateRawGPS((Int16)trips[i].CarId, trips[i].TripId);
                List<Fact> facts = new List<Fact>();
                facts = dbc.GetFactsByTripId(trips[i].TripId);

                trips[i] = TripFactUpdater.UpdateTripWithCountsAndIntervals(trips[i], facts, dbc);
                dbc.UpdateTripFactWithCounts(trips[i]);
                dbc.UpdateTripFactWithIntervals(trips[i]);
            }

            /*
            List<Trip> trips = dbc.GetTripsByCarId(34);
            Console.WriteLine("AverageTripPercentage:");
            Console.WriteLine(UserProfile.AverageTripPercentage(trips).ToString());
            Console.WriteLine("AverageMetricPercentage:");
            UserProfile.print(UserProfile.AverageMetricPercentage(trips));
            Console.WriteLine("AverageMetricNormalized:");
            UserProfile.print(UserProfile.AverageMetricNormalized(trips));
            Console.WriteLine("AverageMetricDegree:");
            UserProfile.print(UserProfile.AverageMetricDegree(trips));

            Console.WriteLine("CorrelationMatrix:");
            Double[,] matrix = MetricCorrelation.getCorrelationMatrix(trips);
            MetricCorrelation.printMatrix(matrix);
            */
            Console.WriteLine("Aaaaand its done");
            Console.ReadLine();
        }
        public FleetStatistics()
        {
            DBController dbc = new DBController();
            this.AllTrips = dbc.GetAllTrips();
            dbc.Close();

            int totalTrips = AllTrips.Count;
            RemoveBadTrips();
            Console.WriteLine("Number of bad trips: " + (totalTrips - AllTrips.Count));
            Console.WriteLine("Number of trips: " + AllTrips.Count);

            Console.WriteLine("Average Distance Driven: " + AverageDistanceDriven());
            Console.WriteLine("Average OptimalScore: " + AverageOptimalScore());
            Console.WriteLine("Average TripScore: " + AverageTripScore());
            Console.WriteLine("Average Percentage Above Optimal: " + (AveragePercentage() - 100));
            Trip worst = WorstPercentageTrip();
            Console.WriteLine("Worst Percentage: " + ((worst.TripScore / worst.OptimalScore * 100)-100) + " On Trip " + worst.TripId);
        }