[ library(visualize_tree) | Reference Manual | Alphabetic Index ]
number_variables(+Handle, +L, +Group, -Terms)
Create a list of terms for a search routine, numbering the variables
- Handle
- a handle to an opaque data structure for the viualization
- L
- a list of variables to be assigned
- Group
- an integer, the group identifier
- Terms
- a variable, will be unified to a list of terms
Description
This predicate is used to number the variables before the search, so that the visualizer knows at each step which variable is currently assigned.
Examples
top(N,L):-
length(L,N),
L :: 1..N,
alldifferent(L),
create_visualization([],Handle),
add_visualizer(Handle,vector(L),[group:1]),
number_variables(Handle,1,L,Terms),
root(Handle),
search(Terms,1,first_fail,
tree_indomain(Handle,_),complete,[]),
solution(Handle),
close_visualization(Handle).
See Also
number_variables / 3, name_variables / 4