diff --git a/PyCTBN/PyCTBN/estimators/structure_constraint_based_estimator.py b/PyCTBN/PyCTBN/estimators/structure_constraint_based_estimator.py index 2fa255e..fdf4c16 100644 --- a/PyCTBN/PyCTBN/estimators/structure_constraint_based_estimator.py +++ b/PyCTBN/PyCTBN/estimators/structure_constraint_based_estimator.py @@ -225,13 +225,14 @@ class StructureConstraintBasedEstimator(StructureEstimator): #with multiprocessing.Pool(processes=cpu_count) as pool: #with get_context("spawn").Pool(processes=cpu_count) as pool: if disable_multiprocessing: - print("DISABILITATO") + print("DISABLED") cpu_count = 1 list_edges_partial = [ctpc_algo(n,total_vars_numb) for n in self._nodes] else: - if processes_number is not None and cpu_count < processes_number: + if processes_number is not None and cpu_count > processes_number: cpu_count = processes_number + print(f"CPU COUNT: {cpu_count}") with concurrent.futures.ProcessPoolExecutor(max_workers=cpu_count) as executor: list_edges_partial = executor.map(ctpc_algo, self._nodes, diff --git a/PyCTBN/PyCTBN/estimators/structure_score_based_estimator.py b/PyCTBN/PyCTBN/estimators/structure_score_based_estimator.py index 5763739..41300c1 100644 --- a/PyCTBN/PyCTBN/estimators/structure_score_based_estimator.py +++ b/PyCTBN/PyCTBN/estimators/structure_score_based_estimator.py @@ -96,12 +96,11 @@ class StructureScoreBasedEstimator(StructureEstimator): 'get the number of CPU' - cpu_count = multiprocessing.cpu_count() - print(f"CPU COUNT: {cpu_count}") + cpu_count = multiprocessing.cpu_count() if disable_multiprocessing: cpu_count = 1 - elif processes_number is not None and cpu_count < processes_number: + elif processes_number is not None and cpu_count > processes_number: cpu_count = processes_number @@ -111,6 +110,8 @@ class StructureScoreBasedEstimator(StructureEstimator): #with get_context("spawn").Pool(processes=cpu_count) as pool: #with multiprocessing.Pool(processes=cpu_count) as pool: + print(f"CPU COUNT: {cpu_count}") + 'Estimate the best parents for each node' if disable_multiprocessing: list_edges_partial = [estimate_parents(n,max_parents,iterations_number,patience,tabu_length,tabu_rules_duration,optimizer) for n in self._nodes]