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

solution(+Handle)

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

Description

This predicate should be calledn when a solution of the constraint problem has been found. It create a solution node in the tree log, and logs the current state of the constraint model for visualization.

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

root / 1, try / 4, failure / 4, tree_indomain / 3