仓内拣货优化问题
问题一
下面是计算 3000 × 3000 3000\times 3000 3000×3000矩阵(货格与货格距离)的 P y t h o n Python Python代码
输出为3000个 1 × 3000 1\times3000 1×3000列表,需自己存入 E x c e l 表 格 Excel表格 Excel表格
import pandas as pd # 导入数据分析库Pandas
import xlsxwriter
workbook = xlsxwriter.Workbook('sheet.xlsx')
worksheet = workbook.add_worksheet(u'sheet1')
inputfile = '附件1:仓库数据.xlsx' # 销量数据路径
data = pd.read_excel(inputfile, sheet_name='货格') # 读入数据
a = data[u'坐标 x,毫米']
b = data[u'坐标 y,毫米']
x_store = [] # 货格横坐标
y_store = [] # 货格纵坐标
# 将横坐标导入x(1:3000)数组中 将纵坐标导入y(1:3000)数组中
for i in range(len(a)):
x_store.append(a[i])
y_store.append(b[i])
inputfile = '附件1:仓库数据.xlsx' # 销量数据路径
date = pd.read_excel(inputfile, sheet_name='复核台') # 读入数据
c = date[u'坐标 x,毫米']
d = date[u'坐标 y,毫米']
x_easter = [] # 复核台横坐标
y_easter = [] # 复核台纵坐标
for i in range(len(c)):
x_easter.append(c[i])
y_easter.append(d[i])
offset = 750 # 偏移量750mm
# 下面写入3000X3000矩阵
for i in range(3000):
d = [] # 1X3000矩阵
x_posi = x_store[i] # 遍历每个点x横坐标
y_posi = y_store[i] # 遍历每个点y横坐标
for j in range(3000):
x_point = x_store[j]
y_point = y_store[j]
if x_posi == x_point and y_posi == y_point: # 第一种距离计算方式 自身到自身的距离为0
d1 = 0
d.append(d1)
elif x_posi == x_point