Do you mind to expand your expansion! Specifically two points…
I’m a bit confused, as I thought that a lot of writing Prolog was setting your constraints. Maybe I’m misunderstanding the word, but if I see code like…
pred(L) :- length(L, 3).
…then I read that as a constraint on the list L
to be of length 3. However, that’s nothing to do with CLP, that’s plain Prolog.
Please can you explain what you meant by “When using CLP, one first defines the constraints on a final solution”
Also, you said “a labelling predicate will divide the original problem into sub-problems.” From what I saw in that video, labelling ruled out potential solutions that didn’t fit the constraints. For example, in his first attempt to solve n-queens, he generated all possible solutions, then checked which ones worked. Obviously that meant checking a whole load of solutions that never had a chance of working.
If you watch the animation he shows (starts at 17:40), you see a load of queens in the first row, and it’s bashing away moving queens in the last columns, which is a waste of time as the presence of a queen in the first row of the second column means that the solution won’t work.
When he gets to labelling (from about 24:40), as soon as he places the first queen, it works out that there’s no point in placing the second queen in the first or second rows, and so skips a large number of potential solutions that won’t work.
If that’s a correct understanding (and please correct me if it isn’t), then I don’t see how this fits with the idea of splitting the problem into subproblems.
Thanks again for the reply. Hope you don’t mind my incessant questions, but I’d really like to understand this.