I’ve implemented code for a simple branch and bound procedure for maximizing a function in Julia (actually I’ve tweaked the code in NeuralPriorityOptimizer.jl).

Currently the code runs on a single thread, but I’d like to use parallelization/multithreading to get some speedup.

It basically computes an upper bound of my function over some domain and stores the result in a priority queue.

During the branch and bound algorithm, it always takes the subdomain with the largest upper bound and refines it to get a better approximation.

The rough structure is shown below:

```
q = PriorityQueue(Base.Order.Reverse)
enqueue!(q, init_domain, relax_ub(init_domain))
while some_condition
dom, relax_val = peek(q)
dequeue!(q)
...
dom1, dom2 = split(dom)
enqueue!(q, dom1, relax_ub(dom1))
enqueue!(q, dom2, relax_ub(dom2))
end
```

**What would be the best way to parallelize this code?**

I imagine the easiest solution would be a parallel priority queue, but I haven’t found a Julia solution thus far.