Getting Started
- JRE 11+ installed (Oracle or OpenJDK)
- Easier with:
- an IDE: IntelliJ IDEA, Eclipse IDE, Apache NetBeans or VSCode
- a build automation tool: Apache Maven 3+ or Gradle 6+
A first example
int n = 8;
Model model = new Model(n + "-queens problem");
IntVar[] vs = model.intVarArray("Q", n, 1, n);
model.allDifferent(vs).post();
for(int i = 0; i < n-1; i++){
for(int j = i + 1; j < n; j++){
model.arithm(vs[i], "!=", vs[j], "-", j - i).post();
model.arithm(vs[i], "!=", vs[j], "+", j - i).post();
}
}
Solution solution = model.getSolver().findSolution();
if(solution != null){
System.out.println(solution.toString());
}