Constraint Logic Programming
a Personal Perspective

Pascal Van Hentenryck
Brown University
U.S.A.

Editor: Enrico Pontelli



PDF Version Available HERE.

I was asked to provide a personal perspective on the development of constraint logic programming. It gives me tremendous pleasure to remember these early days in the CHIP project and to identify some of the lessons I learned back then. I will also discuss how these ideas have spread out to remove areas of the field, using some constraint programming (CP) projects I was involved with. I will conclude by stressing that LP and CP still have a lot in common.

The CHIP Project

I came to logic programming by sheer luck. The university of Namur in Belgium had the great practice of sending students abroad for about 4 months in their final year. In the fall of 1984, I went to the center for telecommunications in Lannion for studying software engineering. After two months, my fellow student and I had nothing left to work on, so we started looking for other opportunities in the center. I was fortunate to meet Mehmet Dincbas who gave me papers and books to read (and there were not that many), suggested all kinds of programming projects in logic programming, answered all my questions (and there were many), and spent considerable time explaining me the folklore and the grand challenges of logic programming. Before I was about to leave, Mehmet told me that he was joining Hervé Gallaire at the European Computer-Industry Research Centre (ECRC) and he asked me whether I was interested to come along. I became the first PhD student at ECRC in August 1985 where I spent about 4.5 years in the CHIP project.

Finding the Missing Link:

When I came to ECRC, I was given Alain Colmerauer’s slides on Prolog III and Jean-Louis Lauriere’s paper on Alice. Alain’s slides had the slogan
The Power of Prolog III = Constraint Solving + Nondeterminism
while the Alice system showed how to use constraints to solve a variety of combinatorial optimization problems. Alain and Jean-Louis lived in Marseilles and Paris respectively and could not be more different. My role at ECRC was to bridge their work. I read a lot of papers in the fall of 1985 but could not see the connection. During my Christmas vacation in Belgium, I sneaked out one morning and went the library at the university of Namur to look for the 1977 paper by Alan Mackworth in the AI journal. I read it there sitting on the floor. This is a beautifully written paper with an amazing footnote and I realized then that I had found the missing link: arc consistency was declarative and could unify the goals of Alice and Prolog III: solving complex problems in a declarative language. This is obvious a posteriori but, at that time, arc consistency was exotic: there were very few papers on this topic in 1985. I wrote my first constraint paper “Domains in Logic Programming” which was published at AAAI’86. I gave the talk in the last session of the conference in a remote building and there were 2 persons in the audience besides the speakers and the session chair. But I had the chance to meet Alan who could not have been more encouraging.

Building systems:

After finishing the AAAI-86 paper, Hervé and Mehmet told me to implement the ideas. I really did not see the point: I knew that they would work and I wanted to move to another topic and write more papers. But research, Hervé told me, is not about writing papers: It is about creating and communicating new ideas and system building plays a fundamental role in this process. Hervé, Alain Colmerauer, and Jean-Louis Lassez constantly reminded me of the value of system building in the last two decades.

Be driven by applications:

ECRC was a great place for developing a system as industrials would come and give us applications to solve. Helmut Simonis also joined ECRC in 1986 and became my office mate. Helmut had no fear and would try CHIP on every possible application and this often boosted the development of the system tremendously. Jean-Philippe Carillon visited ECRC in 1987 and demonstrated a package for warehouse location. The first model I wrote in CHIP for this problem looked like this (using mathematical notations, not CHIP syntax):

It was basically a traditional MIP model, exploiting some of the CHIP coroutining facilities to link the warehouse variables  and the decision variables  assigning the customers to the warehouses. I showed the model to Hervé and you could see he was disappointed by the model and the performance, although he was too diplomatic to say so directly. Herv´e always had very high standards, which included coming to ECRC before, and leaving after, anyone else. I then wrote another model which was much more efficient. Using mathematical notations, this model could be written as

The key is the expression  which features the element constraint, avoiding the 0/1 decision variables . The warehouse location opened a pandora box for us: constraints did not have to be numeric: They could capture any relation and hence preserve the high-level structure of the applications. I gave the talk on the resulting paper at AAAI’88 and Ken McAloon was in the audience (there were more people this time around). He was amazingly encouraging and excited about the benefits of capturing the structure of applications.

