On Mon, 29 Sep 2014 10:29:33 +0100 Bouchene Sabrina <genius_linda1...@yahoo.fr> wrote:
> Symmetries s; > > BoolVarArgs a; > for (int i = 0 ; i < (opt.cols/2-1); i++) { > a << p.col(i); > } > for (int i = (opt.col-1) ; i >= opt.col/2 ; i--) { > a << p.col(i); > } > s << VariableSequenceSymmetry(a, opt.cols*opt.rows); > if > this part of code is correct so his effect is aquivalent to this > function of Gecode: columns_reflect(): to specify that a matrix's > columns can be reflected. Yes, this should have the same effect as columns_reflect, but there are a couple of problems with your code above. The second argument to VariableSequenceSymmetry should be the length of each sequence, not the total length (in your example above, it should be (opt.cols/2)*opt.rows). Also, the bounds on your loops look wrong; I think they should be: for (int i = 0 ; i < (opt.cols/2); i++) and for (int i = (opt.cols-1) ; i >= (opt.cols+1)/2 ; i--) As for the second question, you can post a combination of symmetries by adding another symmetry definition to the Symmetries object, e.g. in the bibd example: Symmetries s; s << rows_interchange(p); s << columns_interchange(p); The effect is that each symmetry is applied until a fixed point is reached. For example, if value "v" is deleted from the domain of the variable p(1,1) by search, then according to the rows-interchange symmetry "v" will be removed from p(1,2), p(1,3), p(1,4), etc. Then because "v" has been deleted from p(1,2), according to the column symmetry "v" will be deleted from p(2,2), p(3,2), p(4,2), etc. This continues until there are no more values to delete due to symmetry. This effect is an approximation of taking the product of the two symmetry groups. It's not possible to have each symmetry definition act independently of the others, if that's what you mean by "Sym a + Sym b". _______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users