本文整理匯總了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