After that, we saw element constraints everywhere. Helmut started solving the car-sequencing problem with the element constraint. However the issue was how to express the demand constraints on the cars. Helmut obviously did not want to introduce 0/1 variables and he asked me if I had another idea (recall that we were separated only by two (bulky) monitors). The pandora box was open and I told him that it was easy to introduce this cardinality constraint in CHIP. Once again, we had captured another important substructure, simply by considering an interesting application. The resulting program would quickly solve small instances but would backtrack forever on large ones. Helmut then built a visualization of the program and we spent time looking at the screen and understanding what was going on. We eventually realized that the propagation was only detecting failures very late. We designed redundant constraints (which are sometimes called implied constraints now) to address this pathological behaviour and obtained the program described in our ECAI’88 paper. The car-sequencing application was an amazing learning experience for us. It led to cardinality constraints, to visualizations, and to redundant constraints. The modeling itself removes symmetries (cars requiring the same options are interchangeable) and was the motivation for Freuder’s paper in 1992 on interchangeability. Jean-François Puget also told me once that this paper attracted him to the area.

Just do it, then clean the mess:

Alan Perlis once wrote that “simplicity does not precede complexity, but follows it”. It is indeed difficult to isolate the right concepts or abstractions immediately or to come up with the right design the first time. It is just how science works. We have to see the same patterns several times before recognizing them and determining how important they are. CHIP was sometimes criticized because it was growing in an ad-hoc fashion. But we could not see the proper abstractions or did not have the knowledge to simplify the concepts at the time. When I joined Brown in 1990, my goal was to clean the mess and I started working on the cc(FD) system. Ole Madsen, speaking about the BETA programming language said that “ there were always two criteria for adding a construct to the language: it should be meaningful from a modeling standpoint as well as from technical standpoint.” Together with Yves Deville and Vijay Saraswat, I took the modeling road and try to find generic abstractions to build all the ad-hoc constraints of CHIP. It led to the cardinality operator, constructive disjunction, reification, and indexicals. Many of the ad-hoc constraints of CHIP were now easy to build in the language using logical or cardinality combinators. Nicolas Beldiceanu and Jean-Charles Régin took a more algorithmic road and studied how to increase the algorithmic power of constraints. Jean-Charles’ papers were especially elegant because they removed the ad-hoc aspects of algorithmically sophisticated constraints and showed how to enforce arc consistency on complex constraints using matching and flow algorithms.

Strive for the declarative ideal:

I have mentioned several times already the importance of declarative abstractions and, in terms of Alain’s slogan, the contribution of the CHIP system can be summarized
The Power of CHIP = Declarative Filtering + Nondeterminism.
Nowadays filtering algorithms are typically specified declaratively. They are not just a bag of implementation tricks, but rather they specify the properties enforced when the propagation step converges. This property should ideally be arc consistency, but it has to be relaxed for some constraints whose feasibility problems are NP-complete, such as the edge finder for disjunctive and cumulative scheduling. There are significant benefits in having these declarative specifications. First, they allow programmers to reason about their program behavior and complexity. Second, they define an algorithmic problem for which algorithmic and complexity results can be derived. Finally, they allow for effective compiler optimizations and model transformations.

The CHIP project did not take place in isolation of course. In fact, much of the success of constraint logic programming in the late 80s came from the synergy between several groups, including BNR-Prolog, CHIP, CLP(R), and Prolog III. I have already mentioned the impact of Alain on CHIP and I will describe the impact of BNR-Prolog on Numerica shortly. Obviously, there is no need to highlight the scientific impact of the CLP scheme and how it crystallized the essence of constraint logic programming. These were exciting times for all of us and most of the PhD students in these groups are still passionate about constraint programming twenty years later.

Constraint Programming as an Integration Technology

In the 1990s, constraint logic programming became constraint programming. From a programming language standpoint, CP is an integration technology embedding diverse computational methods into general-purpose languages and it spread the declarative ideal to many areas of computer science, including numerical analysis, vision, robotics, and mathematical optimization. But CP also brought a new, declarative way of looking at computational methods which even led to some novel methods in areas as remote as ordinary differential equations. The idea is simple, always specify the semantics of constraints as a property of a fixpoint, but it had many interesting ramifications. Let me illustrate them on some of my subsequent projects.

