Hi Claudio,

the first two constraints easily map to Boolean disjunctions (the OR of all 
elements in a col/row must be true).  If you use the Matrix class from 
minimodel, and your matrix is m, then the constraints would simply be

for (int i=0; i<m.height(); i++)
  rel(*this, BOT_OR, m.row(i), 1);
for (int i=0; i<m.width(); i++)
  rel(*this, BOT_OR, m.col(i), 1);

I'm not sure I understand the extensional constraint.  The indexes (i,j) are no 
constrained variables here but simply constant indexes.  And the extensional 
constraint cannot be put under an "if".
If the graph is fixed, i.e., if you know statically whether (i,j) satisfies 
some condition, you can simply set all m(i,j)=0 where the condition does not 
hold.

Cheers,
        Guido

Claudio Cesar de Sá wrote:

> Hi,
> 
> My program consist in filling up of a matrix  (nxn) with 0 and 1 with under 3 
> rules;
> 
> 1. In each col presents at least one (1) ... 
> 2. In each row presents at least one (1) ... 
> 3. Where these 1´s appears,  the indexes (i,j) must be checked in the graph.
> 
> The rule number 3 I think to use an extensional constraint such:
> 
> for ....
>      if pair (i,j) != 0
>         extensional(*this, pair(i,j), TUPLE_SET_2_OF_A_GRAPH)
>       
> 
> Any guess (tip) to solve 1 and 2 ??
> 
> 
> Thanks
> 
> 
> 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

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



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

Reply via email to