copy variables including their constraints

From: Ulrich Scholz <scholz_at_inferenzsysteme.informatik.tu-darmstadt.de>
Date: Thu 03 Apr 2003 12:30:21 PM GMT
Message-ID: <20030403123021.GA6046@kiwi.intellektik.informatik.tu-darmstadt.de>
 Dear all,

I'm using ECLiPSe (5.5) constraints and would like to be able to copy
constrained variables including their constraints, eg

:- X ~= Y, magic_copy([X, Y], [A, B]), A = B.

should fail.  Hereby, ~= is imported from notinstance.


Unfortunately, copy_term does not copy constraints, therefore

:- X ~= Y, copy_term([X, Y], [A, B]), A = B.

succeeds.  I guess, there is no such "magic_copy" in the ECLiPSe constraint
solver.  Or is it?  It could well be that I missed it.  Then I would
appreciate a hint.


My first try to implement magic_copy is to keep all constraints in an explicit
way.  Then they are copied along with the variables and called afterwards.
For example

:-  X ~= Y, C =.. [~=,X,Y], copy_term([X,Y,C], [A,B,C2]), call(C2), A = B.

fails as desired.  Is there a better way?  

If not, I wonder if is it beneficial to filter out those constraints that use
none of the copied variables or not.  Is there a large overhead of calling
constraints that are already called?  For example, would it help a lot to
filter out Z1~=Z2 before copying the variables in the following example?

:- X~=Y, C1=..[~=,X,Y],Z1~=Z2,C2=..[~=,Z1,Z2],Cs=(C1,C2),
   copy_term([X,Y,Cs],[A,B,Cs2]),call(Cs2),A=B.  


Thank you very much

Uli

-- 
Ulrich Scholz

scholz@informatik.tu-darmstadt.de
http://www.intellektik.informatik.tu-darmstadt.de/~scholz
Received on Thu Apr 03 16:05:25 2003

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:22 PM GMT GMT