Esempio n. 1
0
        private static void OpenArea(Goal gw, int num, List <KeyValuePair <KeyArea, Area> > productAreaList, List <Goal> way, List <GetawayProcI_Result> getawayProcI_Results)
        {
            GetawayProcI_Result g = getawayProcI_Results.Where(x => x.Code == gw.num).FirstOrDefault();

            if (g == null)
            {
                g    = new GetawayProcI_Result();
                g.X1 = way.Last().midPoint.X;
                g.X2 = way.Last().midPoint.X;
                g.Y1 = way.Last().midPoint.Y;
                g.Y2 = way.Last().midPoint.Y;
            }
            List <ProductShop> products = new List <ProductShop>();
            //למיין את הסטנדים לפי המרחק מנקודת גישה
            Area area = productAreaList[num].Value;

            if (area != null)
            {
                List <int> orederStand = area.sortStands(Converts.ToDtoGetawayI(g));
                foreach (var item in orederStand)
                {
                    var   curExtraStand = area.ExtraStand.Where(x => x.Key.Code == item).First();
                    Point p             = UtilitiesFunctions.MidPoint(new Point(Convert.ToInt32(curExtraStand.Key.X1.ToString()), Convert.ToInt32(curExtraStand.Key.Y1.ToString())), new Point(Convert.ToInt32(curExtraStand.Key.X2.ToString()), Convert.ToInt32(curExtraStand.Key.Y2.ToString())));
                    way.Add(new Goal('s', item, Converts.ToDtoProducts(curExtraStand.Value), p));
                }
            }
        }
Esempio n. 2
0
        public static int getDistanceFromSP(GetawayProcI_Result getaway, Point pStart)
        {
            dtoGetaway g  = Converts.ToDtoGetawayI(getaway);
            Point      p3 = MidPoint(g.P1, g.P2);

            return(CalculteDist(pStart, p3));
        }
Esempio n. 3
0
        public static dtoGetaway ToDtoGetawayI(GetawayProcI_Result Getaway)
        {
            var v = new dtoGetaway()
            {
                Code = Getaway.Code, CodeShop = Convert.ToInt32(Getaway.CodeShop), P1 = new Point(Convert.ToInt32(Getaway.X1), Convert.ToInt32(Getaway.Y1)), P2 = new Point(Convert.ToInt32(Getaway.X2), Convert.ToInt32(Getaway.Y2)), I = Convert.ToInt32(Getaway.I)
            };

            return(v);
        }
Esempio n. 4
0
        public static Graph ToAdjList(List <GetawayProcI_Result> points, List <Connection> connections)
        {
            //המרת קשתות וקודקודים לרשימת סמיכויות
            List <Connection> connectionsGetaway = connections.Where(x => x.TypeDest == Convert.ToInt32(eTypeConnection.getaway)).ToList();
            int   V     = points.Count() + 1;
            Graph graph = new Graph(V);
            int   i     = 0;
            int   num   = points[0].Code;

            foreach (var item in connectionsGetaway)
            {
                int src   = Convert.ToInt32(item.CodeSource);
                int dest  = Convert.ToInt32(item.CodeDest);
                int Isrc  = GetawayProcI_Result.GetI(points, src);
                int Idest = GetawayProcI_Result.GetI(points, dest);
                graph.addEdge(Isrc, Idest, Convert.ToInt32(item.Distance));
            }
            return(graph);
        }
Esempio n. 5
0
        public static List <Goal> Level6ComputeGoalsTravel(Cell[,] BigMatrix, Cell[,] matrixToTsp, int numGeteway, int numArea, List <KeyValuePair <KeyArea, Area> > productAreaList, List <GetawayProcI_Result> getawayProcI_Results, Point pStart, int numCashes)
        {
            //חישוב מסלול אופטימלי
            int[] order = TspFunctions.ManageTsp(matrixToTsp, numArea - numCashes, numArea);
            //יצור מערך של לקיטה-שערים ומוצרים על פי המסלול שחושב
            List <Goal> way = ComputeWayAnswer(BigMatrix, order, numArea - numCashes, numGeteway, productAreaList, getawayProcI_Results, pStart);

            foreach (Goal goal in way)
            {
                if (goal.kind == 'g')
                {
                    GetawayProcI_Result g = getawayProcI_Results.Where(x => x.Code == goal.num).First();
                    goal.midPoint = UtilitiesFunctions.MidPoint(new Point(Convert.ToInt32(g.X1.ToString()), Convert.ToInt32(g.Y1.ToString())), new Point(Convert.ToInt32(g.X2.ToString()), Convert.ToInt32(g.Y2.ToString())));
                }
                else if (goal.midPoint == null)
                {
                    //נקודת קופה או סיום היא ריקה יש לשאוב אותה מאן שהוא
                }
            }
            return(way);
        }