'Does the Choco-Solver Java library support Parallel Programming?
My constraint problem has become too complex, and I'm looking to know if the Choco-Solver framework which I'm using to model and solve the problem supports a parallel programming approach like multi-threading.
Originally, I thought this would happen by default, but checking the CPU usage percentage when running top -i
shows it consistently around 100%, so I assume parallelization is not occurring.
I know about the ParallelPortfolio class in Choco, but it's not what I'm looking for since I have implemented a custom search strategy and it's that one that I want to use multi-threading on.
Solution 1:[1]
There are roughly 3 ways for parallel programming in constraint programming.
- Paralleling the propagation of the constraints: the constraints to be propagated are distributed among CPUs/cores. In that case, the main bottleneck comes from variables' domain synchronisation. You also need to find a relevant way to distribute constraints propagation among cores. This is an approach that was studied with Choco-solver without much success, the approach was abandoned.
- Paralleling the search space exploration: the search space is divided into subspaces, a CPU/core is in charge of exploring it. In that case, the main issue is related to the capacity to replicate a (sub-)model. The way Choco-solver manages backtracks is based on trailing (as opposed to copying), so not directly adapted to duplication. This could possibly be done using a serialization framework.
- Paralleling the search space (2): each CPU/core is responsible of a model and defines a specific search strategy. In that case, the copy issue is delegated to the user (since it is purely a Java problem) and models (actually solvers) starts a race where each time a solution is found, the information is shared between the models. This is the principle of the
ParallelPortfolio
in Choco-solver.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | cprudhom |