defevaluate_layout(layout: list, flow_data: dict, rel_chart: dict):
"""
Evaluate layout quality
"""# Calculate centroids
centroids = {}
for block in layout:
centroids[block['department']] = (
block['x'] + block['width'] / 2,
block['y'] + block['height'] / 2
)
# Calculate total material handling costdefeuclidean_dist(c1, c2):
return np.sqrt((c1[0] - c2[0])**2 + (c1[1] - c2[1])**2)
defrectilinear_dist(c1, c2):
returnabs(c1[0] - c2[0]) + abs(c1[1] - c2[1])
total_flow_cost = 0
flow_matrix = flow_data.get('flow_matrix', pd.DataFrame())
for dept1 in centroids:
for dept2 in centroids:
if dept1 != dept2 and dept1 in flow_matrix.index and dept2 in flow_matrix.columns:
flow = flow_matrix.loc[dept1, dept2]
dist = rectilinear_dist(centroids[dept1], centroids[dept2])
total_flow_cost += flow * dist
# Check relationship satisfaction
rel_score = 0
score_matrix = rel_chart.get('score_matrix', pd.DataFrame())
for dept1 in centroids:
for dept2 in centroids:
if dept1 < dept2 and dept1 in score_matrix.index:
target_score = score_matrix.loc[dept1, dept2]
dist = rectilinear_dist(centroids[dept1], centroids[dept2])
# Adjacent if distance < threshold
is_adjacent = dist < 50# Thresholdif target_score > 0and is_adjacent:
rel_score += target_score
elif target_score < 0andnot is_adjacent:
rel_score -= target_score # Good that they're apart# Space utilization
total_area = max(b['x'] + b['width'] for b in layout) * \
max(b['y'] + b['height'] for b in layout)
used_area = sum(b['area'] for b in layout)
return {
"flow_cost": total_flow_cost,
"relationship_score": rel_score,
"space_utilization": used_area / total_area * 100,
"adjacency_satisfaction": rel_score / (len(centroids) * (len(centroids) - 1) / 2),
"metrics": {
"total_departments": len(layout),
"total_area": total_area,
"used_area": used_area
}
}
6. Aisle Design
defdesign_aisles(layout: list, traffic_data: dict):
"""
Design aisle system for layout
"""
aisles = []
# Main aisle (runs length of facility)
main_width = traffic_data.get('main_aisle_width', 12) # feet
aisles.append({
"type": "main",
"width": main_width,
"orientation": "horizontal",
"y_position": max(b['y'] + b['height'] for b in layout) / 2
})
# Cross aisles
cross_width = traffic_data.get('cross_aisle_width', 8)
num_cross = traffic_data.get('num_cross_aisles', 2)
facility_width = max(b['x'] + b['width'] for b in layout)
for i inrange(num_cross):
aisles.append({
"type": "cross",
"width": cross_width,
"orientation": "vertical",
"x_position": facility_width * (i + 1) / (num_cross + 1)
})
# Calculate aisle area
main_length = facility_width
cross_length = max(b['y'] + b['height'] for b in layout)
total_aisle_area = (main_width * main_length +
num_cross * cross_width * cross_length)
return {
"aisles": aisles,
"total_aisle_area": total_aisle_area,
"aisle_percentage": total_aisle_area /
(facility_width * cross_length) * 100
}
Process Integration
This skill integrates with the following processes:
warehouse-layout-slotting-optimization.js
workstation-design-optimization.js
Output Format
{"layout":{"blocks":[{"department":"Receiving","x":0,"y":0,"width":50,"height":40},{"department":"Storage","x":50,"y":0,"width":100,"height":60}]},"evaluation":{"flow_cost":15420,"relationship_score":85,"space_utilization":78},"aisles":{"total_area":1200,"percentage":12},"recommendations":["Swap Shipping and QC to reduce material handling"]}
Best Practices
Start with relationships - Define closeness requirements
Quantify flows - Use actual material handling data
Consider expansion - Plan for growth
Safety first - Emergency egress, hazard separation