[gecode-users] Gist in bab or restart search, abnormal exit in red nodes

Guido Tack tack at gecode.org
Tue Jul 6 07:56:13 CEST 2010


Claudio Cesar de Sá wrote:

> Hi
> 
> Thanks, really  it was the problem ... I fix it with a try ... catch, once
> that I want a formatted output ... so the code is such like:
> 
> ...................................................
> try
>     {
>  
>   for (int i = 0; i < mat_size; i++) {
>     os << "\n" << i << "|"  ;
>     for (int j = 0; j < mat_size; j++) {
>       os.width(1);
>       //os <<  matrix(i,j) << "  ";
>       if ( matrix(i,j).val() == 1 )
>     os <<  j << " ";
>       else
>     os << "_"  << " ";
>     }
>   }

> So, now in blue and red nodes .... the gist's message is:
>  
> BoolVar::val: Attempt to access value of unassigned variable      PRINT OUTPUT: NON DEFINITION for MATRIX YET
> 
> 
> Is there any alternative or better for this solution? Is there any function to check if all the values of a variable are already instancied/assigned? In this case,   the variable is a matrix.

You have to iterate over the whole matrix to determine if it is assigned. Or you change your output, like this (assuming the matrix is over BoolVars):

if (matrix(i,j).one()) os << j << " "; else if (matrix(i,j).zero()) os << "_ "; else os << "? ";

Cheers,
	Guido

-- 
Guido Tack, http://people.cs.kuleuven.be/~guido.tack/



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20100706/a4e22d79/attachment.htm>


More information about the users mailing list