2020MathorCup数学建模挑战赛C题 仓内拣货优化问题

该博客聚焦2020MathorCup数学建模挑战赛中的仓内拣货优化问题,具体探讨问题一,提供了计算货格间距离的Python代码,生成3000×3000矩阵数据,适用于后续拣货路径优化。
摘要由CSDN通过智能技术生成

仓内拣货优化问题

问题一

下面是计算 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 
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值