当前位置: 首页>>代码示例>>Python>>正文


Python Class.getSize方法代码示例

本文整理汇总了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
    
    '''
开发者ID:tupl,项目名称:classOpt,代码行数:15,代码来源:ICS169Proj.py

示例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
    '''
开发者ID:tupl,项目名称:classOpt,代码行数:16,代码来源:ICS169Proj.py

示例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!")
开发者ID:tupl,项目名称:classOpt,代码行数:32,代码来源:ICS169Proj.py


注:本文中的Class.getSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。