//
// How many solutions are there to the equation
// x + y + z = 11 where x,y,z in [0..11]
//
// Prove result is correct.
//

import static choco.Choco.*;
import choco.cp.model.CPModel;
import choco.cp.solver.CPSolver;
import choco.kernel.model.Model;
import choco.kernel.solver.Solver;
import choco.kernel.solver.ContradictionException;
import choco.kernel.model.variables.integer.IntegerExpressionVariable;
import choco.kernel.model.variables.integer.IntegerVariable;

public class XYZ11 {

  
  public static void main(String[] args) {
     Model m = new CPModel();
     int n = 11;

     IntegerVariable x    = makeIntVar("x",0,n);
     IntegerVariable y    = makeIntVar("y",0,n);
     IntegerVariable z    = makeIntVar("z",0,n);

     System.out.println(x.pretty());

     m.addConstraint(eq(sum(new IntegerVariable[]{x,y,z}),11));

     Solver s = new CPSolver();     
     s.read(m);                       
     s.solve(true);  

     System.out.println("feasible: " + s.isFeasible());
     System.out.println("nbSol: " + s.getNbSolutions());
  }
}