當前位置: 首頁>>代碼示例>>Python>>正文


Python Algorithm.__init__方法代碼示例

本文整理匯總了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()
開發者ID:gpleiss,項目名稱:OlinMeshNetwork,代碼行數:9,代碼來源:BATMANalgorithm.py

示例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
開發者ID:Alejandro-Merlo,項目名稱:Sistemas-Operativos,代碼行數:10,代碼來源:mvt.py

示例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)
開發者ID:keeganryan,項目名稱:urban-bassoon,代碼行數:10,代碼來源:Naive_RankEL_Algorithm.py

示例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]={}
開發者ID:gpleiss,項目名稱:OlinMeshNetwork,代碼行數:11,代碼來源:OWNalgorithm.py

示例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)
開發者ID:rsanchezG,項目名稱:sudokuB-1,代碼行數:16,代碼來源:norvig_algorithm.py

示例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)
開發者ID:keeganryan,項目名稱:urban-bassoon,代碼行數:17,代碼來源:RUCB_Algorithm.py

示例7: __init__

# 需要導入模塊: from algorithm import Algorithm [as 別名]
# 或者: from algorithm.Algorithm import __init__ [as 別名]
 def __init__ (self, num_players):
     Algorithm.__init__(self, num_players)
開發者ID:keeganryan,項目名稱:urban-bassoon,代碼行數:4,代碼來源:trivial_algorithm.py

示例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)
開發者ID:Henry-Benito,項目名稱:sudokuB,代碼行數:7,代碼來源:backtracking.py

示例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()
開發者ID:gpleiss,項目名稱:OlinMeshNetwork,代碼行數:8,代碼來源:GLSRalgorithm.py

示例10: __init__

# 需要導入模塊: from algorithm import Algorithm [as 別名]
# 或者: from algorithm.Algorithm import __init__ [as 別名]
 def __init__(self, g):
     '''
     Constructor
     '''
     Algorithm.__init__(self, g)
     self.table = {}        
開發者ID:gpleiss,項目名稱:OlinMeshNetwork,代碼行數:8,代碼來源:DSRalgorithm.py

示例11: __init__

# 需要導入模塊: from algorithm import Algorithm [as 別名]
# 或者: from algorithm.Algorithm import __init__ [as 別名]
 def __init__(self):
     Algorithm.__init__(self, [])
開發者ID:Alejandro-Merlo,項目名稱:Sistemas-Operativos,代碼行數:4,代碼來源:sjf.py

示例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
開發者ID:Alejandro-Merlo,項目名稱:Sistemas-Operativos,代碼行數:5,代碼來源:priority_with_round_robin.py


注:本文中的algorithm.Algorithm.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。