コード例 #1
0
ファイル: paralelo.py プロジェクト: diegoahg/Lab2_Paralela
                break  # Si el sistema percola, terminamos
        abiertos = float(self.N ** 2 - len(cerrados))
        # La estimación del umbral de percolación
        return abiertos / (self.N * self.N)

if __name__ == '__main__':
    t0 = time.time()
    prom = 0.0
    if rank == 0:
        sim1 = sim / size + sim % size
    else:
        sim1 = sim / size

    for i in range(sim1):
        Perc = PercolationSimulation(N)
        prom += Perc.umbral()
    prom = prom / (sim1)
    if rank != 0:
        comm.send(prom, dest=0)
    if rank == 0:
        final = 0
        for i in range(1, size):
            final += comm.recv(source=i)
        final += prom
        final = final / size
        final = final * cont
        TF = time.time()
        T = TF - t0
        crearPDFBD(enfe, dist, N, final, T, nombre)
        envio_mail(mail, nombre)
コード例 #2
0
ファイル: sec.py プロジェクト: diegoahg/Lab2_Paralela
 if arbol == 3: #boldo
     comb = 32
 if arbol == 4: #roble
     comb = 10
 if arbol == 5: #rauli
     comb = 20
 if suelo == 1:
     comb = (comb + 97)/2
 if suelo == 2:
     comb = (comb + 80)/2
 if suelo == 3:
     comb = (comb + 53)/2
 if suelo == 4:
     comb = (comb + 78)/2
     pass
 for i in range(SAMPLE_SIZE):
     percolacion = PercolationSimulation(N)
     estimado = percolacion.umbral()
     mean += estimado
     estimated_threshold.append(estimado)
 mean /= SAMPLE_SIZE
 for x in estimated_threshold:
     variance += (x - mean) ** 2
 variance /= (SAMPLE_SIZE - 1)
 mean = (mean * comb)/100
 mean = 1 - mean
 nompdf = nombre + ".pdf"
 T = (time()-ST)
 crearPDF(arbol,suelo,dist,N,mean,T,nompdf)
 envio_mail(mail,nompdf)