12
12
MaxProdConstraint ,
13
13
MinConflictsSolver ,
14
14
OptimizedBacktrackingSolver ,
15
+ ParallelSolver ,
15
16
Problem ,
16
17
RecursiveBacktrackingSolver ,
17
18
Solver ,
@@ -57,6 +58,7 @@ def __init__(
57
58
self .params_values = tuple (tuple (param_vals ) for param_vals in self .tune_params .values ())
58
59
self .params_values_indices = None
59
60
self .build_neighbors_index = build_neighbors_index
61
+ self .solver_method = solver_method
60
62
self .__neighbor_cache = dict ()
61
63
self .neighbor_method = neighbor_method
62
64
if (neighbor_method is not None or build_neighbors_index ) and neighbor_method not in supported_neighbor_methods :
@@ -67,7 +69,7 @@ def __init__(
67
69
if (
68
70
len (restrictions ) > 0
69
71
and any (isinstance (restriction , str ) for restriction in restrictions )
70
- and not (framework_l == "pysmt" or framework_l == "bruteforce" )
72
+ and not (framework_l == "pysmt" or framework_l == "bruteforce" or solver_method . lower () == "pc_parallelsolver" )
71
73
):
72
74
self .restrictions = compile_restrictions (
73
75
restrictions ,
@@ -98,6 +100,8 @@ def __init__(
98
100
solver = BacktrackingSolver ()
99
101
elif solver_method .lower () == "pc_optimizedbacktrackingsolver" :
100
102
solver = OptimizedBacktrackingSolver (forwardcheck = False )
103
+ elif solver_method .lower () == "pc_parallelsolver" :
104
+ solver = ParallelSolver ()
101
105
elif solver_method .lower () == "pc_recursivebacktrackingsolver" :
102
106
solver = RecursiveBacktrackingSolver ()
103
107
elif solver_method .lower () == "pc_minconflictssolver" :
@@ -407,6 +411,8 @@ def __add_restrictions(self, parameter_space: Problem) -> Problem:
407
411
elif isinstance (restriction , Constraint ):
408
412
all_params_required = all (param_name in required_params for param_name in self .param_names )
409
413
parameter_space .addConstraint (restriction , None if all_params_required else required_params )
414
+ elif isinstance (restriction , str ) and self .solver_method .lower () == "pc_parallelsolver" :
415
+ parameter_space .addConstraint (restriction )
410
416
else :
411
417
raise ValueError (f"Unrecognized restriction { restriction } " )
412
418
0 commit comments