[ library(visualize_tree) | Reference Manual | Alphabetic Index ]

name_variables(+Handle, +L, ++Names, ++Group, -Terms)

Create a list of terms for a search routine, naming the variables with strings
Handle
an opaque data structure for the visualization
L
a list of domain variables to be assigned
Names
a list of strings, the names of the variables
Group
id of the group these variables belong to
Terms
a variable, will be unified with a list of terms

Description

This predicate creates a list of terms for a search routine creating a visualization.

Examples

sendmory(L):-
    L=[S,E,N,D,M,O,R,Y],
    L :: 0..9,
    create_visualization([],Handle),
    add_visualizer(Handle,
                   vector(L),
                   [group:1]),
    alldifferent(L),
    S #\= 0,
    M #\= 0,
    1000*S+100*E+10*N+D + 
    1000*M+100*O+10*R+E #= 
    10000*M + 1000*O+100*N+10*E+Y,

    name_variables(Handle,L,['S','E','N','D','M','O','R','Y'],1,Terms),
    root(Handle),
    search(Terms,1,input_order,tree_indomain(Handle,_),
           complete,[]),
    solution(Handle),
    close_visualization(Handle).

See Also

number_variables / 4, name_variables / 5