/*
* Copyright 2002, 2003, 2004, 2005 - Koalog
*/
package com.koalog.jcs.examples;
import org.apache.log4j.PropertyConfigurator;
import java.util.Arrays;
import java.util.List;
import java.util.Collections;
import com.koalog.jcs.variable.IntegerVariable;
import com.koalog.jcs.solver.DefaultSplitSolver;
import com.koalog.jcs.constraint.BaseProblem;
import com.koalog.jcs.constraint.arithmetic.Hyperplan;
import com.koalog.jcs.constraint.arithmetic.ConstantSum;
import com.koalog.jcs.constraint.arithmetic.Count;
/**
* Find a sequence x_0, ... x_n-1
* such that each x_i is the number of occurence of i in the sequence.
*
* @author Yan Georget
*/
public class MagicSequenceProblem extends BaseProblem {
//------------------------------------------------------------------------
// CONSTRUCTORS
//------------------------------------------------------------------------
/**
* Sole constructor.
* @param n the size of the sequence
*/
public MagicSequenceProblem(int n) {
super();
IntegerVariable[] x = new IntegerVariable[n];
int c[] = new int[n];
c[0] = 0;
x[0] = new IntegerVariable("x0", 1, n-2);
c[1] = 1;
x[1] = new IntegerVariable("x1", 0, n-2);
for (int i=2; i