A Metalevel Compiler of CLP(FD) and Its Combination with Intelligent Backtracking

We propose an implementation of constraint solving over nite domains, as pioneered by CHIP, on top of any Prolog system that provides a delay mechanism and backtrackable assignment. The aim is to propose a simple, portable, easily-maintenable, but yet eecient package. The performances of our system are of the same order of magnitude than a "wired" implementation of nite domains such as CHIP, even on quite large programs. We have also designed some basic low-level (WAM) extension to Prolog's delay mechanism to make it more suited for handling constraint solving, such as priority queues for scheduling woken goals, that allow to preferentially treat cheap primitive constraints and investigate various constraint solving heuristics. Moreover, we propose an intelligent backtracking scheme for Finite Domain CLP Languages. Intelligent backtracking consists in determining, upon unsolvability of the constraint system, a pertinent choice-point which can "cure" the failure , and departs from the naive approach usually found in logic programming which always goes to the most recent choice-point, whether it is pertinent or not. As non-determinism is used in CLP to express disjunctive constraints (eg. disjunctive scheduling) or heuristic search techniques, our method can be used to improve the eeciency in such problems. We propose an implementation of this scheme by using the nite domains constraint solver on top of a Prolog compiler with intelligent backtracking. Interestingly, our framework also leads to a new (and eecient) execution model for Hierarchical Constraint Languages, and can be the basis for general incre-mental constraint solving.