Einschränkung des Durchgangs durch bestimmte Gänge zu "Enter-Exit von derselben Seite" in einem Pfadfindungsdiagramm?Python

Python-Programme
Anonymous
 Einschränkung des Durchgangs durch bestimmte Gänge zu "Enter-Exit von derselben Seite" in einem Pfadfindungsdiagramm?

Post by Anonymous »

Ich arbeite an einem Lagerlayout in Python, in dem eine Route zwischen mehreren Pick -Standorten berechnet wird. Das Layout umfasst sowohl breite als auch ultra-narbene Gänge. Im realen Setup erfordern Ultra-Narrow-Gänge, dass die Picker ihre Karren am Eingang lassen und auf die gleiche Weise zurückkehren. Dies bedeutet, dass sie die gleiche Seite eingeben und aus derselben Seite verlassen müssen (entweder oben oder unten). Nur bei bestimmten Kreuzungen können Picker vollständig durchqueren. Wenn der Weg von einer Seite (z. B. der Oberseite) in den Gang eingeht (z. B. die Oberseite), geht er auch von derselben Seite. "U-turn nur" Einschränkung für bestimmte Regionen? Angesichts der vier Auswahlstandorte möchte ich, dass die Route von unten auf den Ausgang 112 zugänglich ist, um P1 zu besuchen, und dann zu P2 in Gang 113. Danach sollte es die Gänge von unten auf den Gang 114 besuchen, um P3 bzw. P4 zu besuchen. < /P>

Code: Select all

# -*- coding: utf-8 -*-

import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import networkx as nx

# ------------------- Define warehouse -------------------
# Visual X positions for vertical shelf aisles
visual_positions = {
111: -5.4,
112: -4.8,
113: -3.2,
114: -2.6,
}

# Aisles that only allow access from one side
shelf_access_side = {
111: "left",
112: "right",
113: "left",
114: "right"
}

# Generate Y-pick positions for vertical aisles
pick_locations = {
111: [round(2.9 + i * (1.3 / 3), 3) for i in range(48)],
112: [round(2.9 + i * (1.3 / 3), 3) for i in range(48)],
113: [round(2.9 + i * (1.3 / 3), 3) for i in range(48)],
114: [round(2.9 + i * (1.3 / 3), 3) for i in range(48)],
}

# Walkable zones (open spaces + narrow aisle access)
walkable_areas = [
((-7, 0), (0, 2.9)),            # bottom walkway
((-7, 24), (-2, 24.8)),         # top walkway
((-7, 0), (-5.4, 24)),          # left cross-aisle
((-2, 0), (0, 24.8))            # right cross-aisle
]

x_positions = sorted([visual_positions[a] for a in shelf_access_side])
for i in range(len(x_positions) - 1):
left, right = x_positions[i], x_positions[i+1]
if right - (left + 0.6) >= 0.5:
x_start = round(round((left + 0.6) * 2) / 2, 2)
x_end = round(round((right) * 2) / 2, 2)
if x_start < (left+0.6):
x_start += 0.5
if x_end >  right:
x_end -= 0.5

y_start, y_end = 2.5, 24
walkable_areas.append(((x_start, y_start), (x_end, y_end)))

# ------------------- Input Picks -------------------
user_picks = ['112.6', '113.33', '114.43', '114.16']

def parse_user_picks(user_picks):
parsed = []
for p in user_picks:
aisle_str, loc_str = p.split(".")
aisle = int(aisle_str)
location = int(loc_str)
pick_slot_height = round(1.3 / 3, 3)  # ~0.433m
pick_location = round(2.9 + (location - 1) * pick_slot_height, 3)
parsed.append((aisle, pick_location))
return parsed

parsed_picks = parse_user_picks(user_picks)

df = pd.DataFrame(list(parsed_picks), columns=['Aisle', 'Pick Location'])

# ------------------- Plotting Functions -------------------
def plot_pick_locations(ax, pick_locations, visual_positions, aisles):
for aisle in aisles:
pos = visual_positions[aisle]
for location in pick_locations[aisle]:
rect = Rectangle((pos, location), 0.6, round(1.3 / 3, 3), color='blue', alpha=0.3)
ax.add_patch(rect)

def plot_selected_picks(ax, df, visual_positions):
for _, row in df.iterrows():
pos = visual_positions[row['Aisle']]
rect = Rectangle((pos, row['Pick Location']), 0.6, round(1.3 / 3, 3), color='red')
ax.add_patch(rect)

def plot_walkable_areas(ax, walkable_areas):
for (x_start, y_start), (x_end, y_end) in walkable_areas:
width = x_end - x_start
height = y_end - y_start
ax.add_patch(Rectangle((x_start, y_start), width, height, color='lightgrey'))

# ------------------- Graphing Functions -------------------
# Build walkable graph
def generate_walkable_graph(walkable_areas, resolution=0.5):
walkable_points = set()
for (x_start, y_start), (x_end, y_end) in walkable_areas:
x = x_start
while x

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post