Constraint Logic Programming

2006--2007



Photographer wanted!
courtesy Mathias Klockenbring (2003-2004)

2005--2006 | 2003--2004 | 2002--2003 | spring 2002 | spring 2001 | fall 2000 | fall 1999

(PG211)

created 23 January 2007 from last year, last edition 3 July 2007
Paul Y Gloess


Week by week

Back to Top

Week 1 : Wednesday 24 January 2007

TD 1:  Getting started with CHIP using ~gloess/public_html/sudoku/CHIP/sudoku.pl and ~gloess/chip/nat.pl examples;

Lecture 1: Introduction to the module. Presentation of web information (Library, Prolog and Constraint Industry). [Printed version of Slides and Exercise list is available from Ms Marie-Josèphe de Gasquet, computer science secretary: these are old versions, but very close to Library documents.]

Evaluation: 2 hour final test (30%) + mini-project (70%) OR 2 hour final test (70%) + mini-project (30%). Mini-project soon available.

Motivation: Sudoku problem.

Beginning of: LP, introduction, functional versus relational programming, first order logic syntax and semantics, validity of formulas,

Back to Week by Week or Top

Week 2 : Wednesday 31 January 2007

TD 2: Pure Prolog: exercises VI from sheet (pdf | doc), see also ~gloess/chip/clp/exercices/family.pl; This exercise is about Datalog (a subset or pure Prolog using only predicates and constants (functions of arity 0). Another (new) exercise is a pure Prolog construction of a part of natural number arithmetics: see  ~gloess/chip/clp/exercices/arith.pl.

Some important advice:
Lecture 2: End of: LP, introduction to Prolog, Horn clauses, Prolog problem logical semantics, pure Prolog program syntax and semantics (logical, proof tree, least model, fixed point semantics),
Back to Week by Week or Top

Week 3 : Wednesday 7 February 2007

Presentation by Dr. Idir Gouachi, from Cosytec:

Back to Week by Week or Top

Week 4 : Wednesday 14 February 2007

TD 4: Rapidly finish arith.pl pure Prolog exercise, then look at solution; CLP(FD) exercises:

Lecture 4: Very brief overview of CHIP constraints (or builtin predicates needed for the N-queen puzzle):

TP 4 (on project): Brief discussion on project: teams: 3*3 + 4*2  ^= 13 students.

Back to Week by Week or Top

Week 5 : Wednesday 28 February 2007

TD 5: From a specific problem to a class of problems:
TP 5: Very brief discussion on project. Back to Week by Week or Top


Week 6 : Wednesday 7 March 2007

Lecture 6: Operational semantics of LP:

TD 6Mystery exercise:

TP 6 : Brief discussion on Planner project:
Back to Week by Week or Top

Week 7 : Wednesday 14 March 2006

TP 7Work on Planner project.
Lecture 7: No lecture! You may want to look at Questions and Answers from year 2003-2004, Week 7.

Back to Week by Week or Top



Week 8 : Wednesday 21 March 2007

Lecture 8: Rapid presentation of Teaching CHIP at ENSEIRB talk given last year at CUC 2006.
TP 8Work on Course Planner project. A group of students has come up with a solution to the specific problem example: all week days are used, including Friday. Anotrher group has a solution on Monday -- Thursday, but they don't seem to take breaks into account. Here are some common questions:

Back to Week by Week or Top


Week 9 : Wednesday 28 March 2007

TD 9: Classical Pure Prolog exercises on lists. List manipulation is essential for constraint generation. CHIP provides a notation for lists (like all Prolog dialects based on Edimburgh syntax). However, lists can be implemented in pure Prolog, without any additional notations: one needs two constructors (function symbols), equivalent to LISP cons (of arity 2) and nil (of arity 0). Here, we shall respectively denote "c" and "n" these constructors:

LISP Pure Prolog Edimburgh (CHIP)
nil
()
n []
(cons E L) c(E, L) [E | L]
(U V W)
(cons U (cons V (cons W nil)))
c(U, c(V, c(W, n))) [U, V, W]
[U | [V | [W | []]]]

Define the following predicates, using pure Prolog notation:

Literal Informal semantics Hint
app(L, M, LM) means that LM is the concatenation of lists L and M Recursive idea: consider two cases for L:
  • L =  n,
  • L =  c(E, L')
rev(L, LR) means that LR is the mirror of list L Usez "app".
revapp(L, M, LRM) means that LRM is the contenation of L mirror and list M Do not use "app" and "rev";
Use "revapp" only!
mem(E, L) means that E is a member of list L Recursive idea: there are two cases, but note that empty list n has no member.
mem2(E, L) means the same as memb(E, L) Non recursive: use "app" and one clause only!

See the following files for actual solutions:
Lecture 9: CLP(X) and CLP(X) operational semantics, where X stands for a constraint language (e.g., finite domains, rational linear arithmetics, finite trees, infinite trees). The operational semantics are based on CLP search trees, which generalize Prolog search trees by replacing unification with constraint solving (assuming there is a decision procedure for deciding the satisfiability of the X-constraints). Note that pure Prolog is seen as CLP(finite trees).
See CLP slides (htm | pdf) 1--7 and 9.

TP 9Work on Planner project. Most teams now work on the generic timetable solver. Note that another set of data (inspired from I1 and I2 timetables for 5--9 February 2007 week): enseirb_info_data2.pl.
You might aso find the following program useful:

Back to Week by Week or Top


Week 10 : Wednesday 4 April 2007

TD 10: Believe in Pure Prolog power: example of compiler design, see ~gloess/chip/solutions/compiler.pl: read and test and explain the semantics of "expression" and other (undocumented) predicates. Search trees again: test ~gloess/chip/exercises/revapp.pl: draw a search tree (see comments).

TP 10
Work on Timetable Planner project. Questions:

Recall some useful CHIP programs or examples.

Back to Week by Week or Top


Library

We are still in the early times of computer science, where computer scientists struggle with incompatible environments and chaotic computer programs, and make the whole thing even worse by inventing as many "portable" formats as environments. None of these formats deserves this qualifier: they all tend toward an approximation of a truth which yet has to be revealed!
 
Document
Original
Html
PDF
(Acrobat)
Color Postscript 
Black&White Postscript
Logic Programming
lp.ppt (new)
(animation)
lp.htm (new, OK with Internet Explorer only)
lp.htm (old, OK with any browser)

(inanimated)
 lp.pdf (new)
lp.ps (old) *
lp.bw.ps (old) *
Constraint Logic Programming
clp.ppt
(animation)
clp.htm
(inanimated)
 clp.pdf
clp.ps *
clp.bw.ps *
Correctness of Resolution
Resolution.doc
(Word)
 
Resolution.pdf
Resolution_Adobe.pdf
 
Resolution.ps
Resolution_Adobe.ps
CLP final test
23 May 2006
see CLP final test 23 May 2006
TD exercises
handout
exercises.doc
(Word)
 
 exercises.pdf
 
exercises.ps
TD exercises
and programs
td_exercises
 
 
 
 
CHIP exercise
directory
~gloess/chip/clp/exercises/
 
 
 
 
Solution of exercise I
solution_I.doc
(Word)
 
solution_I.pdf
 
solution_I.ps
Solution to mystery
Mystery/
(JPG pictures)
 
 
 
 
Solution to revapp
revapp/
(JPG pictures)
 
 
 
 
CHIP solution
directory
~gloess/chip/clp/solutions/
 
 
 
 
Getting started
with CHIP
Getting started with CHIP
 
 
 
 
Chip Documentation
by Cosytec
 
local CHIP on-line documentation
 
 
 

Use ghostview with Landscape orientation and letter format.

Acrobat Reader: for easy access through your navigator, edit your preferences and associate "acroread %s" handler with "Portable Document Format" application.

Back to Top


Project

This year (2006-2007) we shall work on a timetable generator for ENSEIRB. For a project description, please check project.

Last year: Why not a Sudoku project this year?

Student teams and work.

Deliverable see additional ".htaccess" request 16 May 2006!

Public defence

A project defence will be held in room I115, on Wednesday 17 May 2006, starting at 8:30am:

Back to Top


Prolog and Constraint Industry

Back to Top

© Copyright 1999-3000 Paul Y Gloess