当前位置: 首页>>代码示例>>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;未经允许,请勿转载。