Commit 58329123 authored by Dumoulin Nicolas's avatar Dumoulin Nicolas
Browse files

Pool activated only in multiprocessing mode

parent f0e346be
......@@ -219,7 +219,8 @@ class MCMC:
return [scenarios, scores]
def run(self, nb_processes=mp.cpu_count()):
self.pool = mp.Pool(processes=nb_processes)
if self.multiprocessing:
self.pool = mp.Pool(processes=nb_processes)
# Initial sampling and evaluation
nb_particles = self.mcmc_config['initial_nb_particles']
scenarios_init = pd.DataFrame([self.patches])
......@@ -232,7 +233,8 @@ class MCMC:
# Storing variation of indicators
init_var = scores.std()
# sequential optimization loop
self.pool.close()
if self.multiprocessing:
self.pool.close()
return [scenarios,scores]
if __name__ == '__main__':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment