Constraint logic programming (CLP) is a generalization of logicprogramming where unification is replaced by constraint solving as thebasic operation of the language. The combination of constraint solvingand nondeterminism (approximated by backtracking) makes these languagesappealing for a variety of combinatorial search problems. Existing CLPlanguages support backtracking by generalizing traditional Prologimplementations: modifications to the constraint system are trailed andrestored on backtracking. Although simple and efficient, trailing may bevery demanding in memory space, since the constraint system maypotentially be saved at each choice point. This paper proposes afundamentally new implementation scheme for backtracking inCLP languages over linear (rational or real) arithmetic. The newscheme, called semantic backtracking,does not use trailing but rather exploits the semantics of the constraints to undo the effect of newly added constraints. Semantic backtracking reduces the space complexity by an order of magnitude compared to implementations based on trailing and makes space complexity essentially independent of the number of choice points. In addition, semantic backtracking introduces negligible space and time overhead on deterministic programs. The price for this improvement is an increase in backtracking time, although constraint-solving time may actually decrease. The scheme has been implemented as part of a complete CLPsystem CLP(RLin) and compared analytically and experimentally withan optimized trailing implementation. Experimental results indicate that semantic backtracking produces significant reduction in memory space, while keeping the time overhead reasonably small.
[1]
J StuckeyPeter,et al.
The CLP( ℛ ) language and system
,
1992
.
[2]
Roland H. C. Yap,et al.
An abstract machine for CLP(R)
,
1992,
PLDI '92.
[3]
Pascal Van Hentenryck,et al.
Simulation of Hybrid Circuits in Constraint Logic Programming
,
1989,
IJCAI.
[4]
Françoise Berthier.
Using CHIP to support decision making
,
1988,
SPLT.
[5]
Roland H. C. Yap,et al.
Constraint Logic Programming and Option Trading
,
1987,
IEEE Expert.
[6]
Roland H. C. Yap,et al.
The CLP( R ) language and system
,
1992,
TOPL.
[7]
Chris Moss,et al.
An introduction to Prolog
,
1990
.
[8]
Remo Guidieri.
Res
,
1995,
RES: Anthropology and Aesthetics.
[9]
Peter J. Stuckey.
Incremental Linear Constraint Solving and Detection of Implicit Equalities
,
1991,
INFORMS J. Comput..
[10]
Pascal Van Hentenryck,et al.
The Constraint Logic Programming Language CHIP
,
1988,
FGCS.
[11]
Alain Colmerauer,et al.
An introduction to Prolog III
,
1989,
CACM.
[12]
Pascal Van Hentenryck.
Constraint satisfaction in logic programming
,
1989,
Logic programming.
[13]
George B. Dantzig,et al.
Linear programming and extensions
,
1965
.
[14]
Pascal Van Hentenryck.
A logic language for combinatorial optimization
,
1990
.
[15]
Joxan Jaffar,et al.
Constraint logic programming
,
1987,
POPL '87.