If I understood you correctly, this should do the trick:
BoolVarArray rtrue(*this, m.height(), 0,1);
or (int i=0; i < m.height() ; i++)
rel(*this, BOT_AND, m.row(i), rtrue[i] );
rel(*this, BOT_OR, rtrue);
Cheers,
Guido
Claudio Cesar de Sá wrote:
> Hi
>
> I am kicking my head on "a simple question" on matrix constraints:
>
> for (int i=0; i < m.height() ; i++)
> rel(*this, BOT_AND, m.row(i),1 );
>
> so the constraints posted seems such:
> m.row(0) = true AND m.row(1) = true AND m.row(3) = true .... AND m.row(n-1)
> = true
>
> So, obviously, as the result for the matrix m, in all lines MUST filled with
> one.... not desirable.
>
> What I am want: at least one (or more) line of this matrix m should contain
> only 1's in its line ...
> so should be post conditionally something like:
>
> m.row(0) = true OR m.row(1) = true OR m.row(3) = true .... OR m.row(n-1) =
> true
>
> the branch is over the m.
>
> I am thinking on an auxiliary array for each line ... and post it
> conditionally. I am not sure,
> or something like
>
> for (int i=0; i < m.height() ; i++)
> rel(*this, BOT_OR , function_post_conditional( m.row(i), ....) ,1
> );
>
> where the function_post_conditional( m.row(i), ....) ... will return only
> valids post for m.row(i) = true
>
> How to control what should be posted?
>
> Thanks in advance
>
>
> claudio
>
>
>
>
> --
> claudio
>
>
>
> (
> ))
> |""|-.
> |__|-'
>
>
> **********************************************************************
> Skype: claudio_cesar_sa
> Links:
> http://laic.u-clermont1.fr/
> http://www.colmeia.udesc.br/
> http://www2.joinville.udesc.br/~coca/
> http://www2.joinville.udesc.br/~esp7maratona/
> Blog: http://claudiocesar.wordpress.com/
> ***********************************************************************
> _______________________________________________
> Gecode users mailing list
> [email protected]
> https://www.gecode.org/mailman/listinfo/gecode-users
_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users