我之前已经定义并运行了所有参数(inbound、dockcapacity)。但是,当我尝试编写以下函数的代码时,出现错误。有人可以建议我解决它的方法吗?
NameError: free variable 'inbound' referenced before assignment in enclosing scope
TimeWindow=100
door1=Door(id=1,typeDoor='inbound',assignList=TimeWindow*[0])
door2=Door(id=2,typeDoor='inbound',assignList=TimeWindow*[0])
inbound=[door1,door2]
DockCapacity=TimeWindow*[2000]
def ScheduleBySequence(truckInfo,TimeWindow,sequenceList):
receiveTruckList=truckInfo.loc[(truckInfo['TruckType'] == 'inbound'),'TruckName'].values.tolist()
for i in range(1,len(truckInfo.index)+1):
truckCandidate=truckInfo.loc[truckInfo['Status']==0,'TruckName'].values.tolist()
truckFunction=truckInfo.loc[truckInfo['Status']==0,'TruckType'].values.tolist()
if len(truckCandidate)==0:
break
def SoonestDoorSatified(truckFunction):
inb1=[]
inb2=[]
if truckFunction[0]=='inbound':
for ind in inbound:
for t in range(considerTime,TimeWindow):
if (ind.id==1) and (ind.assignList[t]<=0):
inb1.append(t)
if (ind.id==2) and (ind.assignList[t]<=0):
inb2.append(t)
return min(inb1[0], inb2[0])
.....
• 带有 omegaconf 的 YAML 配置文件中的算术运算
• 如何使用 Terraform 在管理组范围内定义和分配 Azure Policy?
• memory_profiler 不会在代码运行时进行分析,而是在之后显示结果
• 服务器响应为:5.7.0 在 System.Net.Mail.SmtpTransport 的时间范围内消息过多
• 变量中的零填充
• 如何声明范围,其中每个范围的一部分是不同工作簿中的动态变量?
• 来自文件的 sscanf 输入缓冲区在文件读取范围内失败但仅在文件读取范围之外工作为什么?
• UICollectionView 在多个部分之间拖放单元格