Thank you for your help! > > Unfortunately, copy_term does not copy constraints, > > Let's say "fortunately" it doesn't copy constraints :-) > Don't forget that constraint networks are usually totally connected, > so you would end up copying your whole constraint store every time. If they are all connected, then this is what I need. But I suspect a misunderstanding here. Maybe, I misinterpret the word "connected". Let me give an example what I mean with "magic_copy". Hereby C(X,Y) stands for a constraint between Variables X and Y: Let us assume we have a constraint set with three constraints C1(X,Z), C2(Y,Z), C3(X,R) Now we want to "magically" copy variables Y and Z, ie get new variables Y2 and Z2. This would result in the constraint set C1(X,Z), C2(Y,Z), C3(X,R), C1(X,Z2), C2(Y2,Z2). In some sense, the original constraint set is connected - there is no partitioning into several constraint sets with disjoint variable set. Nevertheless, "magic_copy" duplicates only those constraints that share a variable with the target variable set [Y, Z]. Note, that the other variables stay the same. > > Ideally, of course, you would like to create some kind of projection > of the constraints onto the variables that you copy. However, > projection algorithms are only known for certain special forms > of constraint sets, so this is not something the system can do > automatically. Can you hint me some literature? > I do not recommend using this seriously (for the reasons given above), > but for a quick experiment you can try: > > magic_copy(Orig, Copy) :- > shelf_create(s(Orig),S), > shelf_get(S, 1, Copy), > shelf_abolish(S). Hey, that seems to do exactly what I need. Somehow, I didn't understand from the manual pages of shelf_* that it copies constraints, too. I thought it copies similar to copy_term. > If you can collect the constraints in that way, this is probably the > best solution. You might not need to list all individual constraints, > you just need one goal that sets them all up: > > ?- setup_cstr(Vars), > copy_term(Vars-setup_cstr(Vars), VarsCopy-GoalCopy), > call(GoalCopy), > ... Ah, that is a sneak way of unifying some but not all variables of a term. Prolog can be so beautiful ... Uli -- Ulrich Scholz scholz@informatik.tu-darmstadt.de http://www.intellektik.informatik.tu-darmstadt.de/~scholzReceived on Mon Apr 28 11:23:27 2003
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:23 PM GMT GMT