本文整理汇总了Python中Class.getSize方法的典型用法代码示例。如果您正苦于以下问题:Python Class.getSize方法的具体用法?Python Class.getSize怎么用?Python Class.getSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Class
的用法示例。
在下文中一共展示了Class.getSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cost
# 需要导入模块: import Class [as 别名]
# 或者: from Class import getSize [as 别名]
def cost(): # minimize this
result = 0
for droppedClass in droppedClasses:
result += droppedClass.getSize()
for room in rooms:
for key,Class in room.getClasses().items():
overflow = (Class.getSize() - room.getSize()) * (Class.getLength() + 1)
result += max(0, overflow) # add the number of students that don't fit, if any
return result
'''
示例2: numConflicts
# 需要导入模块: import Class [as 别名]
# 或者: from Class import getSize [as 别名]
def numConflicts(): # meaningful objective function
result = 0
for droppedClass in droppedClasses:
result += droppedClass.getSize()
for room in rooms:
for key,Class in room.getClasses().items():
overflow = (Class.getSize() - room.getSize()) * Class.getLength()
result += max(0, overflow) # add the number of students that don't fit, if any
return result
#pre class cost
'''
示例3: swap
# 需要导入模块: import Class [as 别名]
# 或者: from Class import getSize [as 别名]
swap((slotOrder1[slotIndex], roomOrder1[roomIndex]), (slotOrder2[slotIndex], roomOrder2[roomIndex]))
else:
currentCost = newCost # take it
if(currentCost < currentMin):
currentMin = currentCost
currentMinVector = copy.deepcopy(schedule)
'''
# modify temp
temp *= tempLoss
# heartbeat
# print(schedule)
# printSchedule(rooms)
print(currentCost, " : ", temp)
t1 = time.time()
printSchedule(rooms)
print(currentCost)
print("num conflicts: " + str(numConflicts()))
print("num dropped classes: " + str(len(droppedClasses)))
print("time: " + str(t1-t0))
for Class in droppedClasses:
print(str(Class.getSize()) + " : " + str(Class.getLength()))
print("Lowest value reached (for debugging/testing):")
print(currentMin)
print("DONE!")