import numpy as npimport pandas as pdfrom scipyoptimize import linprog# 读取附件数据df1 = pdread_excel附件1xlsxdf2 = pdread_excel附件2xlsxdf3 = pdread_excel附件3xlsxdf4 = pdread_excel附件4xlsx# 提取所需数据sales_data = d
The error is caused by the fact that the A_ub matrix is not properly defined. The A_ub matrix should be a 2-D array of numerical values, but in the code, it is defined as a list of lists. To fix this error, you can convert the A_ub matrix to a numpy array using the np.array() function.
Replace the following line of code:
A_ub = [[-1] * n]
With:
A_ub = np.array([[-1] * n])
After making this change, the code should run without any errors.
原文地址: https://www.cveoy.top/t/topic/i1SH 著作权归作者所有。请勿转载和采集!