From: Mart Lubbers Date: Tue, 20 Oct 2015 18:21:47 +0000 (+0200) Subject: update report, added solution to 2 image X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=931351f869d0197c78ac85ba4ba7718525969dc3;p=master.git update report, added solution to 2 image --- diff --git a/ar/assignments/2.tex b/ar/assignments/2.tex index 7bd482d..f4789d8 100644 --- a/ar/assignments/2.tex +++ b/ar/assignments/2.tex @@ -38,10 +38,10 @@ specified width and height. \nonumber & \qquad\qquad\qquad \vee c_iy>c_jy+c_jh\\ \nonumber & \qquad\qquad\qquad \vee c_iy+c_jh15\\ - \nonumber & \vee c_jx+\frac{c_jw}{2}-c_ix+\frac{c_iw}{2}>15\\ - \nonumber & \vee c_iy+\frac{c_ih}{2}-c_jy+\frac{c_jh}{2}>15\\ - \nonumber & \vee c_jy+\frac{c_jh}{2}-c_iy+\frac{c_ih}{2}>15\Biggr)\wedge\\ + \nonumber & \vee c_ix+\frac{c_iw}{2}-c_jx+\frac{c_jw}{2}>17\\ + \nonumber & \vee c_jx+\frac{c_jw}{2}-c_ix+\frac{c_iw}{2}>17\\ + \nonumber & \vee c_iy+\frac{c_ih}{2}-c_jy+\frac{c_jh}{2}>17\\ + \nonumber & \vee c_jy+\frac{c_jh}{2}-c_iy+\frac{c_ih}{2}>17\Biggr)\wedge\\ \bigwedge_{i\in RC}\bigvee_{j\in PC}\neg\Biggl( & (c_ix-1>c_jx+c_jw\\ \nonumber & \vee c_ix+1+c_jw c{0:02d}x 0) (> c{0:02d}y 0)\n' - '\t(<= (+ c{0:02d}x c{0:02d}w) {1}) (<= (+ c{0:02d}y c{0:02d}h) {2})\n' - ).format(i, mx, my)) + '(> c{0:02d}x 0) (> c{0:02d}y 0)' + '(<= (+ c{0:02d}x c{0:02d}w) {1}) (<= (+ c{0:02d}y c{0:02d}h) {2})' + ).format(i, mx, my)) - # Print the non overlap with others + # Print the non overlap with others for j in range(1, 1+len(pc+rc)): if i != j: print(( - '\t(or \n' - '\t\t(> c{0:02d}x (+ c{1:02d}x c{1:02d}w)) ' - '(< (+ c{0:02d}x c{0:02d}w) c{1:02d}x)\n' - '\t\t(> c{0:02d}y (+ c{1:02d}y c{1:02d}h)) ' - '(< (+ c{0:02d}y c{0:02d}h) c{1:02d}y)' - ')').format(i, j)) + '(or ' + '(> c{0:02d}x (+ c{1:02d}x c{1:02d}w)) (< (+ c{0:02d}x c{0:02d}w) c{1:02d}x) ' + '(> c{0:02d}y (+ c{1:02d}y c{1:02d}h)) (< (+ c{0:02d}y c{0:02d}h) c{1:02d}y)' + ')').format(i, j)) -# Print the PC distance to eachother + # Print the PC distance to eachother for i, _ in enumerate(pc, 1): for j, _ in enumerate(pc, 1): if i != j: print(( - '\t(or \n' - '\t\t(> \n' - '\t\t\t(- \n' - '\t\t\t\t(+ \n' - '\t\t\t\t\tc{0:02d}x \n' - '\t\t\t\t\t(/ c{0:02d}w 2) \n' - '\t\t\t\t) \n' - '\t\t\t\t(+ \n' - '\t\t\t\t\tc{1:02d}x \n' - '\t\t\t\t\t(/ c{1:02d}w 2) \n' - '\t\t\t\t) \n' - '\t\t\t) \n' - '\t\t\t{2} \n' - '\t\t)\n' - '\t\t(> (- (+ c{1:02d}x (/ c{1:02d}w 2)) ' - '(+ c{0:02d}x (/ c{0:02d}w 2))) {2})\n' - '\t\t(> (- (+ c{0:02d}y (/ c{0:02d}h 2)) ' - '(+ c{1:02d}y (/ c{1:02d}h 2))) {2})\n' - '\t\t(> (- (+ c{1:02d}y (/ c{1:02d}h 2)) ' - '(+ c{0:02d}y (/ c{0:02d}h 2))) {2})' + '(or ' + '(> (- (+ c{0:02d}x (/ c{0:02d}w 2) ) (+ c{1:02d}x (/ c{1:02d}w 2) ) ) {2} ) ' + '(> (- (+ c{1:02d}x (/ c{1:02d}w 2)) (+ c{0:02d}x (/ c{0:02d}w 2))) {2}) ' + '(> (- (+ c{0:02d}y (/ c{0:02d}h 2)) (+ c{1:02d}y (/ c{1:02d}h 2))) {2}) ' + '(> (- (+ c{1:02d}y (/ c{1:02d}h 2)) (+ c{0:02d}y (/ c{0:02d}h 2))) {2})' ')').format(i, j, pd)) -# Print the constraint that they have to be connected to a ps + # Print the constraint that they have to be connected to a ps for i, _ in enumerate(rc, 1+len(pc)): - print('\t(or') + print('(or') for j, _ in enumerate(pc, 1): print(( - '\t(not (or \n' - '\t\t(> c{0:02d}x (+ c{1:02d}x 1 c{1:02d}w)) ' - '(< (+ c{0:02d}x c{0:02d}w) (- c{1:02d}x 1))\n' - '\t\t(> c{0:02d}y (+ c{1:02d}y 1 c{1:02d}h)) ' - '(< (+ c{0:02d}y c{0:02d}h) (- c{1:02d}y 1))' + '(not (or ' + '(> c{0:02d}x (+ c{1:02d}x 1 c{1:02d}w)) (< (+ c{0:02d}x c{0:02d}w) (- c{1:02d}x 1)) ' + '(> c{0:02d}y (+ c{1:02d}y 1 c{1:02d}h)) (< (+ c{0:02d}y c{0:02d}h) (- c{1:02d}y 1))' '))').format(i, j)) - print('\t)') + print(')') # Close the and,benchmark parenthesis print("))")