#  Data file to solve the following KenKen:
#
#      a1-a2=4 or a2-a1 = 4
#      a3/b3 or b3/a3 = 3
#      a4*a5*b5*c5 = 300
#      a6-b6=4 or b6-a6=4
#      b1+b2+c2=11
#      b4*c3*c4=48
#      c1-d1=1 or d1-c1=1
#      c6-d6=1 or d6-c6=1
#      d2*e1*e2=10
#      d3+d4=6
#      d5*e4*e5=36
#      e3/f3=2 or f3/e3=2
#      e6-f6=2 or f6-e6=2
#      f1-f2=2 or f2-f1=2
#      f4-f5=5 or f5-f4=5
#
#  Nigel_Galloway@operamail.com
#  January 22nd., 2011


include "kenken.rules"

variables:
    ca1 : integer [1..6];
    ca2 : integer [1..6];
    ca3 : binary;
    ca4 : binary;
constraints:
    BOARD[1,1,3] = 0;
    BOARD[1,1,4] = 0;
    BOARD[1,2,3] = 0;
    BOARD[1,2,4] = 0;
    ca1*ca3 - ca2*ca3 = 4*ca3;
    ca2*ca4 - ca1*ca4 = 4*ca4;
    ca3+ca4=1;
    sum{z in ZBLS : BOARD[1,1,z]*z} = ca1;
    sum{z in ZBLS : BOARD[1,2,z]*z} = ca2;

variables:
    cb1 : integer [1..6];
    cb2 : integer [1..6];
    cb3 : binary;
    cb4 : binary;
constraints:
    BOARD[1,3,4] = 0;
    BOARD[1,3,5] = 0;
    BOARD[2,3,4] = 0;
    BOARD[2,3,5] = 0;
    cb1*3*cb3 = cb2*cb3;
    cb2*3*cb4 = cb1*cb4;
    cb3+cb4=1;
    sum{z in ZBLS : BOARD[1,3,z]*z} = cb1;
    sum{z in ZBLS : BOARD[2,3,z]*z} = cb2;

variables:
    cc1 : integer [1..6];
    cc2 : integer [1..6];
    cc3 : integer [1..6];
    cc4 : integer [1..6];
constraints:
    BOARD[1,4,1] = 0;
    BOARD[1,5,1] = 0;
    BOARD[2,5,1] = 0;
    BOARD[3,5,1] = 0;
    cc1 * cc2 * cc3 *cc4 = 300;
    sum{z in ZBLS : BOARD[1,4,z]*z} = cc1;
    sum{z in ZBLS : BOARD[1,5,z]*z} = cc2;
    sum{z in ZBLS : BOARD[2,5,z]*z} = cc3;
    sum{z in ZBLS : BOARD[3,5,z]*z} = cc4;

variables:
    cd1 : integer [1..6];
    cd2 : integer [1..6];
    cd3 : binary;
    cd4 : binary;
constraints:
    BOARD[1,6,3] = 0;
    BOARD[1,6,4] = 0;
    BOARD[2,6,3] = 0;
    BOARD[2,6,4] = 0;
    cd1*cd3 - cd2*cd3 = 4*cd3;
    cd2*cd4 - cd1*cd4 = 4*cd4;
    cd3+cd4=1;
    sum{z in ZBLS : BOARD[1,6,z]*z} = cd1;
    sum{z in ZBLS : BOARD[2,6,z]*z} = cd2;

constraints:
    sum{z in ZBLS : BOARD[2,1,z]*z} + sum{z in ZBLS : BOARD[2,2,z]*z} + sum{z in ZBLS : BOARD[3,2,z]*z} = 11;

variables:
    ce1 : integer [1..6];
    ce2 : integer [1..6];
    ce3 : integer [1..6];
constraints:
    BOARD[2,4,1] = 0;
    BOARD[2,4,5] = 0;
    BOARD[3,3,1] = 0;
    BOARD[3,3,5] = 0;
    BOARD[3,4,1] = 0;
    BOARD[3,4,5] = 0;
    ce1 * ce2 * ce3 = 48;
    sum{z in ZBLS : BOARD[2,4,z]*z} = ce1;
    sum{z in ZBLS : BOARD[3,3,z]*z} = ce2;
    sum{z in ZBLS : BOARD[3,4,z]*z} = ce3;

variables:
    cf1 : integer [1..6];
    cf2 : integer [1..6];
    cf3 : binary;
    cf4 : binary;
