def iniciaSimulacao(self):

        tempo1 = time.time()

        self.geraIndividuosAleatoriamente()
        #self.geraFogoInicial()
        for ind in range(self.dados.QTD_REPLICACACOES):
            self.carregaMapas()
            #self.geraIndividuosAleatoriamente()
            if self.dados.FLAG_ATIVACAO_FOGO:
                self.geraFogoInicial()

            self.diretorioImagens = self.diretorio + "/" + str(
                ind) + '/imagens/'
            os.makedirs(self.diretorioImagens)
            logs = Logs(self.diretorio, ind)
            #print("Replicacao numero "+str(ind))
            #logs.gravaNumReplicacao(ind)
            #logs.gravaCabecalho(self.dados.QTD_PESSOAS)
            self.tempo = 0
            self.atribuiMapaIndividuoInicial()
            #self.geraIndividuosAleatoriamente()

            logs.abreMovsPerIter()
            iters = self.simulacao(logs)
            logs.fechaMovsPerIter()

            KPIs = logs.printaKPIs(self.listaIndividuos,
                                   self.dados.FLAG_ATIVACAO_FOGO)

            logs.geraHTML(self.data, self.tempo,
                          self.listaIndividuos.__len__(),
                          self.listaMapas.__len__(), KPIs,
                          self.dados.FLAG_ATIVACAO_FOGO)
            #print("Simulacao Finalizada com sucesso com Tempo = " + str(self.tempo))
            #print(str(ind)+"\t"+str(self.tempo));
            logs.geraResultado(ind, self.tempo)

            self.exportaGraficos(self.diretorio, ind)

        tempo2 = time.time()
        dife = tempo2 - tempo1

        # Se arquivo não existe, cria-o com o cabeçalho
        if os.path.exists('resultados.txt'):
            file = open('resultados.txt', "a")
        else:
            file = open('resultados.txt', "w+")
            file.write("RUNTIME\tIteracoes\tMedia movimentos\tMedia espera\n")
        file.write(f"{str(dife)}\t{str(iters)}\t{KPIs[0]}\t{KPIs[1]}\n")
        file.close()