Why the Web needs Constraint-Based Programming

Position Paper
Thom Fruehwirth
LMU (Ludwig-Maximilians-University) Munich, Germany
http://www.pst.informatik.uni-muenchen.de/personen/fruehwir/

We did a case study in intelligent internet applications using constraint logic programming and found out that constraint reasoning is essential in this context.

1. The Munich Rent Advisor

The Munich Rent Advisor (MRA) is a decision support system that allows to calculate the typical rent of a flat in Munich based on the users input to a form that is available on the WWW. The application is based on statistical data compiled by the City of Munich, its results can be used in court. More than 7000 citizens haved used our experimental service in 1996. This intelligent internet application won the prize for best application at JFPLC, Clermont Ferrand, France, June 1996, was shown at SYSTEMS 96 Computer Show in Munich, Germany, October 1996, and featured in several newspaper articles. The MRA is available at http://www.pst.informatik.uni-muenchen.de/personen/fruehwir/miet-demo.html

The calculations are based on size, age and location of the flat and a series of detailed questions about the flat and the house it is in. Some of these questions are hard to answer. However, in order to be able to calculate the rent estimate by hand, all questions must be answered. Usually, the calculation is performed by hand in about half on hour by an expert from the City of Munich or from one of the renter's associations.

The MRA brought the advising time down to the few minutes that the user needs to fill in the form. The user of the MRA need not answer all questions, he need not to reveal all he knows. He may even submit a blank form. The MRA will give an estimate of the rent, that is a price range as tight as possible. The key to computing with such partial information is to use constraint technology.

The MRA is derived from a statistical model compiled from sample data using statistical methods such as regression analysis. Due to the underlying statistical approach, there is the problem of inherent imprecision which is usually ignored when calculating the rent estimate by hand. Using constraints the MRA can also account for this statistical imprecision.

To process the answers from the questionnaire and return its result, we wrote a simple stable special-purpose web-server directly in a constraint logic programming language using its C-sockets for internet communication. This is opposed to the standard approach where for each user request a script is executed (usually written in Perl) via the CGI interface. The advantage is a direct connection of the program to the internet without unecessary overhead. The MRA server only deals with the input posted from the form, all other functionality (e.g. hyperlinks) is provided by a standard server.

The complete MRA was implemented within two man-months: For a novice to HTML and to constraint programming, it took about 4 man weeks to write the WWW user interface, only 2 weeks to write the calculation part and 1 week to debug it. We think that the coding would have taken several time slonger and dominated the implementation effort if a conventional programming language had been used.

2. Why the Web needs Constraint Reasoning

We conclude from our case study that constraint-based programming will be essential for intelligent internet applications. The reason is that since constraints can express and deal with partial information, they address some of the essential issues of intelligent applications on the WWW: Moreover, constraint logic programming languages have rules needed to encode expert knowledge and powerful database facilities already built-in. Relying on such high level programming languaged also means that the program can be quickly developed and easily maintained. (However, the MRA application identified the need for lightweight constraint logic programming implementations that can run as agents or Java-like applets over the internet.)

Another advantage - and the topic of our latest work - is that constraint-based internet applications can be modified and adapted within minutes: Any part of the form comprising the application may be reused in another web-page simply by cut-and-paste - you may drop questions, you may set default values, you may fiy the answer to questions of the form and hide them from the user in order to specialize the application. The resulting web page will still work, since the missing information is dealt with by constraints. In other words, the underlying software can be reused and adapted in minutes! (A cut-and-paste version of the MRA is available on request).


Dr. Thom Fruehwirth does research in constraint-based programming. He is a research assistant at Computer Science Department of the Ludwig-Maximilians-University (LMU). He had worked at the European Computer-Industry Research Centre (ECRC), Munich, for five years and before, since 1986, at research institutions in the USA, Israel and Austria.