Exemplo n.º 1
0
        public void goToLocation(int aLoc, int bLoc, Problem room)
        {
            LinkDistance travelledDistance;
            double       distanceToIncrement;

            if (aLoc == this.AInfo)
            {
                if (bLoc == this.BInfo)
                {
                    //Console.WriteLine("Destination location is same with picker location. Picker is not moved any coordinate");
                    return;
                }
                else
                {
                    //Picker is going horizontal
                    if (bLoc > this.BInfo)
                    {
                        //Console.WriteLine("Picker went right");
                    }
                    else
                    {
                        //Console.WriteLine("Picker went left");
                    }
                    //Console.WriteLine("Picker is moved from: ({0}, {1}) to: ({2}, {3})", this.AInfo, this.BInfo, aLoc, bLoc);
                    travelledDistance   = new LinkDistance(Math.Abs(bLoc - this.BInfo), Problem.Codes.W);
                    distanceToIncrement = Math.Abs(bLoc - this.BInfo) * room.W;
                    this.location       = new Coordinate(bLoc, this.AInfo);
                    this.addToPath(this.location);
                    this.addToTravelledDistances(travelledDistance);
                    this.addToDistance(distanceToIncrement);
                }
            }
            else
            {
                if (bLoc == this.BInfo)
                {
                    //Picker is going vertical
                    //If picker's vertical direction is important. It is here to look for.
                    if (aLoc > this.AInfo)
                    {
                        //collecting every aisle traversed while going vertical
                        for (int a = this.AInfo; a < aLoc; a = a + 1)
                        {
                            collectAisle(false, false, room);
                            //Console.WriteLine("Picker went down");
                            //Console.WriteLine("Picker is moved from: ({0}, {1}) to: ({2}, {3})", this.AInfo, this.BInfo, a + 1, this.BInfo);
                            travelledDistance   = new LinkDistance(Math.Abs(a + 1 - this.AInfo), Problem.Codes.L);
                            distanceToIncrement = Math.Abs(a + 1 - this.AInfo) * room.L;
                            this.location       = new Coordinate(this.BInfo, a + 1);
                            this.addToPath(this.location);
                            this.addToTravelledDistances(travelledDistance);
                            this.addToDistance(distanceToIncrement);
                        }
                    }
                    else // aLoc can not be same with this.AInfo already...
                    {
                        for (int a = this.AInfo; a > aLoc; a = a - 1)
                        {
                            collectAisle(true, false, room);
                            //Console.WriteLine("Picker went up");
                            //Console.WriteLine("Picker is moved from: ({0}, {1}) to: ({2}, {3})", this.AInfo, this.BInfo, a - 1, this.BInfo);
                            travelledDistance   = new LinkDistance(Math.Abs(a - 1 - this.AInfo), Problem.Codes.L);
                            distanceToIncrement = Math.Abs(a - 1 - this.AInfo) * room.L;
                            this.location       = new Coordinate(this.BInfo, a - 1);
                            this.addToPath(this.location);
                            this.addToTravelledDistances(travelledDistance);
                            this.addToDistance(distanceToIncrement);
                        }
                    }
                }
                else
                {
                    //Console.WriteLine("Picker can not move diagonally. Picker is not moved any coordinate");
                    return;
                }
            }
        }
Exemplo n.º 2
0
 public void addToTravelledDistances(LinkDistance distance)
 {
     this.travelledDistances.Add(distance);
     //Console.WriteLine("Picker is travelled {0}{1}", distance.Count, distance.Code);
 }