2

It looks like Microsoft completely pooched their "rise4fun" website and the Z3 Python tutorial no longer loads.

How can I define define a matrix in Z3 for Python and impose some constraints on it?

mpen
  • 272,448
  • 266
  • 850
  • 1,236
  • what is this site used for (raise4fun) I don't understand anything from it ? – mojibuntu Jan 11 '14 at 13:54
  • 3
    FYI, the tutorials are available at a link from this answer: http://stackoverflow.com/questions/20002135/where-can-i-get-z3py-tutorials/20005713#20005713 and you may want to look at this discussion http://stackoverflow.com/questions/15599030/z3-performing-matrix-operations – Taylor T. Johnson Jan 11 '14 at 14:46
  • thanks, sounds good. I must reasearch about it. – mojibuntu Jan 11 '14 at 16:03

1 Answers1

2

One example: 9x9 matrix of integer variables

X = [ [ Int("x_%s_%s" % (i+1, j+1)) for j in range(9) ] 
  for i in range(9) ]

Example: some constraints for the matrix X

cells_c  = [ And(1 <= X[i][j], X[i][j] <= 9) 
         for i in range(9) for j in range(9) ]
Juan Ospina
  • 1,317
  • 1
  • 7
  • 15