public void collectLGAisle(bool up, Aisle aisle, Problem problem) { int aPos; if (up) { aPos = this.AInfo - 1; } else { aPos = this.AInfo; } List <Item> sortedAisleItems = problem.sortAisleItems(problem.getNonPickedAisleItems(aPos, this.BInfo)); if (sortedAisleItems.Count == 0) { return; } if (up) { sortedAisleItems.Reverse(); } foreach (Item i in sortedAisleItems) { if (up) { if (i.DInfo >= aisle.HighLargestGap) { if (i.Picked == false) { i.Picked = true; this.addToPickedItems(i); } } } else { if (i.DInfo <= aisle.LowLargestGap) { if (i.Picked == false) { i.Picked = true; this.addToPickedItems(i); } } } } if (up) { this.addToTravelledDistances(new LinkDistance(Math.Abs(aisle.HighLargestGap - problem.S - 1), Problem.Codes.K)); this.addToTravelledDistances(new LinkDistance(Math.Abs(aisle.HighLargestGap - problem.S - 1), Problem.Codes.K)); this.addToDistance(Math.Abs(aisle.HighLargestGap - problem.S - 1) * problem.K * 2); } else { this.addToTravelledDistances(new LinkDistance(aisle.LowLargestGap, Problem.Codes.K)); this.addToTravelledDistances(new LinkDistance(aisle.LowLargestGap, Problem.Codes.K)); this.addToDistance(aisle.LowLargestGap * problem.K * 2); } }
public void goToLocation(Coordinate coord, Problem room) { goToLocation(coord.Y, coord.X, room); }
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; } } }
public ShortestPathSolution(Problem room) { this.problem = room; }