constraints:
    cf1*cf3 - cf2*cf3 = cf3;
    cf2*cf4 - cf1*cf4 = cf4;
    cf3+cf4=1;
    sum{z in ZBLS : BOARD[3,1,z]*z} = cf1;
    sum{z in ZBLS : BOARD[4,1,z]*z} = cf2;

variables:
    cg1 : integer [1..6];
    cg2 : integer [1..6];
    cg3 : binary;
    cg4 : binary;
constraints:
    cg1*cg3 - cg2*cg3 = cg3;
    cg2*cg4 - cg1*cg4 = cg4;
    cg3+cg4=1;
    sum{z in ZBLS : BOARD[3,6,z]*z} = cg1;
    sum{z in ZBLS : BOARD[4,6,z]*z} = cg2;

variables:
    ch1 : integer [1..6];
    ch2 : integer [1..6];
    ch3 : integer [1..6];
constraints:
    BOARD[4,2,3] = 0;
    BOARD[4,2,4] = 0;
    BOARD[4,2,6] = 0;
    BOARD[5,1,3] = 0;
    BOARD[5,1,4] = 0;
    BOARD[5,1,6] = 0;
    BOARD[5,2,3] = 0;
    BOARD[5,2,4] = 0;
    BOARD[5,2,6] = 0;
    ch1 * ch2 * ch3 = 10;
    sum{z in ZBLS : BOARD[4,2,z]*z} = ch1;
    sum{z in ZBLS : BOARD[5,1,z]*z} = ch2;
    sum{z in ZBLS : BOARD[5,2,z]*z} = ch3;

constraints:
    BOARD[4,3,3] = 0;
    BOARD[4,3,6] = 0;
    BOARD[4,4,3] = 0;
    BOARD[4,4,6] = 0;
    sum{z in ZBLS : BOARD[4,3,z]*z} + sum{z in ZBLS : BOARD[4,4,z]*z} = 6;

variables:
    ci1 : integer [1..6];
    ci2 : integer [1..6];
    ci3 : integer [1..6];
constraints:
    BOARD[4,5,5] = 0;
    BOARD[5,4,5] = 0;
    BOARD[5,5,5] = 0;
    ci1 * ci2 * ci3 = 36;
    sum{z in ZBLS : BOARD[4,5,z]*z} = ci1;
    sum{z in ZBLS : BOARD[5,4,z]*z} = ci2;
    sum{z in ZBLS : BOARD[5,5,z]*z} = ci3;

variables:
    cj1 : integer [1..6];
    cj2 : integer [1..6];
    cj3 : binary;
    cj4 : binary;
constraints:
    cj1*cj3 - cj2*cj3 = 2*cj3;
    cj2*cj4 - cj1*cj4 = 2*cj4;
    cj3+cj4=1;
    sum{z in ZBLS : BOARD[6,1,z]*z} = cj1;
    sum{z in ZBLS : BOARD[6,2,z]*z} = cj2;

variables:
    ck1 : integer [1..6];
    ck2 : integer [1..6];
    ck3 : binary;
    ck4 : binary;
constraints:
    BOARD[5,3,5] = 0;
    BOARD[6,3,5] = 0;
    ck1*2*ck3 = ck2*ck3;
    ck2*2*ck4 = ck1*ck4;
    ck3+ck4=1;
    sum{z in ZBLS : BOARD[5,3,z]*z} = ck1;
    sum{z in ZBLS : BOARD[6,3,z]*z} = ck2;

variables:
    cl1 : integer [1..6];
    cl2 : integer [1..6];
    cl3 : binary;
    cl4 : binary;
constraints:
    BOARD[6,4,2] = 0;
    BOARD[6,4,3] = 0;
    BOARD[6,4,4] = 0;
    BOARD[6,4,5] = 0;
    BOARD[6,5,2] = 0;
    BOARD[6,5,3] = 0;
    BOARD[6,5,4] = 0;
    BOARD[6,5,5] = 0;
    cl1*cl3 - cl2*cl3 = 5*cl3;
    cl2*cl4 - cl1*cl4 = 5*cl4;
    cl3+cl4=1;
    sum{z in ZBLS : BOARD[6,4,z]*z} = cl1;
    sum{z in ZBLS : BOARD[6,5,z]*z} = cl2;

variables:
    cm1 : integer [1..6];
    cm2 : integer [1..6];
    cm3 : binary;
    cm4 : binary;
constraints:
    cm1*cm3 - cm2*cm3 = 2*cm3;
    cm2*cm4 - cm1*cm4 = 2*cm4;
    cm3+cm4=1;
    sum{z in ZBLS : BOARD[5,6,z]*z} = cm1;
    sum{z in ZBLS : BOARD[6,6,z]*z} = cm2;

