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/



_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to