C.2 CPviz interface

JaCoP can generate trace in a format accepted by CPviz, an open-source visualization toolkit for finite domain constraint programming (http://sourceforge.net/projects/cpviz/). This functionality is provided by class JaCoP.search.TraceGenerator.java and it is added to search. The simplest method to do it is to simply add the following line in your program.

  TraceGenerator<IntVar> select = 
      new TraceGenerator<IntVar>(search, varSelect, vars);

where search is the search method for your problem, varSelect is the variable and value selection method of your search and vars is an array of variables to be traced.

The program that extends search with TraceGenerator will generate two files (by default named tree.xml and vis.xml) that register all search decisions and variables and their domains or values. CPviz program can use these files and generate visualization for the search.

The next steps requires installation of CPviz software.

The generation of visual information is done by issuing the following commands.

  mkdir viz.out 
  java -cp <path to CPviz>/viz/bin/ ie.ucc.cccc.viz.Viz config.xml \ 
                tree.xml vis.xml

File config.xml defines the configuration. An example file is presented below.

xml version="1.0" encoding="UTF-8"?> 
 
<configuration version="1.0" directory="viz.out"> 
    <tool show="tree" fileroot="tree" repeat="all"/> 
    <tool show="viz" fileroot="viz"/> 
configuration>

For more details refer to CPviz documentation.

In the case of this configuration, the files will be generated in directory viz.out. Please, note that this directory must exist for CPviz to work correctly.

The visualization is provided by issuing the following command.

java -cp batik.jar:jhall.jar:<path to cpviz>/viztool/src \ 
           components.InternalFrame

where batik.jar and jhall.jar are separate software packages that must be installed separately.

Once the visualization tool is started one has to open file viz.out/aaa.idx.

An example of a screen dump for sudoku puzzle model is depicted in Figure C.1.


PIC

Figure C.1: An example screen dump for search visualization.