The Numerica Project:

In the fall of 1993, I started a junior sabbatical, which I spent partly at MIT and at Marseilles. My host at MIT was David McAllester and we spent the first couple of meetings trying to find a joint project. David had received a couple of papers by Eldon Hansen on the interval Newton method and I had recently read papers in BNR-Prolog by Older and Vellino. We decided to study how to integrate these ideas and, in particular, how to use interval Newton methods to filter nonlinear constraints. We ended up finding a way to prune the variable bounds by using interval Newton methods: the pruning operator was itself a search algorithm. We tested the algorithms on the Broyden banded function and the results were amazing: we could solve very large instances without search: propagation alone was sufficient. Deepak Kapur was also visiting David that fall and joined the discussions. Eventually we came to realize that constraint programming and numerical analysis methods were really orthogonal: constraint programming techniques were effective to reduce the search space when far from a solution, while interval Newton methods were excellent close to a solution. Overall, this was an exciting time involving a lot of scientific progress. John Hooker once said in a panel that global optimization was one of the areas in which constraint programming had the most impact.

I spent the second part of my sabbatical in Marseilles. I explained our results to Frédéric Benhamou and he was not happy about the description of the techniques: we were not formalizing them clearly enough. We worked together on resolving this issue and came up with the concept of box consistency. Once again, it was a declarative specification of the filtering and it helped subsequent algorithmic developments. I do not think we would have been capable of isolating these concepts initially: we had to experiment, try different algorithms, and find good trade-offs. Subsequently, it became important to formalize these concepts declaratively to foster progress.

The OPL Project:

The Numerica also opened another pandora box: modeling languages. Once I saw the beauty of a modeling language, I could not resist in designing a modeling language for constraint programming. The OPL system was thus a side-effect of Numerica and it played a fundamental role in exposing constraint programming to the operations research community and was the first language to integrate constraint and integer programming. As a modeling language, one of the most innovative aspects of OPL is a very high-level language for expressing search procedures, promoting a declarative style based on iterative, nondeterministic constructs: forall and tryall. I loved designing OPL as it captured the essence of constraint logic programming for mathematical modelers.

The Comet Project:

In the last 5 years, Laurent Michel and I have been working on the Comet system to fill a gap in the repertoire of tools for combinatorial optimization. Comet demonstrates the feasibility of the slogan
Local Search = Model + Search.
One of the most amazing features of Comet is to allow local search algorithms to be expressed as high-level declarative models, bringing the declarative ideal to a style of search which had always appeared inherently imperative. Back at ECRC and then at Brown, Mehmet an  Paris Kanellakis kept asking me whether local search would one day be supported by constraint logic programming. It tooks us a very long time to answer that question but, once again, the idea is simple in hindsight. Constraints, which capture substructures of an applications, incrementally maintain their violations and their differentiation. Now the same constraint-based model can be solved using constraint programming, mathematical programming, or local search.

The Future of CP and Its Relationship to LP

Since the mid 1990s, CP evolved into a field on its own with its conferences, journals, associations, and industrial products. For someone outside LP and CP, the two fields may not even appear connected.

In recent years, CP has been increasingly concerned with modeling: specifying high-level models of complex applications and deriving the consequences of these models using effective computational methods. CP, in a broad sense, can be summarized by the slogan
Application = Model + Search
which is not so distant from Kowalki’s equation
Algorithm = Logic + Control
which inspired so many of us to come to logic programming. In fact, CP is now facing research issues that are reminiscent of logic programming twenty years ago, including the tradeoff between expressiveness and efficiency, the gap between models and computational methods, the separation of concerns between models, search, and communication. CP models now aim at capturing such aspects as uncertainty, preferences, and concurrency. There is also a clear trend toward more automation, letting the system derive the search automatically from an analysis of the model and the instance data. Over the last 10 years, I have been stunned at how often I go back to logic programming when facing some of these issues and how the declarative ideal is increasingly pervasive.