Download
language Essence 1.3
$ prob028.essence: Balanced Incomplete Block Design
$ Problem details available at http://www.csplib.org/Problems/prob028/

given v : int(2..)
given k : int(2..)
given lambda : int(1..)

where v > k
$ where lambda > k
$ where lambda > v

letting b be (lambda * v * (v - 1)) / (k * (k - 1))
letting r be (lambda * (v - 1)) / (k - 1)

letting Obj   be domain int(1..v) $ new type of size v
letting Block be domain int(1..b) $ new type of size b

find bibd : relation of (Obj * Block)

such that
    forAll o  : Obj   . |toSet(bibd(o,_ ))| = r,
    forAll bl : Block . |toSet(bibd(_,bl))| = k,
    forAll o1, o2 : Obj , o1 < o2 .
        |toSet(bibd(o1,_)) intersect toSet(bibd(o2,_))| = lambda

$ symmetry breaking
such that
    forAll o : int(1..v-1) .
        [ toInt(bibd(o,bl)) | bl : Block ] <=lex [ toInt(bibd(o+1,bl)) | bl : Block ],
    forAll bl : int(1..b-1) .
        [ toInt(bibd(o,bl)) | o : Obj ] <=lex [ toInt(bibd(o,bl+1)) | o : Obj ]