/* * Copyright 2002, 2003, 2004, 2005 - Koalog */ package com.koalog.jcs.examples; import org.apache.log4j.PropertyConfigurator; import com.koalog.jcs.solver.DefaultSplitSolver; import com.koalog.jcs.constraint.BaseProblem; import com.koalog.jcs.constraint.arithmetic.Shift; import com.koalog.jcs.constraint.arithmetic.AllDifferent; import com.koalog.jcs.variable.IntegerVariable; /** * This is the famous queens problem. * It consists in placing n queens on a n*n chessboard * such that they don't threaten each other. * * @author Yan Georget */ public class QueensProblem extends BaseProblem { //------------------------------------------------------------------------ // CONSTRUCTORS //------------------------------------------------------------------------ /** * Sole constructor. * @param n the size of the problem */ public QueensProblem(int n) { super(); IntegerVariable q[] = new IntegerVariable[n]; IntegerVariable qp[] = new IntegerVariable[n]; IntegerVariable qm[] = new IntegerVariable[n]; for (int i=0; i