Esempio n. 1
0
        public static double CalculateEarlyScore(PointsOfInterest poiT, List<Events> eventsT, int startT, int endT)
        {
            double timeReduction = 1 - ((double)poiT.GetFlaggedAreas().Where(x=>x.Item2> startT).Sum(x => (x.Item2 - x.Item1)) / (endT - startT));
            double eventsHit = (double)eventsT.Where(x => x.isHit).Count() / eventsT.Count;

            return ((TIME_WEIGHT * timeReduction) * (HIT_WEIGHT * eventsHit)) / (HIT_WEIGHT + TIME_WEIGHT);
        }
Esempio n. 2
0
        public static double CalculateEarlyScore(PointsOfInterest poiT, List <Events> eventsT, int startT, int endT)
        {
            double timeReduction = 1 - ((double)poiT.GetFlaggedAreas().Where(x => x.Item2 > startT).Sum(x => (x.Item2 - x.Item1)) / (endT - startT));
            double eventsHit     = (double)eventsT.Where(x => x.isHit).Count() / eventsT.Count;

            return(((TIME_WEIGHT * timeReduction) * (HIT_WEIGHT * eventsHit)) / (HIT_WEIGHT + TIME_WEIGHT));
        }
Esempio n. 3
0
        public static void SavePathPointsOfInterest(PointsOfInterest POIs, string path, string name)
        {
            if (!Directory.Exists(path + "/POI"))
            {
                Directory.CreateDirectory(path + "/POI");
            }
            List <string> data      = new List <string>();
            var           tempAreas = POIs.GetFlaggedAreas();

            foreach (Tuple <int, int> area in tempAreas)
            {
                data.Add($"{area.Item1}, {area.Item2}");
            }
            File.WriteAllLines(path + "/POI/" + name + ".txt", data);
        }
Esempio n. 4
0
 public HitResults CalculateHitResult()
 {
     if (!_calculatedHitResult)
     {
         int Hits       = 0;
         int EventHits  = 0;
         int EventTotal = events.Count;
         int Misses     = 0;
         foreach (Events ev in events)
         {
             if (ev.isHit)
             {
                 EventHits++;
             }
         }
         foreach (var pointOfIn in poi.GetFlaggedAreas())
         {
             if (pointOfIn.Item1 > start && pointOfIn.Item2 < end)
             {
                 bool hitted = false;
                 foreach (var ev in events)
                 {
                     if (pointOfIn.Item1 < ev.GetTimestampStart() && ev.GetTimestampEnd() < pointOfIn.Item2)
                     {
                         Hits++;
                         hitted = true;
                         break;
                     }
                     else if (pointOfIn.Item1 >= ev.GetTimestampStart() && pointOfIn.Item2 >= ev.GetTimestampEnd() && pointOfIn.Item1 <= ev.GetTimestampEnd())
                     {
                         Hits++;
                         hitted = true;
                         break;
                     }
                     else if (pointOfIn.Item1 <= ev.GetTimestampStart() && pointOfIn.Item2 <= ev.GetTimestampEnd() && pointOfIn.Item2 >= ev.GetTimestampStart())
                     {
                         Hits++;
                         hitted = true;
                         break;
                     }
                     else if (ev.GetTimestampStart() <= pointOfIn.Item1 && pointOfIn.Item2 <= ev.GetTimestampEnd())
                     {
                         Hits++;
                         hitted = true;
                         break;
                     }
                 }
                 if (hitted == false)
                 {
                     Misses++;
                 }
             }
             _calculatedHitResult = true;
         }
         _hitResult = new HitResults(EventHits, Hits, Misses, EventTotal);
         return(_hitResult);
     }
     else
     {
         return(_hitResult);
     }
 }
Esempio n. 5
0
 public static void SaveVotingPointsOfInterest(PointsOfInterest POIs, string path, string name)
 {
     if (!Directory.Exists(path + "/POI"))
     {
         Directory.CreateDirectory(path + "/POI");
     }
         List<string> data = new List<string>();
         var tempAreas = POIs.GetFlaggedAreas();
         foreach (Tuple<int, int> area in tempAreas)
         {
             data.Add($"{area.Item1}, {area.Item2}");
         }
         File.WriteAllLines(path + "/POI/" + name + ".txt", data);
 }