<jupyter_start><jupyter_text>Draw inspiration from https://blog.dominodatalab.com/simple-parallelization/<jupyter_code>inputs = range(100, 125)
threshold = 10000
num_cores = multiprocessing.cpu_count()
def processInput(i):
    model = MaxPRegionsHeu(local_search = AZP(), random_state=i)
    model.fit_from_w(w_rook, values_gdf.values, spatially_extensive_attr_gdf, threshold = threshold)
    gdf['labels'] = model.labels_
    return [any(gdf.groupby('labels')['pop'].sum() < threshold), not boolean_assert_feasible(gdf['labels'], adj)]
     
results = Parallel(n_jobs=num_cores)(delayed(processInput)(i) for i in inputs)

thr_aux = [l[0] for l in results]
con_aux = [l[1] for l in results]

print('Problems in Threshold: {}'.format(any(thr_aux)))
print('Problems in Contiguity: {}'.format(any(con_aux)))
AZP_thr_aux = thr_aux
AZP_con_aux = con_aux
def processInput(i):
    model = MaxPRegionsHeu(local_search = AZPBasicTabu(), random_state=i)
    model.fit_from_w(w_rook, values_gdf.values, spatially_extensive_attr_gdf, threshold = threshold)
    gdf['labels'] = model.labels_
    return [any(gdf.groupby('labels')['pop'].sum() < threshold), not boolean_assert_feasible(gdf['labels'], adj)]
     
results = Parallel(n_jobs=num_cores)(delayed(processInput)(i) for i in inputs)

thr_aux = [l[0] for l in results]
con_aux = [l[1] for l in results]

print('Problems in Threshold: {}'.format(any(thr_aux)))
print('Problems in Contiguity: {}'.format(any(con_aux)))
AZPBasicTabu_thr_aux = thr_aux
AZPBasicTabu_con_aux = con_aux
def processInput(i):
    model = MaxPRegionsHeu(local_search = AZPReactiveTabu(max_iterations = 2, k1 = 2, k2 = 2), random_state=i)
    model.fit_from_w(w_rook, values_gdf.values, spatially_extensive_attr_gdf, threshold = threshold)
    gdf['labels'] = model.labels_
    return [any(gdf.groupby('labels')['pop'].sum() < threshold), not boolean_assert_feasible(gdf['labels'], adj)]
     
results = Parallel(n_jobs=num_cores)(delayed(processInput)(i) for i in inputs)

thr_aux = [l[0] for l in results]
con_aux = [l[1] for l in results]

print('Problems in Threshold: {}'.format(any(thr_aux)))
print('Problems in Contiguity: {}'.format(any(con_aux)))
AZPReactiveTabu_thr_aux = thr_aux
AZPReactiveTabu_con_aux = con_aux
def processInput(i):
    model = MaxPRegionsHeu(local_search = AZPSimulatedAnnealing(init_temperature=1), random_state=i)
    model.fit_from_w(w_rook, values_gdf.values, spatially_extensive_attr_gdf, threshold = threshold)
    gdf['labels'] = model.labels_
    return [any(gdf.groupby('labels')['pop'].sum() < threshold), not boolean_assert_feasible(gdf['labels'], adj)]
     
results = Parallel(n_jobs=num_cores)(delayed(processInput)(i) for i in inputs)

thr_aux = [l[0] for l in results]
con_aux = [l[1] for l in results]

print('Problems in Threshold: {}'.format(any(thr_aux)))
print('Problems in Contiguity: {}'.format(any(con_aux)))
AZPSimulatedAnnealing_thr_aux = thr_aux
AZPSimulatedAnnealing_con_aux = con_aux<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1395582329317269, 'fraction_numerical': 0.008366800535475234, 'mean_word_length': 6.683804627249358, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '366415', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1100, 'n_words': 211, 'path': 'region/notebooks/feasibility_multiple_checkings.ipynb', 'repo_name': 'weikang9009/region', 'size': '2988'}