<< Prev | - Up - | Next >> |
var2node
methodWhenever, in a literal, we encounter an atom naming a variable, we invoke method var2node
to make sure that this variable is already encoded and to retrieve the corresponding node representation. If this is the first time we encounter this variable , we allocate for it a new integer and create a node representation for it. Further, we also create for all variables that were known sofar (i.e. all variables encoded by integers smaller than the one encoding ).
meth var2node(X Node)
I = {Dictionary.condGet @var2int X unit}
in
if I==unit then
I=(counter<-I)+1
in
{FS.include I @vars}
Node={MakeNode I @vars}
@var2int.X := I
@int2node.I := Node
for J in 1..(I-1) do
@choices.(I*1000+J) := {FD.int 1#4}
end
else Node=@int2node.I end
end
<< Prev | - Up - | Next >> |