Russ Abbott wrote:
Does one use Oz as a concurrent logic system with Or-concurrency, i.e., start a new thread for each choice? I haven't thought about using it that way, but if that's a feasible approach, why doesn't CTM or the Tutorial present that strategy?
You raised one of the issues with choice. Actually at most one thread can make a choice within a computation space. In other words, you cannot have two concurrent "choices" inside a space. That's why "choice" is used purely sequentially in Chapter 9 of CTMCP.
The reason of that limitation is that *search must be deterministic*. When you explore the solutions of a problem, you let the (possibly concurrent) program run inside a computation space. You wait until this program reaches a fixpoint, which is either a success, a failure, or a nondeterministic choice. If the fixpoint is unique, search will be deterministic.
Deterministic search is essential. Indeed, a nondeterministic fixpoint means that your program is simply not declarative. But it also permits *recomputation*, a technique that makes Mozart competitive with traditional approaches. A search engine can save up memory by recomputing certain steps in the search instead of keeping them in memory. More information about recomputation can be found in Christian Schulte's thesis.
Now guaranteeing determinism with "choice" can be a bit tricky. If the program is sequential, everything is fine. If the program is concurrent (like in FD), you cannot make a "choice" while other threads are running. This is because you often rely on the current state of the store to decide what the alternatives of the choice are. If other threads are running, this information might be incomplete. Therefore the thread responsible for making a choice must first wait until all other threads reach their fixpoint. This is exactly what FD.distribute does, for instance.
Cheers, raph _________________________________________________________________________________ mozart-users mailing list [email protected] http://www.mozart-oz.org/mailman/listinfo/mozart-users
