Exemplo n.º 1
0
 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()
 def __init__(self,
              evaluator,
              neighbourhood_gen,
              stop_cond,
              logger=NullLogger()):
     Algorithm.__init__(self, evaluator, neighbourhood_gen, stop_cond,
                        logger)
Exemplo n.º 3
0
	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()
Exemplo n.º 4
0
    def __init__(self,
                 verbose=False,
                 alpha=.98,
                 start=500000,
                 end=.25,
                 iterations=200):
        Algorithm.__init__(self, verbose)
        self.solution = [
        ]  # using a list to follow convention of previous algo's

        # Related to the temperature schedule
        # T = T*alpha is applied every "iterations"
        self.alpha = alpha  # Increase to slow cooling
        self.start_temp = start  # Increase to run algorithm longer
        self.end_temp = end  # At about .25, the probability is near 0
        self.iterations_per_temp = iterations  # increase to slow cooling

        self.temperature = start
        self.temp_iterations = 0
        self.elapsed_time = 0
        self.start_time = datetime.now()
        # value and temp stored at each iteration then written to file for graphing
        self.value_data = []
        self.temperature_data = []
        self.moves_to_better = 0
        self.moves_to_worse = 0
Exemplo n.º 5
0
 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
	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)
Exemplo n.º 7
0
	def __init__(self, g):
		'''
		Constructor
		'''
		Algorithm.__init__(self, g)
		self.tables = {}		
		#init tables
		for node in self.g.nodes():
			self.tables[node]={}
Exemplo n.º 8
0
 def __init__(self, strategy="BFS", tree=True, verbose=False):
     Algorithm.__init__(self, verbose)
     #self.log_count = 1
     self.visited = []  # visisted/explored list for Graph Search
     self.solution = []  # list of solutions (only 1 if all_solutions=False)
     self.tree = tree  # True for tree search, False for Graph search
     if not strategy == "BFS" and not strategy == "DFS":
         return 'ERROR: strategy must be "DFS" or "BFS" (case sensitive)'
     else:
         self.strategy = strategy
Exemplo n.º 9
0
 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)
Exemplo n.º 10
0
	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)
Exemplo n.º 11
0
 def __init__(self,
              strategy="BFS",
              tree=True,
              verbose=False,
              max_depth=0,
              duplicate_strategy="advanced_list"):
     Algorithm.__init__(self, verbose)
     #self.log_count = 1
     self.visited = []  # visisted/explored list for Graph Search
     self.solution = []  # list of solutions (only 1 if all_solutions=False)
     self.tree = tree  # True for tree search, False for Graph search
     if not strategy == "BFS" and not strategy == "DFS" and not strategy == "IDDFS":
         return 'ERROR: strategy must be "DFS" or "BFS" or "IDDFS" (case sensitive)'
     #ensure duplication checking strategy for graphs is on of the following:
     if not duplicate_strategy == "advanced_list" and not duplicate_strategy == "simple_list" and not duplicate_strategy == "parent_trace":
         return 'ERROR: strategy must be "advanced_list" or "simple_list" or "parent_trace" (case sensitive)'
     self.strategy = strategy
     print(duplicate_strategy)
     self.dupstrat = duplicate_strategy
     if strategy == "IDDFS":
         self.id_depth = 1
         self.max_id_depth = max_depth
Exemplo n.º 12
0
 def __init__(self, params):
     Algorithm.__init__(self, params)
     self.loss_train = []
Exemplo n.º 13
0
	def __init__(self, g):
		'''
		Constructor
		'''
		Algorithm.__init__(self, g)
		self.old_g = nx.Graph()
Exemplo n.º 14
0
 def __init__(self, params):
     Algorithm.__init__(self, params)
 def __init__(self, quantum, priorities_quant, aging_quant):
     Algorithm.__init__(self, PriorityMap(priorities_quant, aging_quant))
     self.quantum = quantum
Exemplo n.º 16
0
 def __init__ (self, num_players):
     Algorithm.__init__(self, num_players)
Exemplo n.º 17
0
 def __init__(self):
     Algorithm.__init__(self, [])
Exemplo n.º 18
0
 def __init__(self, nodes):
     Algorithm.__init__(self, nodes)
     self.nodes_left = []
     self.current_state = [self.nodes[0]]
     self.expanded_state = []
     self.heuristic = Heuristic(nodes)
 def __init__(self, nodes):
     Algorithm.__init__(self, nodes)
Exemplo n.º 20
0
 def __init__(self):
     Algorithm.__init__(self)
     self.rows = 'ABCDEFGHI'
     self.cols = '123456789'
     self.squares = self.cross(self.rows, self.cols)
Exemplo n.º 21
0
 def __init__(self, verbose=False):
     Algorithm.__init__(self, verbose)
     self.variables = None
     self.constraints = None
Exemplo n.º 22
0
Arquivo: bfs.py Projeto: JasonArce/UMN
 def __init__(self, verbose=False):
     Algorithm.__init__(self, verbose)
Exemplo n.º 23
0
 def __init__(self, initTheta, data, labels, alpha_param, lambda_param=0):
     Algorithm.__init__(self, initTheta, data, labels, alpha_param,
                        lambda_param)
Exemplo n.º 24
0
 def __init__(self, g):
     '''
     Constructor
     '''
     Algorithm.__init__(self, g)
     self.table = {}        
Exemplo n.º 25
0
 def __init__(self,initTheta, data,labels, alpha_param=0.1,regularisation_param = 0):
     Algorithm.__init__(self,initTheta,data,labels, alpha_param, regularisation_param)
Exemplo n.º 26
0
 def __init__(self, g):
     '''
     Constructor
     '''
     Algorithm.__init__(self, g)
     self.table = {}