Re: ...That label/1 predicate's real efficiency?



On Sat, 27 Aug 2005 21:16:59 -0400, "Dirk Mittler"
<mdirk@xxxxxxxxxxxx> wrote:

>One afterthought which I have about this labelling predicate: Your reply
>makes it sound as though the computer would really need to try out all the
>possible combinations of values for the variables, until it finds a
>combination which satisfies the constraints. Yet, you avoid actually writing
>that. I seem to have observed so far, that in typical cases when one puts
>constraints onto a set of variables, these constraints can derive some of
>the variables from only a very few which have been set "by trial and error"
>. I've written one simple case where an entire series of solutions follows
>from only one fact, plus from constraints. With no label/1 command at all.
>So what seems like a "dumb procedure" could actually be more efficient
>already, than it sounds. It might be necessary only to run 1 or 2 out of 7
>variables through their finite domains, before the other ones all follow
>from unifications which stem from these attributes. The label/1 predicate,
>which takes a list of variables, might succeed as soon as none of them are
>left unbound, but succeed through the propagation of the constraints which
>have already been applied.
>
>Am I correct?

Sort of. When you post constraints it is possible to do consistency
check and eliminate some values from some domains. If you get
solution, you are happy. If you don't, you "label". When you fix
some values from domains of some variables, you do "constraint
propagation", i.e. next consistency check that eliminates some
values from some domains. Therefore, the whole procedure is not such
"dumb", althouth on the level of "labeling" function, in most cases
this is not much more than choosing values and backtracking in the
case of failure.

>Dirk
>
>P.S. I'm generally reluctant to switch from one software platform to the
>other, because I trust software which already installed correctly, and which
>didn't make any mess in doing so. SWI Prolog seems good enough for me.
>

Although SWI is superb Prolog, it is a bit weak when you need
constraint solver. If you want to experiment with ready to use high
performance constraint system, take Eclipse or B-Prolog (SICStus is
not free). If you want to implement your own constraint system, SWI
is OK. In any case, get Eclipse tutorial. It is pretty generic.

A.L.
.