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

root(+Handle)

Create the root node of a search tree
Handle
an opaque data structure for the visualization

Description

This predicate creates the root node of a search tree in a visualization, this should be called before any choices are made. It automatically calls draw_visualization/1 to collect the information about the state of variables and constraints.

Examples

top(N,L):-
    length(L,N),
    L :: 1..N,
    alldifferent(L),
    create_visualization([],Handle),
    add_visualizer(Handle,vector(L),[]),
    number_variables(Handle,L,Terms),
    root(Handle),
    search(Terms,1,first_fail,
           tree_indomain(Handle,_),complete,[]),
    solution(Handle),
    close_visualization(Handle).

See Also

solution / 1, try / 4, failure / 4, tree_indomain / 3, visualization : draw_visualization / 1