我之前已经定义并运行了所有参数(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])
.....