# builders.solver.parallelability
Domain specification
# ParallelSolver
A solver must inherit this class if it wants to call several cloned parallel domains in separate concurrent processes. The solver is meant to be called either within a 'with' context statement, or to be cleaned up using the close() method.
# Constructor ParallelSolver
ParallelSolver(
parallel: bool = False,
shared_memory_proxy = None
)
Creates a parallelizable solver
# Parameters
- parallel: True if the solver is run in parallel mode.
- shared_memory_proxy: Shared memory proxy to use if not None, otherwise run piped parallel domains.
# call_domain_method ParallelSolver
call_domain_method(
self,
name,
*args
)
Calls a parallel domain's method. This is the only way to get a domain method for a parallel domain.
# close ParallelSolver
close(
self
)
Joins the parallel domains' processes. Not calling this method (or not using the 'with' context statement) results in the solver forever waiting for the domain processes to exit.
# get_domain ParallelSolver
get_domain(
self
)
Returns the domain, optionally creating a parallel domain if not already created.
# _initialize ParallelSolver
_initialize(
self
)
Launches the parallel domains. This method requires to have previously recorded the self._domain_factory, the set of lambda functions passed to the solver's constructor (e.g. heuristic lambda for heuristic-based solvers), and whether the parallel domain jobs should notify their status via the IPC protocol (required when interacting with other programming languages like C++)