Re: [eclipse-users] node(daVinci) and uDraw(Graph)

From: Tias Guns <tias.guns_at_...88...>
Date: Thu, 06 Dec 2007 17:08:49 +0100
On Wed, 05 Dec 2007 20:12:39 +0100, Kish Shen <kish_at_...2...> wrote:

> Hi Tias,
> I think the problem with the lib(daVinci) only drawing the graph once is  
> a known problem. The current API for daVinci seems to be:
> daVinci_begin
> ...various commands to add nodes/edges to the graph
> daVinci_end
> the various commands to add nodes/edges generates command for the  
> daVinci API directly, and are written to a stream. daVinci_end closes  
> some of these streams (including daVinciAttribute) and sends the daVinci  
> commands to daVinci to plot the graph. The `illegal stream  
> specification' error you get is because the stream was closed by the  
> daVinci_end after the first solution is plotted.
> If what you want to do is simply to add more nodes and edges to the  
> graph (rather than deleting nodes that you have backtracked over) on  
> subsequent plots of the graph, it may be relatively easy to do --  
> looking at the uDraw documentation, it looks like you can add (and  
> delete) nodes/edges from the graph. So either daVince_end can be  
> modified to 1) not close the streams, and 2) send commands to add the  
> new nodes/edges, or a new command can be added to lib(daVinci) to just  
> plot a graph or modify the existing plot.

The problem was indeed that daVinci_end is called, and that it closes the  
Edge and Attribute stream (the Out stream remained open).
I've solved this by adding a flag variable `daVinciMore`, which is set to  
1 in daVinci_end. Now, when the next solutions is found and eclipse wants  
to update the graph, it first checks that flag, and if that flag is set,  
it reopens the Edge and Attribute streams.
This works like a charm and now the visualisation plots the entire search  
tree when I do a findall for example !

You can find the patch attached as daVinci_more.diff
or at

> I seem to remember that a few years ago, daVinci went commercial, and so  
> we have not really spent too much effort on maintaining/improving  
> lib(daVinci). Looking at the link you provided, it seems as if it is now  
> freely available. We would really welcome any improvements in this  
> library!

I've added a few lines of code that can now natively run uDraw(graph).
With this patch, you just download uDraw(graph) and follow their  
installation instructions. After that, eclipse-clp will automatically find  
it and use it like it did with daVinci.

You can find the patch attached as daVinci_udraw.diff
or again at

This is a really powerfull visualisation tool, I like it a lot.
I'm not sure what the double borders and cursive values try to tell, they  
don't seem to add information ?
What would be really cool is if the graph would be updated incrementally  
(flush a new node and its edges immediately to uDraw when it is created).  
That way, it could be used together with the 'Visualisation Client'. You  
could watch the variables get assigned and propagated in the Visualisation  
Client, and at the same time you could see the search tree being traversed  
in uDraw !


> Cheers,
> Kish
> Tias Guns wrote:
>> Hello,
>> Apparently the daVinci graph drawing tool is renamed to uDraw(Graph)
>> Fortunately there is no API change, so ECLiPSe can perfectly well work   
>> with it.
>> The thing I did was:
>> 1) unpack uDrawGraph somewhere, for me: /home/tias/local/uDrawGraph-3.1
>> 2) add DAVINCIHOME="/home/tias/local/uDrawGraph-3.1"; export DAVINCIHOME
>> or something similar to your .bashrc
>> 3) go to your /home/tias/local/uDrawGraph-3.1 dir, and do: ln -s   
>> bin/uDrawGraph daVinci
>> On linux systems, this works perfectly well.
>> Unfortunately, the graph drawing only works for the first solution.  
>> This  problem always occurs, independant of using uDrawGraph or the old  
>> daVinci.
>> Reproducing the bug:
>> 1) download the queens example:   
>> 2) change 'labeling(Board).' with 'search(Board, 0, input_order,  
>> indomain,  complete, [node(daVinci)]).'
>> 3) run queens_lists(6,B).
>> This is what you will get:
>> <<<<<<<<<
>> [eclipse 1]: queens_lists(6,B).
>>  loaded traceable 0 bytes in 0.00 seconds
>> loaded traceable 0 bytes in 0.01 seconds
>> B = [2, 4, 6, 1, 3, 5]
>> Yes (0.01s cpu, solution 1, maybe more) ? ;
>> %%% draws the first part of the search tree here
>> illegal stream specification in printf(daVinciAttribute, ',', [])
>> Abort
>>   What I would have hoped to happen is that when generating the next  
>> answer,  the graph would get a new branch in the nodes at which the  
>> backtracking  happens.
>> The error happens on line 385 of daVinci.ecl:
>> da_comma(Stream):-
>>      printf(Stream,',',[]).
>> I have tried to fix this, but I do not find a way.
>> Is it possible to make this graph drawing work over multiple solutions  
>> ?  It is only usefull to me if this would work.
>> Many thanks in advance,
>> Tias
>> _______________________________________________
>> ECLiPSe-Users mailing list
>> ECLiPSe-Users_at_...2...

Received on Thu Dec 06 2007 - 16:10:26 CET

This archive was generated by hypermail 2.3.0 : Mon Aug 26 2019 - 09:14:36 CEST