Embarrassingly parallel search
Also known as EPS, Parallel portfolio
constraint constraint-search
Embarrassingly parallel search splits one search into many independent subproblems; here it is ParallelSolver, behind the parallel feature, which needs std. It fixes the branching variables breadth first, propagating each partial assignment and dropping the inconsistent ones, until there are at least eight subproblems per thread. Worker threads, each with its own solver over the shared model, take the subproblems from a shared queue, and a shared flag stops them all at the first solution, at a count's limit or when one budget runs out. Use it to find or count solutions of one hard model on several cores. The portfolio mode instead races one thread per pair of variable and value orders on the whole problem.
Pseudocode
algorithm Embarrassingly-Parallel-Search(model, t)input: shared model, t worker threadsoutput: the first solution any worker finds, or failureCUBES ← split(model, 8 · t)next ← 0 ▷ an atomic index into CUBESstop ← falsein parallel dofor each worker w in 1, …, t dowhile not stop and next < |CUBES| doq ← CUBES[next]next ← next + 1 ▷ read and increment in one atomic stepreset the solver of w and fix the assignments of qs ← backtracking search below q, checking stop at every nodeif s is a solution thenrecord s unless a solution is recordedstop ← truereturn the recorded solution, or failurefunction split(model, target)OPEN ← ⟨⟨⟩⟩ ▷ partial assignments, first in first outLEAVES ← ⟨⟩while |OPEN| + |LEAVES| < target and OPEN ≠ ∅ doq ← pop-front(OPEN)if propagate(model with q fixed) = failure thencontinue ▷ drop an inconsistent branchx ← pick-variable(model with q fixed) ▷ the workers' variable orderif x = nil thenappend(LEAVES, q) ▷ q fixes every variableelsefor each v ∈ D(x) dopush-back(OPEN, q ∪ {x = v})return OPEN followed by LEAVESfunction Portfolio(model, ORDERS)input: shared model, pairs of variable order and value orderoutput: the first solution any strategy finds, or failurestop ← falsein parallel dofor each (var-order, value-order) in ORDERS dos ← backtracking search on the whole model with these orders, checking stop at every nodeif s is a solution thenrecord s unless a solution is recordedstop ← truereturn the recorded solution, or failureIn the crates
constraint-searchfeatureparallelSplits the search into partial assignments of the first branching variables, which a thread pool solves with one Solver each; a portfolio mode races branching heuristics instead.
Lineage
Comes from
builds on Backtracking search with propagation
Led to
Nothing on this site.
Papers
- Embarrassingly Parallel Search Jean-Charles Régin, Mohamed Rezgui, Arnaud Malapert · 2013· Principles and Practice of Constraint Programming (CP 2013), Lecture Notes in Computer Science