Re: [eclipse-clp-users] user defined constraints using propia

From: Thorsten Winterer <thorsten_winterer_at_...126...>
Date: Thu, 01 Apr 2010 11:21:58 +0200
Am 01.04.2010 10:39, schrieb Oliver Shycle:
> Hi all,
>
> After studying the Constraint Library Manual I thought that using
> propia enables me to turn every prolog goal into a constraint. Using
> such a constraint works in general. However it unfortunately doesn't
> work in combination with constraint expression connectives like "=>"
> or "neg".
> The use of "neg (my_constraint(X) infers most)" where X is a variable
> to be labeled later gives me the following error:
> instantiation fault in infers(my_constraint(_518{1 .. 6}), most,
> _5589{[0, 1]})
>
> Why do I get this error?
> And what is the third variable "_5589{[0, 1]" of the infers predicate
> that is shown in this error message?

neg(Constr) is equivalent to Constr $= 0, i.e., the reified constraint
Constr is negated.
You therefore need a reified version of Constr if you want to use neg/1,
i.e., a version of Constr that has one additional argument, which is the
variable that contains the truth value (0 or 1).

In your example, neg (my_constraint(X) infers most) translates to
neg(infers(my_constraint(X), most)).
neg/1 then looks for a reified version of infers/2,
infers(my_constraint(X), most, B), where B has the domain [0,1]. This
version does not exist, and thus the error that you get.

Reified versions exist for the constraints in the ic library. You have
to supply them yourself for your own constraints.

If you want or need to use propia, you probably  should write a
predicate my_neg_constraint(X) instead of using neg/1.

Cheers,
Thorsten
Received on Thu Apr 01 2010 - 09:22:17 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST