Search code examples
prologsicstus-prologconstraint-programmingclpfd

How do I reinstate constraints collected with copy_term/3 in SICStus Prolog?


The documentation says that

copy_term(+Term, -Copy, -Body) makes a copy of Term in which all variables have been replaced by new variables that occur nowhere outside the newly created term. If Term contains attributed variables, Body is unified with a term such that executing Body will reinstate equivalent attributes on the variables in Copy.

I'm previously affirming numerical CLP(R) constraints over some variables, and at some point I collect these constraints using copy_term/3. Later, when I try to reinstate the constraints using 'call(Body)', I get an "Instantiation error" in arguments of the form [nfr:resubmit_eq(...)]

Here's a simplified example that demonstrates the problem:

:-use_module(library(clpr)).
{Old>=0, A>=0,A=<10, NR= Old+Z, Z=Old*(A/D)}, copy_term(Old,New,CTR), call(CTR).

Results in:

Instantiation error in argument 1 of '.'/2
! goal:  [nfr:resubmit_eq([v(-1.0,[_90^ -1,_95^1,_100^1]),v(1.0,[_113^1])])]

My question is: how do I reinstate the constraints in Body over New? I haven't been able to find concrete examples.


Solution

  • This is simply a bug in CLPR, which is unsupported. We lost touch with the CLPR supplier a long time ago.