/* * Copyright 2002, 2003, 2004, 2005 - Koalog */ package com.koalog.jcs.examples; import org.apache.log4j.PropertyConfigurator; import com.koalog.util.matrix.BaseMatrix; import com.koalog.jcs.variable.BooleanVariable; import com.koalog.jcs.constraint.BaseProblem; import com.koalog.jcs.constraint.bool.And; import com.koalog.jcs.constraint.arithmetic.Exactly; import com.koalog.jcs.solver.DefaultFFSolver; /** * The balanced incomplete block design problem. * *

A BIBD is defined as an arrangement of v distinct objects into b blocks * such that: *

* *

Another way of defining a BIBD is in terms of its incidence matrix, * which is a v by b binary matrix with exactly * r ones per row, * k ones per column and * with a scalar product of lambda between any pair of distinct rows. * * @author Yan Georget */ public class BIBDProblem extends BaseProblem { //------------------------------------------------------------------------ // CONSTRUCTOR //------------------------------------------------------------------------ /** * Sole constructor. * @param v the number of objects * @param b the number of blocks * @param r the number of blocks per object * @param k the number of objects per block * @param lambda number of times * two distinct objects occur together in a block */ public BIBDProblem(int v, int b, int r, int k, int lambda) { super(); BooleanVariable[] elements = new BooleanVariable[v*b]; for (int i=0; i