本文整理汇总了Python中algorithm.Algorithm.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Algorithm.__init__方法的具体用法?Python Algorithm.__init__怎么用?Python Algorithm.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类algorithm.Algorithm
的用法示例。
在下文中一共展示了Algorithm.__init__方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import __init__ [as 别名]
def __init__(self, g):
Algorithm.__init__(self, g)
self.REPAIR_PERIOD=20*self.MSG_PERIOD
self.RETRY_PERIOD=self.REPAIR_PERIOD
self.tables={}
#init tables
self.repair()
示例2: __init__
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import __init__ [as 别名]
def __init__(self, memory_size, selection_method):
# Los bloques adyacentes a un bloque vacio siempre estan llenos
# Los bloques adyacentes a un bloque lleno pueden estar vacios o llenos
Algorithm.__init__(self, memory_size)
self.selection_method = selection_method # Seleccion de bloque vacio (Primer ajuste, mejor ajuste o peor ajuste)
self.full = {} # Mapeo de bloques llenos: PCB -> Bloque
self.empty = [Block(0, memory_size - 1)] # Lista de bloques vacios
示例3: __init__
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import __init__ [as 别名]
def __init__ (self, num_players, horizon=100):
Algorithm.__init__(self, num_players)
# Y[i,j] is the proportion of games player i beat over player j
# N[i,j] is the number of games i and j have played against each other
self.Y = np.zeros((num_players, num_players))
self.N = np.zeros((num_players, num_players))
self.T = horizon
self.ranking_procedure = Copeland(num_players, self.Y)
示例4: __init__
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import __init__ [as 别名]
def __init__(self, g):
'''
Constructor
'''
Algorithm.__init__(self, g)
self.tables = {}
#init tables
for node in self.g.nodes():
self.tables[node]={}
示例5: __init__
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import __init__ [as 别名]
def __init__(self):
Algorithm.__init__(self)
self.digits = '123456789'
self.rows = 'ABCDEFGHI'
self.cols = self.digits
self.squares = self.cross(self.rows, self.cols)
self.unitlist = ([self.cross(self.rows, col) for col in self.cols] +
[self.cross(row, self.cols) for row in self.rows] +
[self.cross(row_square, col_square) for row_square in ('ABC','DEF','GHI')
for col_square in ('123','456','789')])
self.units = dict((square, [un for un in self.unitlist if square in un])
for square in self.squares)
self.peers = dict((square, set(sum(self.units[square],[]))-set([square]))
for square in self.squares)
示例6: __init__
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import __init__ [as 别名]
def __init__(self, num_players, ranking_procedure=Copeland, alpha=0.51, horizon=100):
Algorithm.__init__(self, num_players)
# W[i,j] is the proportion of games player i beat over player j
# U[i,j] is the upper confidence interval
self.W = np.zeros((num_players, num_players))
self.U = np.zeros((num_players, num_players))
self.Y = np.zeros((num_players, num_players))
self.N = np.zeros((num_players, num_players))
self.T = horizon # Horizon
assert(alpha > 0.5)
self.alpha = alpha
self.ranking = list(range(num_players))
np.random.shuffle(self.ranking)
self.ranking_procedure = ranking_procedure(num_players, self.Y)
示例7: __init__
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import __init__ [as 别名]
def __init__ (self, num_players):
Algorithm.__init__(self, num_players)
示例8: __init__
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import __init__ [as 别名]
def __init__(self):
Algorithm.__init__(self)
self.rows = 'ABCDEFGHI'
self.cols = '123456789'
self.squares = self.cross(self.rows, self.cols)
示例9: __init__
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import __init__ [as 别名]
def __init__(self, g):
'''
Constructor
'''
Algorithm.__init__(self, g)
self.old_g = nx.Graph()
示例10: __init__
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import __init__ [as 别名]
def __init__(self, g):
'''
Constructor
'''
Algorithm.__init__(self, g)
self.table = {}
示例11: __init__
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import __init__ [as 别名]
def __init__(self):
Algorithm.__init__(self, [])
示例12: __init__
# 需要导入模块: from algorithm import Algorithm [as 别名]
# 或者: from algorithm.Algorithm import __init__ [as 别名]
def __init__(self, quantum, priorities_quant, aging_quant):
Algorithm.__init__(self, PriorityMap(priorities_quant, aging_quant))
self.quantum = quantum