SolverFactory solverFactory = new XmlSolverFactory(
"/org/drools/planner/examples/nqueens/solver/nqueensSolverConfig.xml");
Solver solver = solverFactory.buildSolver();
// Load a problem with 8 queens
NQueens unsolved8Queens = new NQueensGenerator().createNQueens(8);
// Solve the problem
solver.setPlanningProblem(unsolved8Queens);
solver.solve();
NQueens solved8Queens = (NQueens) solver.getBestSolution();