Real-world applications have to interact with their environment and be sufficiently fast for real-time computation, and thus concurrent, anytime, online algorithms are an asset.
A CHR program will automatically implement algorithms with these desirable properties due to the properties of its operational semantics. The anytime (approximation) algorithm property means that we can interrupt the execution of a program at any time, observe an approximation to the result and restart from that intermediate result. The online (incremental) algorithm property means that we can add additional constraints while the program is running without the need to recompute from scratch. Concurrency means that rules can be applied in parallel to separate (even certain overlapping) parts of a goal.
Unless otherwise noted, we use the very abstract semantics in this chapter to avoid clutter and technicalities of the abstract semantics.
The results in this chapter carry over to the refined operational semantics with some limitations only. In particular, programs written with the refined semantics in mind may give wrong results when executed in parallel. However, if a program has the confluence property (cf. Section 5.2), programs executing under the refined semantics basically also have the three properties (anytime, online, concurrent) discussed in this chapter.
Anytime approximation algorithm property
In an anytime algorithm we can interrupt the execution of a program at any time, observe an approximation to the result and continue from that intermediate result without the need to recompute from scratch. The intermediate results from successive interrupts better and better approximate the final result.