[ Reference Manual | Alphabetic Index ]

# library(cpviz)

Wrapper library, subsuming all of CP-Viz [more]

## Predicates

> exec_viz(?)
>   No description available
> viz(+Handle, ?ToolSpecs)
>   Run the CP-Viz viz program to convert xml traces to graphics
> viztool
>   Launch the CP-Viz viztool for viewing trace log visualisations. In TkECLiPSe, this can be done from the Tools menu.

## Structures

> struct tool(show, type, display, repeat, width, height, fileroot)
>   No description available

## Reexports

> reexport visualize_tree

## Description

This library loads and reexports library(visualization) and library(visualize_tree), making all features of CP-Viz available. In addition, it provides convenience predicates viz/2 and viztool/0 for executing CP-Viz's Java-based tools from within ECLiPSe.

Usage examples can be found under doc/examples/cpviz/ in your ECLiPSe installation. The document 'CP Visualizer Format' is in the doc/ directory. Further background documents on CP-Viz are http://4c.ucc.ie/~hsimonis/cpviz-cp2010-paper.pdf, http://4c.ucc.ie/~hsimonis/cpviz-cp2010-slides.pdf and the project web site is http://sourceforge.net/projects/cpviz .

The following is a code example. After running sudoku(M), launch viztool and open the file aaa.idx in the OUTPUT subdirectory.

    :-lib(ic).
    :-import alldifferent/1 from ic_global_gac.
    :-lib(cpviz).

    sudoku(Matrix):-
            problem(Matrix),
            Matrix :: 1..9,
            create_visualization([],Handle),
            add_visualizer(Handle, domain_matrix(Matrix), [display:expanded]),
            draw_visualization(Handle),
            ( for(I,1,9), param(Matrix,Handle) do
                alldifferent(Matrix[I,1..9]),
                draw_visualization(Handle,[focus(1,row(I))]),
                alldifferent(Matrix[1..9,I]),
                draw_visualization(Handle,[focus(1,col(I))])
            ),
            ( multifor([I,J],[1,1],[7,7],[3,3]), param(Matrix,Handle) do
                alldifferent(flatten(Matrix[I..I+2,J..J+2])),
                draw_visualization(Handle,[focus(1,block(I,J,3,3))])
            ),
            extract_array(Handle,row,Matrix,NamedList),
            root(Handle),
            search(NamedList,1,input_order,tree_indomain(Handle,Handle), complete,[]),
            solution(Handle),
            close_visualization(Handle),
            viz(Handle, _).

    problem([]([](4, _, 8, _, _, _, _, _, _),
               [](_, _, _, 1, 7, _, _, _, _),
               [](_, _, _, _, 8, _, _, 3, 2),
               [](_, _, 6, _, _, 8, 2, 5, _),
               [](_, 9, _, _, _, _, _, 8, _),
               [](_, 3, 7, 6, _, _, 9, _, _),
               [](2, 7, _, _, 5, _, _, _, _),
               [](_, _, _, _, 1, 4, _, _, _),
               [](_, _, _, _, _, _, 6, _, 4))).

## About

- Status: experimental
- Author: Joachim Schimpf
- Copyright © 2013, Joachim Schimpf

Generated from cpviz.eci on 2020-02-26 22:26